aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-11-04 12:01:17 +0000
committerBlaž Hrastnik2022-11-04 12:06:28 +0000
commitc2c1280f02b83a468da67d88350c199915427535 (patch)
treecd4306c1b7353bb960608e18c5633aa22c5d0204 /helix-core
parent921d3510132b0bd89d4ac0a542371c3ae90e2e02 (diff)
Resolve a bunch of upcoming clippy lints
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/history.rs2
-rw-r--r--helix-core/src/increment/number.rs4
-rw-r--r--helix-core/src/line_ending.rs2
-rw-r--r--helix-core/src/surround.rs2
-rw-r--r--helix-core/src/syntax.rs14
5 files changed, 12 insertions, 12 deletions
diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs
index b608097c..5cd72b07 100644
--- a/helix-core/src/history.rs
+++ b/helix-core/src/history.rs
@@ -282,7 +282,7 @@ impl History {
}
/// Whether to undo by a number of edits or a duration of time.
-#[derive(Debug, PartialEq, Clone, Copy)]
+#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum UndoKind {
Steps(usize),
TimePeriod(std::time::Duration),
diff --git a/helix-core/src/increment/number.rs b/helix-core/src/increment/number.rs
index 62b4a19d..91268729 100644
--- a/helix-core/src/increment/number.rs
+++ b/helix-core/src/increment/number.rs
@@ -110,8 +110,8 @@ impl<'a> Increment for NumberIncrementor<'a> {
let (lower_count, upper_count): (usize, usize) =
old_text.chars().skip(2).fold((0, 0), |(lower, upper), c| {
(
- lower + c.is_ascii_lowercase().then(|| 1).unwrap_or(0),
- upper + c.is_ascii_uppercase().then(|| 1).unwrap_or(0),
+ lower + usize::from(c.is_ascii_lowercase()),
+ upper + usize::from(c.is_ascii_uppercase()),
)
});
if upper_count > lower_count {
diff --git a/helix-core/src/line_ending.rs b/helix-core/src/line_ending.rs
index 3e8a6cae..09e92523 100644
--- a/helix-core/src/line_ending.rs
+++ b/helix-core/src/line_ending.rs
@@ -6,7 +6,7 @@ pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::Crlf;
pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::LF;
/// Represents one of the valid Unicode line endings.
-#[derive(PartialEq, Copy, Clone, Debug)]
+#[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum LineEnding {
Crlf, // CarriageReturn followed by LineFeed
LF, // U+000A -- LineFeed
diff --git a/helix-core/src/surround.rs b/helix-core/src/surround.rs
index 6244b380..a3de3cd1 100644
--- a/helix-core/src/surround.rs
+++ b/helix-core/src/surround.rs
@@ -13,7 +13,7 @@ pub const PAIRS: &[(char, char)] = &[
('(', ')'),
];
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq, Eq)]
pub enum Error {
PairNotFound,
CursorOverlap,
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index c17655a9..0f62577f 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -218,7 +218,7 @@ pub struct FormatterConfiguration {
pub args: Vec<String>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct AdvancedCompletion {
pub name: Option<String>,
@@ -226,14 +226,14 @@ pub struct AdvancedCompletion {
pub default: Option<String>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case", untagged)]
pub enum DebugConfigCompletion {
Named(String),
Advanced(AdvancedCompletion),
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(untagged)]
pub enum DebugArgumentValue {
String(String),
@@ -241,7 +241,7 @@ pub enum DebugArgumentValue {
Boolean(bool),
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct DebugTemplate {
pub name: String,
@@ -250,7 +250,7 @@ pub struct DebugTemplate {
pub args: HashMap<String, DebugArgumentValue>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct DebugAdapterConfig {
pub name: String,
@@ -266,7 +266,7 @@ pub struct DebugAdapterConfig {
}
// Different workarounds for adapters' differences
-#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
+#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct DebuggerQuirks {
#[serde(default)]
pub absolute_paths: bool,
@@ -280,7 +280,7 @@ pub struct IndentationConfiguration {
}
/// Configuration for auto pairs
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case", deny_unknown_fields, untagged)]
pub enum AutoPairConfig {
/// Enables or disables auto pairing. False means disabled. True means to use the default pairs.