aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--helix-dap/src/transport.rs2
-rw-r--r--helix-dap/src/types.rs100
-rw-r--r--helix-loader/src/grammar.rs4
-rw-r--r--helix-lsp/src/jsonrpc.rs26
-rw-r--r--helix-term/build.rs2
-rw-r--r--helix-term/src/application.rs4
-rw-r--r--helix-term/src/commands.rs15
-rw-r--r--helix-term/src/commands/lsp.rs6
-rw-r--r--helix-term/src/ui/menu.rs2
-rw-r--r--helix-term/src/ui/prompt.rs4
-rw-r--r--helix-tui/src/buffer.rs4
-rw-r--r--helix-tui/src/layout.rs2
-rw-r--r--helix-tui/src/text.rs8
-rw-r--r--helix-tui/src/widgets/block.rs16
-rw-r--r--helix-tui/src/widgets/table.rs6
-rw-r--r--helix-view/src/editor.rs4
-rw-r--r--helix-view/src/graphics.rs8
22 files changed, 113 insertions, 124 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.
diff --git a/helix-dap/src/transport.rs b/helix-dap/src/transport.rs
index 783a6f5d..dd03e568 100644
--- a/helix-dap/src/transport.rs
+++ b/helix-dap/src/transport.rs
@@ -22,7 +22,7 @@ pub struct Request {
pub arguments: Option<Value>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
pub struct Response {
// seq is omitted as unused and is not sent by some implementations
pub request_seq: u64,
diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs
index 51ecfe1b..0a9ebe5e 100644
--- a/helix-dap/src/types.rs
+++ b/helix-dap/src/types.rs
@@ -22,7 +22,7 @@ pub trait Request {
const COMMAND: &'static str;
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ColumnDescriptor {
pub attribute_name: String,
@@ -35,7 +35,7 @@ pub struct ColumnDescriptor {
pub width: Option<usize>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionBreakpointsFilter {
pub filter: String,
@@ -50,7 +50,7 @@ pub struct ExceptionBreakpointsFilter {
pub condition_description: Option<String>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DebuggerCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -131,14 +131,14 @@ pub struct DebuggerCapabilities {
pub supported_checksum_algorithms: Option<Vec<String>>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Checksum {
pub algorithm: String,
pub checksum: String,
}
-#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Source {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -159,7 +159,7 @@ pub struct Source {
pub checksums: Option<Vec<Checksum>>,
}
-#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceBreakpoint {
pub line: usize,
@@ -173,7 +173,7 @@ pub struct SourceBreakpoint {
pub log_message: Option<String>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Breakpoint {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -197,7 +197,7 @@ pub struct Breakpoint {
pub offset: Option<usize>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackFrameFormat {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -216,7 +216,7 @@ pub struct StackFrameFormat {
pub include_all: Option<bool>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackFrame {
pub id: usize,
@@ -239,14 +239,14 @@ pub struct StackFrame {
pub presentation_hint: Option<String>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Thread {
pub id: ThreadId,
pub name: String,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Scope {
pub name: String,
@@ -270,14 +270,14 @@ pub struct Scope {
pub end_column: Option<usize>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ValueFormat {
#[serde(skip_serializing_if = "Option::is_none")]
pub hex: Option<bool>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablePresentationHint {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -288,7 +288,7 @@ pub struct VariablePresentationHint {
pub visibility: Option<String>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Variable {
pub name: String,
@@ -308,7 +308,7 @@ pub struct Variable {
pub memory_reference: Option<String>,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Module {
pub id: String, // TODO: || number
@@ -333,7 +333,7 @@ pub struct Module {
pub mod requests {
use super::*;
- #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct InitializeArguments {
#[serde(rename = "clientID", skip_serializing_if = "Option::is_none")]
@@ -409,7 +409,7 @@ pub mod requests {
const COMMAND: &'static str = "configurationDone";
}
- #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetBreakpointsArguments {
pub source: Source,
@@ -420,7 +420,7 @@ pub mod requests {
pub source_modified: Option<bool>,
}
- #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetBreakpointsResponse {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -436,13 +436,13 @@ pub mod requests {
const COMMAND: &'static str = "setBreakpoints";
}
- #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ContinueArguments {
pub thread_id: ThreadId,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ContinueResponse {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -458,7 +458,7 @@ pub mod requests {
const COMMAND: &'static str = "continue";
}
- #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackTraceArguments {
pub thread_id: ThreadId,
@@ -470,7 +470,7 @@ pub mod requests {
pub format: Option<StackFrameFormat>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackTraceResponse {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -487,7 +487,7 @@ pub mod requests {
const COMMAND: &'static str = "stackTrace";
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ThreadsResponse {
pub threads: Vec<Thread>,
@@ -502,13 +502,13 @@ pub mod requests {
const COMMAND: &'static str = "threads";
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ScopesArguments {
pub frame_id: usize,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ScopesResponse {
pub scopes: Vec<Scope>,
@@ -523,7 +523,7 @@ pub mod requests {
const COMMAND: &'static str = "scopes";
}
- #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablesArguments {
pub variables_reference: usize,
@@ -537,7 +537,7 @@ pub mod requests {
pub format: Option<ValueFormat>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablesResponse {
pub variables: Vec<Variable>,
@@ -552,7 +552,7 @@ pub mod requests {
const COMMAND: &'static str = "variables";
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StepInArguments {
pub thread_id: ThreadId,
@@ -571,7 +571,7 @@ pub mod requests {
const COMMAND: &'static str = "stepIn";
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StepOutArguments {
pub thread_id: ThreadId,
@@ -588,7 +588,7 @@ pub mod requests {
const COMMAND: &'static str = "stepOut";
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct NextArguments {
pub thread_id: ThreadId,
@@ -605,7 +605,7 @@ pub mod requests {
const COMMAND: &'static str = "next";
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PauseArguments {
pub thread_id: ThreadId,
@@ -620,7 +620,7 @@ pub mod requests {
const COMMAND: &'static str = "pause";
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct EvaluateArguments {
pub expression: String,
@@ -632,7 +632,7 @@ pub mod requests {
pub format: Option<ValueFormat>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct EvaluateResponse {
pub result: String,
@@ -658,7 +658,7 @@ pub mod requests {
const COMMAND: &'static str = "evaluate";
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetExceptionBreakpointsArguments {
pub filters: Vec<String>,
@@ -666,7 +666,7 @@ pub mod requests {
// pub exceptionOptions: Option<Vec<ExceptionOptions>>, // needs capability
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetExceptionBreakpointsResponse {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -684,7 +684,7 @@ pub mod requests {
// Reverse Requests
- #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RunInTerminalResponse {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -693,7 +693,7 @@ pub mod requests {
pub shell_process_id: Option<u32>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RunInTerminalArguments {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -745,7 +745,7 @@ pub mod events {
Memory(Memory),
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Stopped {
pub reason: String,
@@ -763,7 +763,7 @@ pub mod events {
pub hit_breakpoint_ids: Option<Vec<usize>>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Continued {
pub thread_id: ThreadId,
@@ -771,27 +771,27 @@ pub mod events {
pub all_threads_continued: Option<bool>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Exited {
pub exit_code: usize,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Terminated {
#[serde(skip_serializing_if = "Option::is_none")]
pub restart: Option<Value>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Thread {
pub reason: String,
pub thread_id: ThreadId,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Output {
pub output: String,
@@ -811,28 +811,28 @@ pub mod events {
pub data: Option<Value>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Breakpoint {
pub reason: String,
pub breakpoint: super::Breakpoint,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Module {
pub reason: String,
pub module: super::Module,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct LoadedSource {
pub reason: String,
pub source: super::Source,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Process {
pub name: String,
@@ -846,13 +846,13 @@ pub mod events {
pub pointer_size: Option<usize>,
}
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Capabilities {
pub capabilities: super::DebuggerCapabilities,
}
- // #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ // #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
// #[serde(rename_all = "camelCase")]
// pub struct Invalidated {
// pub areas: Vec<InvalidatedArea>,
@@ -860,7 +860,7 @@ pub mod events {
// pub stack_frame_id: Option<usize>,
// }
- #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Memory {
pub memory_reference: String,
diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs
index a92cadb6..833616e0 100644
--- a/helix-loader/src/grammar.rs
+++ b/helix-loader/src/grammar.rs
@@ -67,7 +67,7 @@ pub fn get_language(name: &str) -> Result<Language> {
#[cfg(not(target_arch = "wasm32"))]
pub fn get_language(name: &str) -> Result<Language> {
use libloading::{Library, Symbol};
- let mut library_path = crate::runtime_dir().join("grammars").join(&name);
+ let mut library_path = crate::runtime_dir().join("grammars").join(name);
library_path.set_extension(DYLIB_EXTENSION);
let library = unsafe { Library::new(&library_path) }
@@ -429,7 +429,7 @@ fn build_tree_sitter_library(
if cfg!(all(windows, target_env = "msvc")) {
command
- .args(&["/nologo", "/LD", "/I"])
+ .args(["/nologo", "/LD", "/I"])
.arg(header_path)
.arg("/Od")
.arg("/utf-8");
diff --git a/helix-lsp/src/jsonrpc.rs b/helix-lsp/src/jsonrpc.rs
index b9b3fd2c..75ac9309 100644
--- a/helix-lsp/src/jsonrpc.rs
+++ b/helix-lsp/src/jsonrpc.rs
@@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
// https://www.jsonrpc.org/specification#error_object
-#[derive(Debug, PartialEq, Clone)]
+#[derive(Debug, PartialEq, Eq, Clone)]
pub enum ErrorCode {
ParseError,
InvalidRequest,
@@ -68,7 +68,7 @@ impl Serialize for ErrorCode {
}
}
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Error {
pub code: ErrorCode,
pub message: String,
@@ -100,7 +100,7 @@ impl std::error::Error for Error {}
// https://www.jsonrpc.org/specification#request_object
/// Request ID
-#[derive(Debug, PartialEq, Clone, Hash, Eq, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, Serialize)]
#[serde(untagged)]
pub enum Id {
Null,
@@ -109,7 +109,7 @@ pub enum Id {
}
/// Protocol Version
-#[derive(Debug, PartialEq, Clone, Copy, Hash, Eq)]
+#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub enum Version {
V2,
}
@@ -153,7 +153,7 @@ impl<'de> Deserialize<'de> for Version {
}
}
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Params {
None,
@@ -182,7 +182,7 @@ impl From<Params> for Value {
}
}
-#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct MethodCall {
pub jsonrpc: Option<Version>,
@@ -192,7 +192,7 @@ pub struct MethodCall {
pub id: Id,
}
-#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Notification {
pub jsonrpc: Option<Version>,
@@ -201,7 +201,7 @@ pub struct Notification {
pub params: Params,
}
-#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
#[serde(untagged)]
pub enum Call {
@@ -235,7 +235,7 @@ impl From<Notification> for Call {
}
}
-#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
#[serde(untagged)]
pub enum Request {
@@ -245,7 +245,7 @@ pub enum Request {
// https://www.jsonrpc.org/specification#response_object
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Success {
#[serde(skip_serializing_if = "Option::is_none")]
pub jsonrpc: Option<Version>,
@@ -253,7 +253,7 @@ pub struct Success {
pub id: Id,
}
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
pub struct Failure {
#[serde(skip_serializing_if = "Option::is_none")]
pub jsonrpc: Option<Version>,
@@ -264,7 +264,7 @@ pub struct Failure {
// Note that failure comes first because we're not using
// #[serde(deny_unknown_field)]: we want a request that contains
// both `result` and `error` to be a `Failure`.
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(untagged)]
pub enum Output {
Failure(Failure),
@@ -280,7 +280,7 @@ impl From<Output> for Result<Value, Error> {
}
}
-#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum Response {
Single(Output),
diff --git a/helix-term/build.rs b/helix-term/build.rs
index 74c35a3a..719113ff 100644
--- a/helix-term/build.rs
+++ b/helix-term/build.rs
@@ -6,7 +6,7 @@ const VERSION: &str = include_str!("../VERSION");
fn main() {
let git_hash = Command::new("git")
- .args(&["rev-parse", "HEAD"])
+ .args(["rev-parse", "HEAD"])
.output()
.ok()
.filter(|output| output.status.success())
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 173c5d49..e356c1f9 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -168,7 +168,7 @@ impl Application {
} else if !args.files.is_empty() {
let first = &args.files[0].0; // we know it's not empty
if first.is_dir() {
- std::env::set_current_dir(&first).context("set current dir")?;
+ std::env::set_current_dir(first).context("set current dir")?;
editor.new_file(Action::VerticalSplit);
let picker = ui::file_picker(".".into(), &config.load().editor);
compositor.push(Box::new(overlayed(picker)));
@@ -228,7 +228,7 @@ impl Application {
#[cfg(windows)]
let signals = futures_util::stream::empty();
#[cfg(not(windows))]
- let signals = Signals::new(&[signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1])
+ let signals = Signals::new([signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1])
.context("build signal handler")?;
let app = Self {
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index ee9bad98..aae9979d 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3933,15 +3933,12 @@ pub fn completion(cx: &mut Context) {
};
if !prefix.is_empty() {
- items = items
- .into_iter()
- .filter(|item| {
- item.filter_text
- .as_ref()
- .unwrap_or(&item.label)
- .starts_with(&prefix)
- })
- .collect();
+ items.retain(|item| {
+ item.filter_text
+ .as_ref()
+ .unwrap_or(&item.label)
+ .starts_with(&prefix)
+ });
}
if items.is_empty() {
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index d7617c50..5498fc83 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -57,7 +57,7 @@ impl ui::menu::Item for lsp::Location {
// allocation, for `to_file_path`, else there will be two (2), with `to_string_lossy`.
let mut write_path_to_res = || -> Option<()> {
let path = self.uri.to_file_path().ok()?;
- res.push_str(&path.strip_prefix(&cwdir).unwrap_or(&path).to_string_lossy());
+ res.push_str(&path.strip_prefix(cwdir).unwrap_or(&path).to_string_lossy());
Some(())
};
write_path_to_res();
@@ -634,7 +634,7 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
// Create directory if it does not exist
if let Some(dir) = path.parent() {
if !dir.is_dir() {
- fs::create_dir_all(&dir)?;
+ fs::create_dir_all(dir)?;
}
}
@@ -910,7 +910,7 @@ pub fn goto_reference(cx: &mut Context) {
);
}
-#[derive(PartialEq)]
+#[derive(PartialEq, Eq)]
pub enum SignatureHelpInvoked {
Manual,
Automatic,
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index 99c2473d..1baaf40a 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -40,7 +40,7 @@ impl Item for PathBuf {
type Data = PathBuf;
fn label(&self, root_path: &Self::Data) -> Spans {
- self.strip_prefix(&root_path)
+ self.strip_prefix(root_path)
.unwrap_or(self)
.to_string_lossy()
.into()
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index d0991d3c..ca2872a7 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -32,7 +32,7 @@ pub struct Prompt {
next_char_handler: Option<PromptCharHandler>,
}
-#[derive(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq, Eq)]
pub enum PromptEvent {
/// The prompt input has been updated.
Update,
@@ -408,7 +408,7 @@ impl Prompt {
surface.set_stringn(
area.x + col * (1 + col_width),
area.y + row,
- &completion,
+ completion,
col_width.saturating_sub(1) as usize,
color,
);
diff --git a/helix-tui/src/buffer.rs b/helix-tui/src/buffer.rs
index 23ba43f1..5169196a 100644
--- a/helix-tui/src/buffer.rs
+++ b/helix-tui/src/buffer.rs
@@ -6,7 +6,7 @@ use unicode_segmentation::UnicodeSegmentation;
use helix_view::graphics::{Color, Modifier, Rect, Style, UnderlineStyle};
/// A buffer cell
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Cell {
pub symbol: String,
pub fg: Color,
@@ -119,7 +119,7 @@ impl Default for Cell {
/// buf[(5, 0)].set_char('x');
/// assert_eq!(buf[(5, 0)].symbol, "x");
/// ```
-#[derive(Debug, Default, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Buffer {
/// The area represented by this buffer
pub area: Rect,
diff --git a/helix-tui/src/layout.rs b/helix-tui/src/layout.rs
index 7c72a778..1f3ddc6e 100644
--- a/helix-tui/src/layout.rs
+++ b/helix-tui/src/layout.rs
@@ -46,7 +46,7 @@ impl Constraint {
}
}
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Alignment {
Left,
Center,
diff --git a/helix-tui/src/text.rs b/helix-tui/src/text.rs
index 1bfe5ee1..ccdafad5 100644
--- a/helix-tui/src/text.rs
+++ b/helix-tui/src/text.rs
@@ -53,14 +53,14 @@ use std::borrow::Cow;
use unicode_segmentation::UnicodeSegmentation;
/// A grapheme associated to a style.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StyledGrapheme<'a> {
pub symbol: &'a str,
pub style: Style,
}
/// A string where all graphemes have the same style.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Span<'a> {
pub content: Cow<'a, str>,
pub style: Style,
@@ -209,7 +209,7 @@ impl<'a> From<Cow<'a, str>> for Span<'a> {
}
/// A string composed of clusters of graphemes, each with their own style.
-#[derive(Debug, Default, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Spans<'a>(pub Vec<Span<'a>>);
impl<'a> Spans<'a> {
@@ -297,7 +297,7 @@ impl<'a> From<&Spans<'a>> for String {
/// text.extend(Text::styled("Some more lines\nnow with more style!", style));
/// assert_eq!(6, text.height());
/// ```
-#[derive(Debug, Default, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Text<'a> {
pub lines: Vec<Spans<'a>>,
}
diff --git a/helix-tui/src/widgets/block.rs b/helix-tui/src/widgets/block.rs
index bd025a31..98f84abe 100644
--- a/helix-tui/src/widgets/block.rs
+++ b/helix-tui/src/widgets/block.rs
@@ -7,7 +7,7 @@ use crate::{
use helix_view::graphics::{Rect, Style};
/// Border render type. Defaults to [`BorderType::Plain`].
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BorderType {
Plain,
Rounded,
@@ -47,7 +47,7 @@ impl Default for BorderType {
/// .border_type(BorderType::Rounded)
/// .style(Style::default().bg(Color::Black));
/// ```
-#[derive(Debug, Default, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Block<'a> {
/// Optional title place on the upper left of the block
title: Option<Spans<'a>>,
@@ -187,16 +187,8 @@ impl<'a> Widget for Block<'a> {
}
if let Some(title) = self.title {
- let lx = if self.borders.intersects(Borders::LEFT) {
- 1
- } else {
- 0
- };
- let rx = if self.borders.intersects(Borders::RIGHT) {
- 1
- } else {
- 0
- };
+ let lx = u16::from(self.borders.intersects(Borders::LEFT));
+ let rx = u16::from(self.borders.intersects(Borders::RIGHT));
let width = area.width.saturating_sub(lx).saturating_sub(rx);
buf.set_spans(area.left() + lx, area.top(), &title, width);
}
diff --git a/helix-tui/src/widgets/table.rs b/helix-tui/src/widgets/table.rs
index eb03704e..a8f428a7 100644
--- a/helix-tui/src/widgets/table.rs
+++ b/helix-tui/src/widgets/table.rs
@@ -34,7 +34,7 @@ use std::collections::HashMap;
///
/// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling
/// capabilities of [`Text`].
-#[derive(Debug, Clone, PartialEq, Default)]
+#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct Cell<'a> {
pub content: Text<'a>,
style: Style,
@@ -79,7 +79,7 @@ where
/// ```
///
/// By default, a row has a height of 1 but you can change this using [`Row::height`].
-#[derive(Debug, Clone, PartialEq, Default)]
+#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct Row<'a> {
pub cells: Vec<Cell<'a>>,
height: u16,
@@ -179,7 +179,7 @@ impl<'a> Row<'a> {
/// // ...and potentially show a symbol in front of the selection.
/// .highlight_symbol(">>");
/// ```
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Table<'a> {
/// A block to wrap the widget in
block: Option<Block<'a>>,
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index bb9616e8..bcd8dedb 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -111,7 +111,7 @@ impl Default for FilePickerConfig {
}
}
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
pub struct Config {
/// Padding to keep between the edge of the screen and the cursor when scrolling. Defaults to 5.
@@ -346,7 +346,7 @@ pub enum StatusLineElement {
// Cursor shape is read and used on every rendered frame and so needs
// to be fast. Therefore we avoid a hashmap and use an enum indexed array.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CursorShapeConfig([CursorKind; 3]);
impl CursorShapeConfig {
diff --git a/helix-view/src/graphics.rs b/helix-view/src/graphics.rs
index cbae873a..9264c50f 100644
--- a/helix-view/src/graphics.rs
+++ b/helix-view/src/graphics.rs
@@ -5,7 +5,7 @@ use std::{
str::FromStr,
};
-#[derive(Debug, Clone, Copy, PartialEq, Deserialize, Serialize)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
/// UNSTABLE
pub enum CursorKind {
@@ -250,7 +250,7 @@ impl Rect {
}
}
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Color {
Reset,
@@ -303,7 +303,7 @@ impl From<Color> for crossterm::style::Color {
}
}
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum UnderlineStyle {
Reset,
Line,
@@ -449,7 +449,7 @@ impl FromStr for Modifier {
/// buffer[(0, 0)].style(),
/// );
/// ```
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Style {
pub fg: Option<Color>,