aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Astrakhan <yuriastrakhan@gmail.com>2022-06-01 21:22:50 -0400
committerGitHub <noreply@github.com>2022-06-02 01:22:50 +0000
commit56a69c0bfe5742aeda1c4942b748f5a842ce6773 (patch)
tree511c45e5a79a7f77dde3521bf5784a8ad476e6a8
parente20541a83e55d5ddd57b1bed0f4666b3c73f680d (diff)
downloadalacritty-56a69c0bfe5742aeda1c4942b748f5a842ce6773.tar.gz
alacritty-56a69c0bfe5742aeda1c4942b748f5a842ce6773.zip
Fix a few minor clippy lints
-rw-r--r--alacritty/src/cli.rs8
-rw-r--r--alacritty/src/config/bindings.rs2
-rw-r--r--alacritty/src/config/ui_config.rs4
-rw-r--r--alacritty/src/config/window.rs2
-rw-r--r--alacritty/src/display/hint.rs2
-rw-r--r--alacritty/src/display/mod.rs2
-rw-r--r--alacritty/src/main.rs3
-rw-r--r--alacritty/src/renderer/text/atlas.rs2
-rw-r--r--alacritty_terminal/src/config/mod.rs2
-rw-r--r--alacritty_terminal/src/event_loop.rs2
-rw-r--r--alacritty_terminal/src/selection.rs10
-rw-r--r--alacritty_terminal/src/term/color.rs10
-rw-r--r--alacritty_terminal/src/tty/mod.rs2
13 files changed, 25 insertions, 26 deletions
diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs
index a53c6ef3..3c64458b 100644
--- a/alacritty/src/cli.rs
+++ b/alacritty/src/cli.rs
@@ -174,7 +174,7 @@ fn parse_class(input: &str) -> Result<Class, String> {
}
/// Terminal specific cli options which can be passed to new windows via IPC.
-#[derive(Serialize, Deserialize, Args, Default, Debug, Clone, PartialEq)]
+#[derive(Serialize, Deserialize, Args, Default, Debug, Clone, PartialEq, Eq)]
pub struct TerminalOptions {
/// Start the shell in the specified working directory.
#[clap(long)]
@@ -225,7 +225,7 @@ impl From<TerminalOptions> for PtyConfig {
}
/// Window specific cli options which can be passed to new windows via IPC.
-#[derive(Serialize, Deserialize, Args, Default, Debug, Clone, PartialEq)]
+#[derive(Serialize, Deserialize, Args, Default, Debug, Clone, PartialEq, Eq)]
pub struct WindowIdentity {
/// Defines the window title [default: Alacritty].
#[clap(short, long)]
@@ -270,14 +270,14 @@ pub struct MessageOptions {
/// Available socket messages.
#[cfg(unix)]
-#[derive(Subcommand, Serialize, Deserialize, Debug, Clone, PartialEq)]
+#[derive(Subcommand, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub enum SocketMessage {
/// Create a new window in the same Alacritty process.
CreateWindow(WindowOptions),
}
/// Subset of options that we pass to a 'create-window' subcommand.
-#[derive(Serialize, Deserialize, Args, Default, Clone, Debug, PartialEq)]
+#[derive(Serialize, Deserialize, Args, Default, Clone, Debug, PartialEq, Eq)]
pub struct WindowOptions {
/// Terminal options which can be passed via IPC.
#[clap(flatten)]
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
index 99d41c28..4c706811 100644
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -1009,7 +1009,7 @@ impl<'a> Deserialize<'a> for RawBinding {
let val = map.next_value::<SerdeValue>()?;
if val.is_u64() {
let scancode = val.as_u64().unwrap();
- if scancode > u64::from(std::u32::MAX) {
+ if scancode > u64::from(u32::MAX) {
return Err(<V::Error as Error>::custom(format!(
"Invalid key binding, scancode too big: {}",
scancode
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
index 353249d5..74b61923 100644
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -144,7 +144,7 @@ impl UiConfig {
}
}
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq, Eq)]
struct KeyBindings(Vec<KeyBinding>);
impl Default for KeyBindings {
@@ -162,7 +162,7 @@ impl<'de> Deserialize<'de> for KeyBindings {
}
}
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq, Eq)]
struct MouseBindings(Vec<MouseBinding>);
impl Default for MouseBindings {
diff --git a/alacritty/src/config/window.rs b/alacritty/src/config/window.rs
index f181289a..813c0f3a 100644
--- a/alacritty/src/config/window.rs
+++ b/alacritty/src/config/window.rs
@@ -106,7 +106,7 @@ impl WindowConfig {
}
}
-#[derive(ConfigDeserialize, Debug, Clone, PartialEq)]
+#[derive(ConfigDeserialize, Debug, Clone, PartialEq, Eq)]
pub struct Identity {
/// Window title.
pub title: String,
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
index d554993b..8cdb9708 100644
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -164,7 +164,7 @@ impl HintState {
}
/// Hint match which was selected by the user.
-#[derive(PartialEq, Debug, Clone)]
+#[derive(PartialEq, Eq, Debug, Clone)]
pub struct HintMatch {
/// Action for handling the text.
pub action: HintAction,
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
index a1788175..91f575e4 100644
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -293,7 +293,7 @@ impl TermDimensions for SizeInfo {
}
}
-#[derive(Default, Clone, Debug, PartialEq)]
+#[derive(Default, Clone, Debug, PartialEq, Eq)]
pub struct DisplayUpdate {
pub dirty: bool,
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs
index 8942aa30..7fe7bd92 100644
--- a/alacritty/src/main.rs
+++ b/alacritty/src/main.rs
@@ -14,6 +14,7 @@ compile_error!(r#"at least one of the "x11"/"wayland" features must be enabled"#
#[cfg(target_os = "macos")]
use std::env;
+use std::fmt::Write as _;
use std::io::{self, Write};
use std::path::PathBuf;
use std::string::ToString;
@@ -233,7 +234,7 @@ fn log_config_path(config: &UiConfig) {
let mut msg = String::from("Configuration files loaded from:");
for path in &config.config_paths {
- msg.push_str(&format!("\n {:?}", path.display()));
+ let _ = write!(msg, "\n {:?}", path.display());
}
info!("{}", msg);
diff --git a/alacritty/src/renderer/text/atlas.rs b/alacritty/src/renderer/text/atlas.rs
index 97c8b0b4..0922c570 100644
--- a/alacritty/src/renderer/text/atlas.rs
+++ b/alacritty/src/renderer/text/atlas.rs
@@ -256,7 +256,7 @@ impl Atlas {
}
#[inline]
- pub fn clear_atlas(atlas: &mut Vec<Atlas>, current_atlas: &mut usize) {
+ pub fn clear_atlas(atlas: &mut [Atlas], current_atlas: &mut usize) {
for atlas in atlas.iter_mut() {
atlas.clear();
}
diff --git a/alacritty_terminal/src/config/mod.rs b/alacritty_terminal/src/config/mod.rs
index e99c37b5..40c42d4f 100644
--- a/alacritty_terminal/src/config/mod.rs
+++ b/alacritty_terminal/src/config/mod.rs
@@ -33,7 +33,7 @@ pub struct Config {
pub pty_config: PtyConfig,
}
-#[derive(ConfigDeserialize, Clone, Debug, PartialEq, Default)]
+#[derive(ConfigDeserialize, Clone, Debug, PartialEq, Eq, Default)]
pub struct PtyConfig {
/// Path to a shell program to run on startup.
pub shell: Option<Program>,
diff --git a/alacritty_terminal/src/event_loop.rs b/alacritty_terminal/src/event_loop.rs
index 3f10f66f..b0877224 100644
--- a/alacritty_terminal/src/event_loop.rs
+++ b/alacritty_terminal/src/event_loop.rs
@@ -24,7 +24,7 @@ use crate::{ansi, thread, tty};
const READ_BUFFER_SIZE: usize = 0x10_0000;
/// Max bytes to read from the PTY while the terminal is locked.
-const MAX_LOCKED_READ: usize = u16::max_value() as usize;
+const MAX_LOCKED_READ: usize = u16::MAX as usize;
/// Messages that may be sent to the `EventLoop`.
#[derive(Debug)]
diff --git a/alacritty_terminal/src/selection.rs b/alacritty_terminal/src/selection.rs
index 09880c77..97a80ec3 100644
--- a/alacritty_terminal/src/selection.rs
+++ b/alacritty_terminal/src/selection.rs
@@ -16,7 +16,7 @@ use crate::term::cell::{Cell, Flags};
use crate::term::Term;
/// A Point and side within that point.
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
struct Anchor {
point: Point,
side: Side,
@@ -89,7 +89,7 @@ impl SelectionRange {
}
/// Different kinds of selection.
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum SelectionType {
Simple,
Block,
@@ -115,7 +115,7 @@ pub enum SelectionType {
/// [`semantic`]: enum.Selection.html#method.semantic
/// [`lines`]: enum.Selection.html#method.lines
/// [`update`]: enum.Selection.html#method.update
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Selection {
pub ty: SelectionType,
region: Range<Anchor>,
@@ -236,13 +236,13 @@ impl Selection {
let range_top = match range.start_bound() {
Bound::Included(&range_start) => range_start,
Bound::Excluded(&range_start) => range_start + 1,
- Bound::Unbounded => Line(i32::min_value()),
+ Bound::Unbounded => Line(i32::MIN),
};
let range_bottom = match range.end_bound() {
Bound::Included(&range_end) => range_end,
Bound::Excluded(&range_end) => range_end - 1,
- Bound::Unbounded => Line(i32::max_value()),
+ Bound::Unbounded => Line(i32::MAX),
};
range_bottom >= start && range_top <= end
diff --git a/alacritty_terminal/src/term/color.rs b/alacritty_terminal/src/term/color.rs
index 32c6af2b..a9494e7a 100644
--- a/alacritty_terminal/src/term/color.rs
+++ b/alacritty_terminal/src/term/color.rs
@@ -287,23 +287,21 @@ impl IndexMut<NamedColor> for Colors {
mod tests {
use super::*;
- use std::f64::EPSILON;
-
#[test]
fn contrast() {
let rgb1 = Rgb { r: 0xff, g: 0xff, b: 0xff };
let rgb2 = Rgb { r: 0x00, g: 0x00, b: 0x00 };
- assert!((rgb1.contrast(rgb2) - 21.).abs() < EPSILON);
+ assert!((rgb1.contrast(rgb2) - 21.).abs() < f64::EPSILON);
let rgb1 = Rgb { r: 0xff, g: 0xff, b: 0xff };
- assert!((rgb1.contrast(rgb1) - 1.).abs() < EPSILON);
+ assert!((rgb1.contrast(rgb1) - 1.).abs() < f64::EPSILON);
let rgb1 = Rgb { r: 0xff, g: 0x00, b: 0xff };
let rgb2 = Rgb { r: 0x00, g: 0xff, b: 0x00 };
- assert!((rgb1.contrast(rgb2) - 2.285_543_608_124_253_3).abs() < EPSILON);
+ assert!((rgb1.contrast(rgb2) - 2.285_543_608_124_253_3).abs() < f64::EPSILON);
let rgb1 = Rgb { r: 0x12, g: 0x34, b: 0x56 };
let rgb2 = Rgb { r: 0xfe, g: 0xdc, b: 0xba };
- assert!((rgb1.contrast(rgb2) - 9.786_558_997_257_74).abs() < EPSILON);
+ assert!((rgb1.contrast(rgb2) - 9.786_558_997_257_74).abs() < f64::EPSILON);
}
}
diff --git a/alacritty_terminal/src/tty/mod.rs b/alacritty_terminal/src/tty/mod.rs
index cae6a4b9..c537c8d6 100644
--- a/alacritty_terminal/src/tty/mod.rs
+++ b/alacritty_terminal/src/tty/mod.rs
@@ -39,7 +39,7 @@ pub trait EventedReadWrite {
}
/// Events concerning TTY child processes.
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq, Eq)]
pub enum ChildEvent {
/// Indicates the child has exited.
Exited,