From: Ian Jackson Date: Wed, 30 Mar 2022 23:36:09 +0000 (+0100) Subject: Html type: impl Default and derive new() X-Git-Tag: otter-1.0.0~64 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=33b03b0a423058a3b1018abc35011fb9a7f1cc32;p=otter.git Html type: impl Default and derive new() Default suggested by clippy. Signed-off-by: Ian Jackson --- diff --git a/base/html.rs b/base/html.rs index 4af4d2b4..7f8f7b22 100644 --- a/base/html.rs +++ b/base/html.rs @@ -4,7 +4,7 @@ use crate::prelude::*; -#[derive(Clone,Serialize,Deserialize,Hash,Eq,Ord,PartialEq,PartialOrd)] +#[derive(Clone,Serialize,Default,Deserialize,Hash,Eq,Ord,PartialEq,PartialOrd)] #[serde(transparent)] pub struct Html(String); @@ -83,7 +83,7 @@ impl<'e, T:Display+'e> HtmlFormat<'e> for IsHtmlFormatted { } impl Html { - pub fn new() -> Self { Html(String::new()) } + pub fn new() -> Self { default() } pub fn from_txt(s: &str) -> Self { Html(htmlescape::encode_minimal(&s)) }