From: Ian Jackson Date: Sun, 4 Feb 2024 12:58:15 +0000 (+0000) Subject: Derive Default and use it instead of open-coding in new X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=cf9bfedfb72dc2a2af97114f070b7d6eafca7a43;p=mastodonochrome.git Derive Default and use it instead of open-coding in new --- diff --git a/src/text.rs b/src/text.rs index af33780..e20223a 100644 --- a/src/text.rs +++ b/src/text.rs @@ -1044,13 +1044,14 @@ fn test_html() { }); } +#[derive(Default)] pub struct ExtendableIndicator { primed: bool, } impl ExtendableIndicator { pub fn new() -> Self { - ExtendableIndicator { primed: false } + Default::default() } pub fn set_primed(&mut self, primed: bool) { @@ -1682,6 +1683,7 @@ struct Keypress { description: ColouredString, } +#[derive(Default)] pub struct FileStatusLine { keypresses: Vec<(Keypress, usize)>, // each with display priority proportion: Option, @@ -1697,11 +1699,7 @@ impl FileStatusLine { const SPACING: usize = 2; pub fn new() -> FileStatusLine { - FileStatusLine { - keypresses: Vec::new(), - proportion: None, - message: None, - } + Default::default() } pub fn set_proportion(mut self, numer: usize, denom: usize) -> Self {