diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-10-27 10:55:30 +0000 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2019-10-27 11:59:40 +0100 |
commit | 0970381271bd07f020a888b027653ca627e8655c (patch) | |
tree | 95f5f6f94b7851b98a78a91a851d5e3783bd5ac2 /src/backends/dialog.rs | |
parent | ca06c4c4a2846b1c0410af1c7a68c65f5489a0b9 (diff) | |
download | dialog-rs-0970381271bd07f020a888b027653ca627e8655c.tar.gz dialog-rs-0970381271bd07f020a888b027653ca627e8655c.tar.bz2 |
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
Diffstat (limited to 'src/backends/dialog.rs')
-rw-r--r-- | src/backends/dialog.rs | 16 |
1 files changed, 11 insertions, 5 deletions
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<Dialog> 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(()) |