diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-11-04 00:11:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-04 00:11:51 +0000 |
commit | 0b1754e73f5238a449a07979666a544877be9042 (patch) | |
tree | c0636fcc58264217c9077ac1e2985e1f8b6b7d29 | |
parent | d2f4972703fc95e20251796665feb00c768862d4 (diff) | |
download | alacritty-0b1754e73f5238a449a07979666a544877be9042.tar.gz alacritty-0b1754e73f5238a449a07979666a544877be9042.zip |
Fix clippy issues
This resolves all existing clippy issues and removes some old `allow`
annotations which aren't neccesary anymore.
-rw-r--r-- | font/src/ft/fc/mod.rs | 2 | ||||
-rw-r--r-- | src/config.rs | 7 | ||||
-rw-r--r-- | src/index.rs | 1 | ||||
-rw-r--r-- | src/input.rs | 8 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 22 |
6 files changed, 7 insertions, 35 deletions
diff --git a/font/src/ft/fc/mod.rs b/font/src/ft/fc/mod.rs index a999a408..5e5deb0c 100644 --- a/font/src/ft/fc/mod.rs +++ b/font/src/ft/fc/mod.rs @@ -72,7 +72,6 @@ pub fn font_match( } /// list fonts by closeness to the pattern -#[allow(dead_code)] pub fn font_sort( config: &ConfigRef, pattern: &mut PatternRef, @@ -104,7 +103,6 @@ pub fn font_sort( } /// List fonts matching pattern -#[allow(dead_code)] pub fn font_list( config: &ConfigRef, pattern: &mut PatternRef, diff --git a/src/config.rs b/src/config.rs index 5e30b65a..85859cfe 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1459,7 +1459,7 @@ impl Config { /// 2. $XDG_CONFIG_HOME/alacritty.yml /// 3. $HOME/.config/alacritty/alacritty.yml /// 4. $HOME/.alacritty.yml - #[cfg(not(windows))] + #[cfg(not(windows))] pub fn installed_config<'a>() -> Option<Cow<'a, Path>> { // Try using XDG location by default ::xdg::BaseDirectories::with_prefix("alacritty") @@ -1489,7 +1489,7 @@ impl Config { } #[cfg(windows)] - pub fn installed_config() -> Option<Cow<'static, Path>> { + pub fn installed_config<'a>() -> Option<Cow<'a, Path>> { if let Some(mut path) = ::std::env::home_dir() { path.push("alacritty"); path.set_extension("yml"); @@ -1512,7 +1512,7 @@ impl Config { #[cfg(windows)] pub fn write_defaults() -> io::Result<Cow<'static, Path>> { let path = ::std::env::home_dir() - .ok_or(io::Error::new(io::ErrorKind::NotFound, "could not find profile directory")) + .ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "could not find profile directory")) .and_then(|mut p| {p.push("alacritty"); p.set_extension("yml"); Ok(p)})?; File::create(&path)?.write_all(DEFAULT_ALACRITTY_CONFIG.as_bytes())?; Ok(path.into()) @@ -2101,7 +2101,6 @@ mod tests { } } -#[cfg_attr(feature = "cargo-clippy", allow(enum_variant_names))] #[derive(Deserialize, Copy, Clone, Debug, Eq, PartialEq)] pub enum Key { Scancode(u32), diff --git a/src/index.rs b/src/index.rs index 8ac1ab3a..e490c720 100644 --- a/src/index.rs +++ b/src/index.rs @@ -347,7 +347,6 @@ macro_rules! ops { impl $ty { #[inline] - #[allow(trivial_numeric_casts)] fn steps_between(start: $ty, end: $ty, by: $ty) -> Option<usize> { if by == $construct(0) { return None; } if start < end { diff --git a/src/input.rs b/src/input.rs index 5c4436bd..5235066b 100644 --- a/src/input.rs +++ b/src/input.rs @@ -320,10 +320,10 @@ impl RelaxedEq for ModifiersState { // Make sure that modifiers in the config are always present, // but ignore surplus modifiers. fn relaxed_eq(&self, other: Self) -> bool { - !((self.shift && !other.shift) - || (self.ctrl && !other.ctrl) - || (self.alt && !other.alt) - || (self.logo && !other.logo)) + (!self.logo || other.logo) + && (!self.alt || other.alt) + && (!self.ctrl || other.ctrl) + && (!self.shift || other.shift) } } @@ -127,9 +127,7 @@ impl Mul<f32> for Rgb { } -#[allow(unused_mut)] pub mod gl { - #![allow(non_upper_case_globals)] #![cfg_attr(feature = "cargo-clippy", allow(clippy))] include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); } diff --git a/src/main.rs b/src/main.rs index 57a7ba2e..af21b980 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,7 +89,6 @@ fn main() { /// If a configuration file is given as a command line argument we don't /// generate a default file. If an empty configuration file is given, i.e. /// /dev/null, we load the compiled-in defaults.) -#[cfg(not(windows))] fn load_config(options: &cli::Options) -> Config { let config_path = options.config_path() .or_else(Config::installed_config) @@ -103,27 +102,6 @@ fn load_config(options: &cli::Options) -> Config { Config::default() }) } -#[cfg(windows)] -fn load_config(options: &cli::Options) -> Config { - let config_path = options - .config_path() - .or_else(|| Config::installed_config()) - .unwrap_or_else(|| { - Config::write_defaults() - .unwrap_or_else(|err| die!("Write defaults config failure: {}", err)) - }); - - Config::load_from(&*config_path).unwrap_or_else(|err| match err { - config::Error::NotFound => { - die!("Config file not found after writing: {}", config_path.display()); - } - config::Error::Empty => { - eprintln!("Empty config; Loading defaults"); - Config::default() - } - _ => die!("{}", err), - }) -} /// Run Alacritty /// |