diff options
| author | Fuwn <[email protected]> | 2021-05-28 00:06:40 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-28 00:06:40 -0700 |
| commit | 179ce3277ece536cae41b834469f4065e3600d82 (patch) | |
| tree | a96d55a34531c9761f6309c35f8d9cfab9879db6 /crates/whirl_config/src | |
| parent | Merge branch 'develop' of https://github.com/Whirlsplash/whirl into develop (diff) | |
| download | whirl-179ce3277ece536cae41b834469f4065e3600d82.tar.xz whirl-179ce3277ece536cae41b834469f4065e3600d82.zip | |
fix(global): a lot of clippy warnings
This change makes clippy **a lot** more strict.
Diffstat (limited to 'crates/whirl_config/src')
| -rw-r--r-- | crates/whirl_config/src/lib.rs | 23 | ||||
| -rw-r--r-- | crates/whirl_config/src/structures.rs | 1 |
2 files changed, 20 insertions, 4 deletions
diff --git a/crates/whirl_config/src/lib.rs b/crates/whirl_config/src/lib.rs index 63fd5d0..e7bc121 100644 --- a/crates/whirl_config/src/lib.rs +++ b/crates/whirl_config/src/lib.rs @@ -10,7 +10,15 @@ decl_macro, proc_macro_hygiene )] -#![warn(rust_2018_idioms)] +#![deny( + warnings, + nonstandard_style, + unused, + future_incompatible, + rust_2018_idioms, + unsafe_code +)] +#![deny(clippy::all, clippy::nursery, clippy::pedantic)] #![recursion_limit = "128"] #[macro_use] @@ -39,11 +47,14 @@ pub struct Config { } impl Config { /// Re-fetch the configuration from the configuration file. + /// + /// # Panics + /// - May panic if the configuration is unable to be refreshed. #[deprecated( note = "the current implementation of the configurations system automatically performs \ refreshes, this method has no effects" )] - pub fn refresh() { let _ = config::Config::new().refresh(); } + pub fn refresh() { let _ = config::Config::new().refresh().unwrap(); } fn load() -> Result<Self, ConfigError> { let mut s = config::Config::new(); @@ -53,7 +64,11 @@ impl Config { } /// Get a certain configuration key or group from the configuration file. - pub fn get() -> Config { + /// + /// # Panics + /// - May panic if the configuration is unable to be read. + #[must_use] + pub fn get() -> Self { return if let Err(why) = Self::load() { error!( "unable to load configuration file, reverting to default value: {}", @@ -67,7 +82,7 @@ impl Config { } impl Default for Config { fn default() -> Self { - Config { + Self { whirlsplash: WhirlsplashConfig { worldsmaster_username: "WORLDSMASTER".to_string(), ip: "0.0.0.0".to_string(), diff --git a/crates/whirl_config/src/structures.rs b/crates/whirl_config/src/structures.rs index 4f1d62e..5b2f163 100644 --- a/crates/whirl_config/src/structures.rs +++ b/crates/whirl_config/src/structures.rs @@ -18,6 +18,7 @@ pub struct WhirlsplashPromptConfig { pub enable: bool, pub ps1: String, } +#[allow(clippy::struct_excessive_bools)] #[derive(Serialize, Deserialize, Debug)] pub struct WhirlsplashLogConfig { pub enable: bool, |