summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src
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 /alacritty_terminal/src
parente20541a83e55d5ddd57b1bed0f4666b3c73f680d (diff)
downloadalacritty-56a69c0bfe5742aeda1c4942b748f5a842ce6773.tar.gz
alacritty-56a69c0bfe5742aeda1c4942b748f5a842ce6773.zip
Fix a few minor clippy lints
Diffstat (limited to 'alacritty_terminal/src')
-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
5 files changed, 12 insertions, 14 deletions
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,