diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-10-16 11:15:38 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-10-16 11:15:38 +0300 |
commit | a12392c7b906ce7bd7c6da39ae320bd983811fd2 (patch) | |
tree | 7838975220ce817bf6cfaf37f63ee5697287e855 | |
parent | 919815361d086f1a7d1bc004efd60eb7ad318276 (diff) | |
download | riki-a12392c7b906ce7bd7c6da39ae320bd983811fd2.tar.gz |
style: implement Default instead of argument-less new
Sponsored-by: author
-rw-r--r-- | src/directive/calendar.rs | 8 | ||||
-rw-r--r-- | src/directive/format.rs | 8 | ||||
-rw-r--r-- | src/directive/graph.rs | 8 | ||||
-rw-r--r-- | src/directive/map.rs | 8 | ||||
-rw-r--r-- | src/directive/sidebar.rs | 8 |
5 files changed, 10 insertions, 30 deletions
diff --git a/src/directive/calendar.rs b/src/directive/calendar.rs index 1c02e16..b24f39b 100644 --- a/src/directive/calendar.rs +++ b/src/directive/calendar.rs @@ -3,7 +3,7 @@ use crate::page::PageMeta; use crate::site::Site; use crate::wikitext::ParsedDirective; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct Calendar {} impl Calendar { @@ -19,10 +19,6 @@ impl Calendar { ]; pub const ALLOW_ANY_UNNAMED: bool = true; - pub fn new() -> Self { - Self {} - } - pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> { Ok("FIXME:graph".into()) } @@ -30,6 +26,6 @@ impl Calendar { impl From<&ParsedDirective> for Calendar { fn from(_: &ParsedDirective) -> Self { - Calendar::new() + Calendar::default() } } diff --git a/src/directive/format.rs b/src/directive/format.rs index 6483310..a40c439 100644 --- a/src/directive/format.rs +++ b/src/directive/format.rs @@ -3,7 +3,7 @@ use crate::page::PageMeta; use crate::site::Site; use crate::wikitext::ParsedDirective; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct Format {} impl Format { @@ -11,10 +11,6 @@ impl Format { pub const ALLOWED: &'static [&'static str] = &[]; pub const ALLOW_ANY_UNNAMED: bool = true; - pub fn new() -> Self { - Self {} - } - pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> { Ok("FIXME:format".into()) } @@ -22,6 +18,6 @@ impl Format { impl From<&ParsedDirective> for Format { fn from(_: &ParsedDirective) -> Self { - Format::new() + Format::default() } } diff --git a/src/directive/graph.rs b/src/directive/graph.rs index a3d15ef..c8c7480 100644 --- a/src/directive/graph.rs +++ b/src/directive/graph.rs @@ -3,7 +3,7 @@ use crate::page::PageMeta; use crate::site::Site; use crate::wikitext::ParsedDirective; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct Graph {} impl Graph { @@ -11,10 +11,6 @@ impl Graph { pub const ALLOWED: &'static [&'static str] = &["src", "type"]; pub const ALLOW_ANY_UNNAMED: bool = true; - pub fn new() -> Self { - Self {} - } - pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> { Ok("FIXME:graph".into()) } @@ -22,6 +18,6 @@ impl Graph { impl From<&ParsedDirective> for Graph { fn from(_: &ParsedDirective) -> Self { - Graph::new() + Graph::default() } } diff --git a/src/directive/map.rs b/src/directive/map.rs index 32b56cc..20bd222 100644 --- a/src/directive/map.rs +++ b/src/directive/map.rs @@ -3,7 +3,7 @@ use crate::page::PageMeta; use crate::site::Site; use crate::wikitext::ParsedDirective; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct Map {} impl Map { @@ -11,10 +11,6 @@ impl Map { pub const ALLOWED: &'static [&'static str] = &["show"]; pub const ALLOW_ANY_UNNAMED: bool = true; - pub fn new() -> Self { - Self {} - } - pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> { Ok("FIXME:map".into()) } @@ -22,6 +18,6 @@ impl Map { impl From<&ParsedDirective> for Map { fn from(_: &ParsedDirective) -> Self { - Map::new() + Map::default() } } diff --git a/src/directive/sidebar.rs b/src/directive/sidebar.rs index d68f9be..b80bfe9 100644 --- a/src/directive/sidebar.rs +++ b/src/directive/sidebar.rs @@ -3,7 +3,7 @@ use crate::page::PageMeta; use crate::site::Site; use crate::wikitext::ParsedDirective; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct Sidebar {} impl Sidebar { @@ -11,10 +11,6 @@ impl Sidebar { pub const ALLOWED: &'static [&'static str] = &["content"]; pub const ALLOW_ANY_UNNAMED: bool = true; - pub fn new() -> Self { - Self {} - } - pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> { Ok("FIXME:sidebar".into()) } @@ -22,6 +18,6 @@ impl Sidebar { impl From<&ParsedDirective> for Sidebar { fn from(_: &ParsedDirective) -> Self { - Sidebar::new() + Sidebar::default() } } |