diff options
author | Stuart Stock <stuart@int08h.com> | 2019-08-11 18:09:26 -0500 |
---|---|---|
committer | Stuart Stock <stuart@int08h.com> | 2019-08-11 18:09:26 -0500 |
commit | 266f1adc99f780edab22096ed13f624bfdcb6674 (patch) | |
tree | 8185063cc9653105067c1e9caaf2495c289054bc /src/config/mod.rs | |
parent | a0165c01946efbedd2f274bad02a33ab52c01e32 (diff) | |
download | roughenough-266f1adc99f780edab22096ed13f624bfdcb6674.zip |
Address clippy lints
* More consistent use of `dyn`
* Add default implementations
* Misc clippy changes
Diffstat (limited to 'src/config/mod.rs')
-rw-r--r-- | src/config/mod.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 1d1d149..6ce542a 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -141,7 +141,8 @@ pub fn make_config(arg: &str) -> Result<Box<dyn ServerConfig>, Error> { /// /// Validate configuration settings. Returns `true` if the config is valid, `false` otherwise. /// -pub fn is_valid_config(cfg: &Box<dyn ServerConfig>) -> bool { +#[allow(clippy::useless_let_if_seq)] +pub fn is_valid_config(cfg: &dyn ServerConfig) -> bool { let mut is_valid = true; if cfg.port() == 0 { @@ -179,17 +180,14 @@ pub fn is_valid_config(cfg: &Box<dyn ServerConfig>) -> bool { } if is_valid { - match cfg.udp_socket_addr() { - Err(e) => { - error!( - "failed to create UDP socket {}:{} {:?}", - cfg.interface(), - cfg.port(), - e - ); - is_valid = false; - } - _ => (), + if let Err(e) = cfg.udp_socket_addr() { + error!( + "failed to create UDP socket {}:{} {:?}", + cfg.interface(), + cfg.port(), + e + ); + is_valid = false; } } |