From 33b03b0a423058a3b1018abc35011fb9a7f1cc32 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 31 Mar 2022 00:36:09 +0100 Subject: [PATCH] Html type: impl Default and derive new() Default suggested by clippy. Signed-off-by: Ian Jackson --- base/html.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)) } -- 2.30.2