From 0970381271bd07f020a888b027653ca627e8655c Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 27 Oct 2019 10:55:30 +0000 Subject: Implement Default for all backend structs This fixes the clippy warning new_without_default [0]. [0] https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default --- src/backends/dialog.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/backends/dialog.rs') diff --git a/src/backends/dialog.rs b/src/backends/dialog.rs index 85b0294..8061d98 100644 --- a/src/backends/dialog.rs +++ b/src/backends/dialog.rs @@ -19,11 +19,7 @@ pub struct Dialog { impl Dialog { /// Creates a new `Dialog` instance without configuration. pub fn new() -> Dialog { - Dialog { - backtitle: None, - height: "0".to_string(), - width: "0".to_string(), - } + Default::default() } /// Sets the backtitle for the dialog boxes. @@ -87,6 +83,16 @@ impl AsRef for Dialog { } } +impl Default for Dialog { + fn default() -> Self { + Dialog { + backtitle: None, + height: "0".to_string(), + width: "0".to_string(), + } + } +} + fn require_success(status: process::ExitStatus) -> Result<()> { if status.success() { Ok(()) -- cgit v1.2.1