diff options
author | Aaron Hill <aa1ronham@gmail.com> | 2017-09-27 20:29:44 -0400 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-09-27 17:29:44 -0700 |
commit | 5f7885749c4d7e48869b1fc0be4d430601cdbbfa (patch) | |
tree | 77916f2d24f71c846700139bbeaacec1f8699928 /src | |
parent | eb231b3e70b87875df4bdd1974d5e94704024d70 (diff) | |
download | alacritty-5f7885749c4d7e48869b1fc0be4d430601cdbbfa.tar.gz alacritty-5f7885749c4d7e48869b1fc0be4d430601cdbbfa.zip |
Use clippy = "*", update, and fix some warnings (#796)
Because there are so many clippy warnings in the current codebase,
this commit removes '#![cfg_attr(feature = "clippy", deny(clippy))]',
to make it easier to fix warnings incrementally.
Diffstat (limited to 'src')
-rw-r--r-- | src/ansi.rs | 2 | ||||
-rw-r--r-- | src/cli.rs | 4 | ||||
-rw-r--r-- | src/config.rs | 2 | ||||
-rw-r--r-- | src/display.rs | 2 | ||||
-rw-r--r-- | src/grid.rs | 2 | ||||
-rw-r--r-- | src/input.rs | 8 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/logging.rs | 8 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/renderer/mod.rs | 2 | ||||
-rw-r--r-- | src/term/mod.rs | 2 | ||||
-rw-r--r-- | src/tty.rs | 4 | ||||
-rw-r--r-- | src/window.rs | 10 |
13 files changed, 24 insertions, 26 deletions
diff --git a/src/ansi.rs b/src/ansi.rs index 26a342e4..9e682cd3 100644 --- a/src/ansi.rs +++ b/src/ansi.rs @@ -909,7 +909,7 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W> 'm' => { // Sometimes a C-style for loop is just what you need let mut i = 0; // C-for initializer - if args.len() == 0 { + if args.is_empty() { handler.terminal_attribute(Attr::Reset); return; } @@ -123,8 +123,8 @@ impl Options { } if let Some(mut dimensions) = matches.values_of("dimensions") { - let width = dimensions.next().map(|w| w.parse().map(|w| Column(w))); - let height = dimensions.next().map(|h| h.parse().map(|h| Line(h))); + let width = dimensions.next().map(|w| w.parse().map(Column)); + let height = dimensions.next().map(|h| h.parse().map(Line)); if let (Some(Ok(width)), Some(Ok(height))) = (width, height) { options.dimensions = Some(Dimensions::new(width, height)); } diff --git a/src/config.rs b/src/config.rs index 61ca5544..cef4d22a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -79,7 +79,7 @@ impl Default for Mouse { } } -/// VisulBellAnimations are modeled after a subset of CSS transitions and Robert +/// `VisualBellAnimations` are modeled after a subset of CSS transitions and Robert /// Penner's Easing Functions. #[derive(Clone, Copy, Debug, Deserialize)] pub enum VisualBellAnimation { diff --git a/src/display.rs b/src/display.rs index 1055944c..012d803b 100644 --- a/src/display.rs +++ b/src/display.rs @@ -259,7 +259,7 @@ impl Display { terminal.resize(w as f32, h as f32); let size = terminal.size_info(); - for mut item in items { + for item in items { item.on_resize(size) } diff --git a/src/grid.rs b/src/grid.rs index f630045a..c57787bf 100644 --- a/src/grid.rs +++ b/src/grid.rs @@ -359,7 +359,7 @@ impl<'a, T> IntoIterator for &'a mut Row<T> { type IntoIter = slice::IterMut<'a, T>; #[inline] - fn into_iter(mut self) -> slice::IterMut<'a, T> { + fn into_iter(self) -> slice::IterMut<'a, T> { self.iter_mut() } } diff --git a/src/input.rs b/src/input.rs index f11aec34..4be7dac5 100644 --- a/src/input.rs +++ b/src/input.rs @@ -267,9 +267,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { if line < Line(223) && column < Column(223) { let msg = vec![ - '\x1b' as u8, - '[' as u8, - 'M' as u8, + b'\x1b', + b'[', + b'M', 32 + button, 32 + 1 + column.0 as u8, 32 + 1 + line.0 as u8, @@ -443,7 +443,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { *self.ctx.received_count() = 0; *self.ctx.suppress_chars() = false; - if self.process_key_bindings(&mods, key) { + if self.process_key_bindings(mods, key) { *self.ctx.suppress_chars() = true; } }, @@ -15,7 +15,6 @@ //! Alacritty - The GPU Enhanced Terminal #![cfg_attr(feature = "clippy", feature(plugin))] #![cfg_attr(feature = "clippy", plugin(clippy))] -#![cfg_attr(feature = "clippy", deny(clippy))] #![cfg_attr(feature = "clippy", deny(enum_glob_use))] #![cfg_attr(feature = "clippy", deny(if_not_else))] #![cfg_attr(feature = "clippy", deny(wrong_pub_self_convention))] @@ -103,6 +102,7 @@ impl Mul<f32> for Rgb { #[cfg_attr(feature = "clippy", allow(too_many_arguments))] #[cfg_attr(feature = "clippy", allow(doc_markdown))] +#[cfg_attr(feature = "clippy", allow(unreadable_literal))] pub mod gl { #![allow(non_upper_case_globals)] include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); diff --git a/src/logging.rs b/src/logging.rs index f5340d05..6b7a7968 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -43,11 +43,9 @@ impl<T: Send + io::Write> log::Log for Logger<T> { } fn log(&self, record: &log::LogRecord) { - if self.enabled(record.metadata()) { - if record.target().starts_with("alacritty") { - if let Ok(ref mut writer) = self.output.lock() { - let _ = writer.write(format!("{}\n", record.args()).as_ref()); - } + if self.enabled(record.metadata()) && record.target().starts_with("alacritty") { + if let Ok(ref mut writer) = self.output.lock() { + writer.write_all(format!("{}\n", record.args()).as_ref()).expect("Error while logging!"); } } } diff --git a/src/main.rs b/src/main.rs index 97e55341..ec327009 100644 --- a/src/main.rs +++ b/src/main.rs @@ -125,7 +125,7 @@ fn run(mut config: Config, options: cli::Options) -> Result<(), Box<Error>> { // synchronized since the I/O loop updates the state, and the display // consumes it periodically. let event_loop = EventLoop::new( - terminal.clone(), + Arc::clone(&terminal), display.notifier(), pty.reader(), options.ref_test, diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 60362f87..9ce690ca 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -588,7 +588,7 @@ impl QuadRenderer { while let Ok(msg) = self.rx.try_recv() { match msg { Msg::ShaderReload => { - self.reload_shaders(&config, Size { + self.reload_shaders(config, Size { width: Pixels(props.width as u32), height: Pixels(props.height as u32) }); diff --git a/src/term/mod.rs b/src/term/mod.rs index 027feaf1..8dcfa365 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -1566,7 +1566,7 @@ impl ansi::Handler for Term { #[inline] fn save_cursor_position(&mut self) { trace!("CursorSave"); - let mut cursor = if self.alt { + let cursor = if self.alt { &mut self.cursor_save_alt } else { &mut self.cursor_save @@ -183,9 +183,9 @@ pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: T, window_id: let default_shell = &Shell::new(pw.shell); let shell = config.shell() - .unwrap_or(&default_shell); + .unwrap_or(default_shell); - let initial_command = options.command().unwrap_or(&shell); + let initial_command = options.command().unwrap_or(shell); let mut builder = Command::new(initial_command.program()); for arg in initial_command.args() { diff --git a/src/window.rs b/src/window.rs index d5d35b8e..f24def3a 100644 --- a/src/window.rs +++ b/src/window.rs @@ -192,10 +192,10 @@ impl Window { .with_vsync(true); let window = ::glutin::GlWindow::new(window, context, &event_loop)?; - /// Set OpenGL symbol loader + // Set OpenGL symbol loader gl::load_with(|symbol| window.get_proc_address(symbol) as *const _); - /// Make the context current so OpenGL operations can run + // Make the context current so OpenGL operations can run unsafe { window.make_current()?; } @@ -294,10 +294,10 @@ impl Window { use libc::{setlocale, LC_CTYPE}; let xlib = xlib::Xlib::open().expect("get xlib"); unsafe { - /// Use empty c string to fallback to LC_CTYPE in environment variables + // Use empty c string to fallback to LC_CTYPE in environment variables setlocale(LC_CTYPE, b"\0".as_ptr() as *const _); - /// Use empty c string for implementation dependent behavior, - /// which might be the XMODIFIERS set in env + // Use empty c string for implementation dependent behavior, + // which might be the XMODIFIERS set in env (xlib.XSetLocaleModifiers)(b"\0".as_ptr() as *const _); } } |