on master help sign in
Resolve a bunch of upcoming clippy lints
c2c1280Blaž Hrastnik
helix-core/src/history.rs+1−1
@@ -282,7 +282,7 @@ impl History {
282}
282}
283
283
284/// Whether to undo by a number of edits or a duration of time.
284/// Whether to undo by a number of edits or a duration of time.
285−#[derive(Debug, PartialEq, Clone, Copy)]
285+#[derive(Debug, PartialEq, Eq, Clone, Copy)]
286pub enum UndoKind {
286pub enum UndoKind {
287 Steps(usize),
287 Steps(usize),
288 TimePeriod(std::time::Duration),
288 TimePeriod(std::time::Duration),
helix-core/src/increment/number.rs+2−2
@@ -110,8 +110,8 @@ impl<'a> Increment for NumberIncrementor<'a> {
110 let (lower_count, upper_count): (usize, usize) =
110 let (lower_count, upper_count): (usize, usize) =
111 old_text.chars().skip(2).fold((0, 0), |(lower, upper), c| {
111 old_text.chars().skip(2).fold((0, 0), |(lower, upper), c| {
112 (
112 (
113− lower + c.is_ascii_lowercase().then(|| 1).unwrap_or(0),
113+ lower + usize::from(c.is_ascii_lowercase()),
114− upper + c.is_ascii_uppercase().then(|| 1).unwrap_or(0),
114+ upper + usize::from(c.is_ascii_uppercase()),
115 )
115 )
116 });
116 });
117 if upper_count > lower_count {
117 if upper_count > lower_count {
helix-core/src/line_ending.rs+1−1
@@ -6,7 +6,7 @@ pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::Crlf;
6pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::LF;
6pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::LF;
7
7
8/// Represents one of the valid Unicode line endings.
8/// Represents one of the valid Unicode line endings.
9−#[derive(PartialEq, Copy, Clone, Debug)]
9+#[derive(PartialEq, Eq, Copy, Clone, Debug)]
10pub enum LineEnding {
10pub enum LineEnding {
11 Crlf, // CarriageReturn followed by LineFeed
11 Crlf, // CarriageReturn followed by LineFeed
12 LF, // U+000A -- LineFeed
12 LF, // U+000A -- LineFeed
helix-core/src/surround.rs+1−1
@@ -13,7 +13,7 @@ pub const PAIRS: &[(char, char)] = &[
13 ('(', ')'),
13 ('(', ')'),
14];
14];
15
15
16−#[derive(Debug, PartialEq)]
16+#[derive(Debug, PartialEq, Eq)]
17pub enum Error {
17pub enum Error {
18 PairNotFound,
18 PairNotFound,
19 CursorOverlap,
19 CursorOverlap,
helix-core/src/syntax.rs+7−7
@@ -218,7 +218,7 @@ pub struct FormatterConfiguration {
218 pub args: Vec<String>,
218 pub args: Vec<String>,
219}
219}
220
220
221−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
221+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
222#[serde(rename_all = "kebab-case")]
222#[serde(rename_all = "kebab-case")]
223pub struct AdvancedCompletion {
223pub struct AdvancedCompletion {
224 pub name: Option<String>,
224 pub name: Option<String>,
@@ -226,14 +226,14 @@ pub struct AdvancedCompletion {
226 pub default: Option<String>,
226 pub default: Option<String>,
227}
227}
228
228
229−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
229+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
230#[serde(rename_all = "kebab-case", untagged)]
230#[serde(rename_all = "kebab-case", untagged)]
231pub enum DebugConfigCompletion {
231pub enum DebugConfigCompletion {
232 Named(String),
232 Named(String),
233 Advanced(AdvancedCompletion),
233 Advanced(AdvancedCompletion),
234}
234}
235
235
236−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
236+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
237#[serde(untagged)]
237#[serde(untagged)]
238pub enum DebugArgumentValue {
238pub enum DebugArgumentValue {
239 String(String),
239 String(String),
@@ -241,7 +241,7 @@ pub enum DebugArgumentValue {
241 Boolean(bool),
241 Boolean(bool),
242}
242}
243
243
244−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
244+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
245#[serde(rename_all = "kebab-case")]
245#[serde(rename_all = "kebab-case")]
246pub struct DebugTemplate {
246pub struct DebugTemplate {
247 pub name: String,
247 pub name: String,
@@ -250,7 +250,7 @@ pub struct DebugTemplate {
250 pub args: HashMap<String, DebugArgumentValue>,
250 pub args: HashMap<String, DebugArgumentValue>,
251}
251}
252
252
253−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
253+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
254#[serde(rename_all = "kebab-case")]
254#[serde(rename_all = "kebab-case")]
255pub struct DebugAdapterConfig {
255pub struct DebugAdapterConfig {
256 pub name: String,
256 pub name: String,
@@ -266,7 +266,7 @@ pub struct DebugAdapterConfig {
266}
266}
267
267
268// Different workarounds for adapters' differences
268// Different workarounds for adapters' differences
269−#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
269+#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)]
270pub struct DebuggerQuirks {
270pub struct DebuggerQuirks {
271 #[serde(default)]
271 #[serde(default)]
272 pub absolute_paths: bool,
272 pub absolute_paths: bool,
@@ -280,7 +280,7 @@ pub struct IndentationConfiguration {
280}
280}
281
281
282/// Configuration for auto pairs
282/// Configuration for auto pairs
283−#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
283+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
284#[serde(rename_all = "kebab-case", deny_unknown_fields, untagged)]
284#[serde(rename_all = "kebab-case", deny_unknown_fields, untagged)]
285pub enum AutoPairConfig {
285pub enum AutoPairConfig {
286 /// Enables or disables auto pairing. False means disabled. True means to use the default pairs.
286 /// Enables or disables auto pairing. False means disabled. True means to use the default pairs.
helix-dap/src/transport.rs+1−1
@@ -22,7 +22,7 @@ pub struct Request {
22 pub arguments: Option<Value>,
22 pub arguments: Option<Value>,
23}
23}
24
24
25−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
25+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
26pub struct Response {
26pub struct Response {
27 // seq is omitted as unused and is not sent by some implementations
27 // seq is omitted as unused and is not sent by some implementations
28 pub request_seq: u64,
28 pub request_seq: u64,
helix-dap/src/types.rs+50−50
@@ -22,7 +22,7 @@ pub trait Request {
22 const COMMAND: &'static str;
22 const COMMAND: &'static str;
23}
23}
24
24
25−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
25+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
26#[serde(rename_all = "camelCase")]
26#[serde(rename_all = "camelCase")]
27pub struct ColumnDescriptor {
27pub struct ColumnDescriptor {
28 pub attribute_name: String,
28 pub attribute_name: String,
@@ -35,7 +35,7 @@ pub struct ColumnDescriptor {
35 pub width: Option<usize>,
35 pub width: Option<usize>,
36}
36}
37
37
38−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
38+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
39#[serde(rename_all = "camelCase")]
39#[serde(rename_all = "camelCase")]
40pub struct ExceptionBreakpointsFilter {
40pub struct ExceptionBreakpointsFilter {
41 pub filter: String,
41 pub filter: String,
@@ -50,7 +50,7 @@ pub struct ExceptionBreakpointsFilter {
50 pub condition_description: Option<String>,
50 pub condition_description: Option<String>,
51}
51}
52
52
53−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
53+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
54#[serde(rename_all = "camelCase")]
54#[serde(rename_all = "camelCase")]
55pub struct DebuggerCapabilities {
55pub struct DebuggerCapabilities {
56 #[serde(skip_serializing_if = "Option::is_none")]
56 #[serde(skip_serializing_if = "Option::is_none")]
@@ -131,14 +131,14 @@ pub struct DebuggerCapabilities {
131 pub supported_checksum_algorithms: Option<Vec<String>>,
131 pub supported_checksum_algorithms: Option<Vec<String>>,
132}
132}
133
133
134−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
134+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
135#[serde(rename_all = "camelCase")]
135#[serde(rename_all = "camelCase")]
136pub struct Checksum {
136pub struct Checksum {
137 pub algorithm: String,
137 pub algorithm: String,
138 pub checksum: String,
138 pub checksum: String,
139}
139}
140
140
141−#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
141+#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
142#[serde(rename_all = "camelCase")]
142#[serde(rename_all = "camelCase")]
143pub struct Source {
143pub struct Source {
144 #[serde(skip_serializing_if = "Option::is_none")]
144 #[serde(skip_serializing_if = "Option::is_none")]
@@ -159,7 +159,7 @@ pub struct Source {
159 pub checksums: Option<Vec<Checksum>>,
159 pub checksums: Option<Vec<Checksum>>,
160}
160}
161
161
162−#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
162+#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
163#[serde(rename_all = "camelCase")]
163#[serde(rename_all = "camelCase")]
164pub struct SourceBreakpoint {
164pub struct SourceBreakpoint {
165 pub line: usize,
165 pub line: usize,
@@ -173,7 +173,7 @@ pub struct SourceBreakpoint {
173 pub log_message: Option<String>,
173 pub log_message: Option<String>,
174}
174}
175
175
176−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
176+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
177#[serde(rename_all = "camelCase")]
177#[serde(rename_all = "camelCase")]
178pub struct Breakpoint {
178pub struct Breakpoint {
179 #[serde(skip_serializing_if = "Option::is_none")]
179 #[serde(skip_serializing_if = "Option::is_none")]
@@ -197,7 +197,7 @@ pub struct Breakpoint {
197 pub offset: Option<usize>,
197 pub offset: Option<usize>,
198}
198}
199
199
200−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
200+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
201#[serde(rename_all = "camelCase")]
201#[serde(rename_all = "camelCase")]
202pub struct StackFrameFormat {
202pub struct StackFrameFormat {
203 #[serde(skip_serializing_if = "Option::is_none")]
203 #[serde(skip_serializing_if = "Option::is_none")]
@@ -216,7 +216,7 @@ pub struct StackFrameFormat {
216 pub include_all: Option<bool>,
216 pub include_all: Option<bool>,
217}
217}
218
218
219−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
219+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
220#[serde(rename_all = "camelCase")]
220#[serde(rename_all = "camelCase")]
221pub struct StackFrame {
221pub struct StackFrame {
222 pub id: usize,
222 pub id: usize,
@@ -239,14 +239,14 @@ pub struct StackFrame {
239 pub presentation_hint: Option<String>,
239 pub presentation_hint: Option<String>,
240}
240}
241
241
242−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
242+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
243#[serde(rename_all = "camelCase")]
243#[serde(rename_all = "camelCase")]
244pub struct Thread {
244pub struct Thread {
245 pub id: ThreadId,
245 pub id: ThreadId,
246 pub name: String,
246 pub name: String,
247}
247}
248
248
249−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
249+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
250#[serde(rename_all = "camelCase")]
250#[serde(rename_all = "camelCase")]
251pub struct Scope {
251pub struct Scope {
252 pub name: String,
252 pub name: String,
@@ -270,14 +270,14 @@ pub struct Scope {
270 pub end_column: Option<usize>,
270 pub end_column: Option<usize>,
271}
271}
272
272
273−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
273+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
274#[serde(rename_all = "camelCase")]
274#[serde(rename_all = "camelCase")]
275pub struct ValueFormat {
275pub struct ValueFormat {
276 #[serde(skip_serializing_if = "Option::is_none")]
276 #[serde(skip_serializing_if = "Option::is_none")]
277 pub hex: Option<bool>,
277 pub hex: Option<bool>,
278}
278}
279
279
280−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
280+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
281#[serde(rename_all = "camelCase")]
281#[serde(rename_all = "camelCase")]
282pub struct VariablePresentationHint {
282pub struct VariablePresentationHint {
283 #[serde(skip_serializing_if = "Option::is_none")]
283 #[serde(skip_serializing_if = "Option::is_none")]
@@ -288,7 +288,7 @@ pub struct VariablePresentationHint {
288 pub visibility: Option<String>,
288 pub visibility: Option<String>,
289}
289}
290
290
291−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
291+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
292#[serde(rename_all = "camelCase")]
292#[serde(rename_all = "camelCase")]
293pub struct Variable {
293pub struct Variable {
294 pub name: String,
294 pub name: String,
@@ -308,7 +308,7 @@ pub struct Variable {
308 pub memory_reference: Option<String>,
308 pub memory_reference: Option<String>,
309}
309}
310
310
311−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
311+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
312#[serde(rename_all = "camelCase")]
312#[serde(rename_all = "camelCase")]
313pub struct Module {
313pub struct Module {
314 pub id: String, // TODO: || number
314 pub id: String, // TODO: || number
@@ -333,7 +333,7 @@ pub struct Module {
333
333
334pub mod requests {
334pub mod requests {
335 use super::*;
335 use super::*;
336− #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
336+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
337 #[serde(rename_all = "camelCase")]
337 #[serde(rename_all = "camelCase")]
338 pub struct InitializeArguments {
338 pub struct InitializeArguments {
339 #[serde(rename = "clientID", skip_serializing_if = "Option::is_none")]
339 #[serde(rename = "clientID", skip_serializing_if = "Option::is_none")]
@@ -409,7 +409,7 @@ pub mod requests {
409 const COMMAND: &'static str = "configurationDone";
409 const COMMAND: &'static str = "configurationDone";
410 }
410 }
411
411
412− #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
412+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
413 #[serde(rename_all = "camelCase")]
413 #[serde(rename_all = "camelCase")]
414 pub struct SetBreakpointsArguments {
414 pub struct SetBreakpointsArguments {
415 pub source: Source,
415 pub source: Source,
@@ -420,7 +420,7 @@ pub mod requests {
420 pub source_modified: Option<bool>,
420 pub source_modified: Option<bool>,
421 }
421 }
422
422
423− #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
423+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
424 #[serde(rename_all = "camelCase")]
424 #[serde(rename_all = "camelCase")]
425 pub struct SetBreakpointsResponse {
425 pub struct SetBreakpointsResponse {
426 #[serde(skip_serializing_if = "Option::is_none")]
426 #[serde(skip_serializing_if = "Option::is_none")]
@@ -436,13 +436,13 @@ pub mod requests {
436 const COMMAND: &'static str = "setBreakpoints";
436 const COMMAND: &'static str = "setBreakpoints";
437 }
437 }
438
438
439− #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
439+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
440 #[serde(rename_all = "camelCase")]
440 #[serde(rename_all = "camelCase")]
441 pub struct ContinueArguments {
441 pub struct ContinueArguments {
442 pub thread_id: ThreadId,
442 pub thread_id: ThreadId,
443 }
443 }
444
444
445− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
445+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
446 #[serde(rename_all = "camelCase")]
446 #[serde(rename_all = "camelCase")]
447 pub struct ContinueResponse {
447 pub struct ContinueResponse {
448 #[serde(skip_serializing_if = "Option::is_none")]
448 #[serde(skip_serializing_if = "Option::is_none")]
@@ -458,7 +458,7 @@ pub mod requests {
458 const COMMAND: &'static str = "continue";
458 const COMMAND: &'static str = "continue";
459 }
459 }
460
460
461− #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
461+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
462 #[serde(rename_all = "camelCase")]
462 #[serde(rename_all = "camelCase")]
463 pub struct StackTraceArguments {
463 pub struct StackTraceArguments {
464 pub thread_id: ThreadId,
464 pub thread_id: ThreadId,
@@ -470,7 +470,7 @@ pub mod requests {
470 pub format: Option<StackFrameFormat>,
470 pub format: Option<StackFrameFormat>,
471 }
471 }
472
472
473− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
473+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
474 #[serde(rename_all = "camelCase")]
474 #[serde(rename_all = "camelCase")]
475 pub struct StackTraceResponse {
475 pub struct StackTraceResponse {
476 #[serde(skip_serializing_if = "Option::is_none")]
476 #[serde(skip_serializing_if = "Option::is_none")]
@@ -487,7 +487,7 @@ pub mod requests {
487 const COMMAND: &'static str = "stackTrace";
487 const COMMAND: &'static str = "stackTrace";
488 }
488 }
489
489
490− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
490+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
491 #[serde(rename_all = "camelCase")]
491 #[serde(rename_all = "camelCase")]
492 pub struct ThreadsResponse {
492 pub struct ThreadsResponse {
493 pub threads: Vec<Thread>,
493 pub threads: Vec<Thread>,
@@ -502,13 +502,13 @@ pub mod requests {
502 const COMMAND: &'static str = "threads";
502 const COMMAND: &'static str = "threads";
503 }
503 }
504
504
505− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
505+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
506 #[serde(rename_all = "camelCase")]
506 #[serde(rename_all = "camelCase")]
507 pub struct ScopesArguments {
507 pub struct ScopesArguments {
508 pub frame_id: usize,
508 pub frame_id: usize,
509 }
509 }
510
510
511− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
511+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
512 #[serde(rename_all = "camelCase")]
512 #[serde(rename_all = "camelCase")]
513 pub struct ScopesResponse {
513 pub struct ScopesResponse {
514 pub scopes: Vec<Scope>,
514 pub scopes: Vec<Scope>,
@@ -523,7 +523,7 @@ pub mod requests {
523 const COMMAND: &'static str = "scopes";
523 const COMMAND: &'static str = "scopes";
524 }
524 }
525
525
526− #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
526+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
527 #[serde(rename_all = "camelCase")]
527 #[serde(rename_all = "camelCase")]
528 pub struct VariablesArguments {
528 pub struct VariablesArguments {
529 pub variables_reference: usize,
529 pub variables_reference: usize,
@@ -537,7 +537,7 @@ pub mod requests {
537 pub format: Option<ValueFormat>,
537 pub format: Option<ValueFormat>,
538 }
538 }
539
539
540− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
540+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
541 #[serde(rename_all = "camelCase")]
541 #[serde(rename_all = "camelCase")]
542 pub struct VariablesResponse {
542 pub struct VariablesResponse {
543 pub variables: Vec<Variable>,
543 pub variables: Vec<Variable>,
@@ -552,7 +552,7 @@ pub mod requests {
552 const COMMAND: &'static str = "variables";
552 const COMMAND: &'static str = "variables";
553 }
553 }
554
554
555− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
555+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
556 #[serde(rename_all = "camelCase")]
556 #[serde(rename_all = "camelCase")]
557 pub struct StepInArguments {
557 pub struct StepInArguments {
558 pub thread_id: ThreadId,
558 pub thread_id: ThreadId,
@@ -571,7 +571,7 @@ pub mod requests {
571 const COMMAND: &'static str = "stepIn";
571 const COMMAND: &'static str = "stepIn";
572 }
572 }
573
573
574− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
574+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
575 #[serde(rename_all = "camelCase")]
575 #[serde(rename_all = "camelCase")]
576 pub struct StepOutArguments {
576 pub struct StepOutArguments {
577 pub thread_id: ThreadId,
577 pub thread_id: ThreadId,
@@ -588,7 +588,7 @@ pub mod requests {
588 const COMMAND: &'static str = "stepOut";
588 const COMMAND: &'static str = "stepOut";
589 }
589 }
590
590
591− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
591+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
592 #[serde(rename_all = "camelCase")]
592 #[serde(rename_all = "camelCase")]
593 pub struct NextArguments {
593 pub struct NextArguments {
594 pub thread_id: ThreadId,
594 pub thread_id: ThreadId,
@@ -605,7 +605,7 @@ pub mod requests {
605 const COMMAND: &'static str = "next";
605 const COMMAND: &'static str = "next";
606 }
606 }
607
607
608− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
608+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
609 #[serde(rename_all = "camelCase")]
609 #[serde(rename_all = "camelCase")]
610 pub struct PauseArguments {
610 pub struct PauseArguments {
611 pub thread_id: ThreadId,
611 pub thread_id: ThreadId,
@@ -620,7 +620,7 @@ pub mod requests {
620 const COMMAND: &'static str = "pause";
620 const COMMAND: &'static str = "pause";
621 }
621 }
622
622
623− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
623+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
624 #[serde(rename_all = "camelCase")]
624 #[serde(rename_all = "camelCase")]
625 pub struct EvaluateArguments {
625 pub struct EvaluateArguments {
626 pub expression: String,
626 pub expression: String,
@@ -632,7 +632,7 @@ pub mod requests {
632 pub format: Option<ValueFormat>,
632 pub format: Option<ValueFormat>,
633 }
633 }
634
634
635− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
635+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
636 #[serde(rename_all = "camelCase")]
636 #[serde(rename_all = "camelCase")]
637 pub struct EvaluateResponse {
637 pub struct EvaluateResponse {
638 pub result: String,
638 pub result: String,
@@ -658,7 +658,7 @@ pub mod requests {
658 const COMMAND: &'static str = "evaluate";
658 const COMMAND: &'static str = "evaluate";
659 }
659 }
660
660
661− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
661+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
662 #[serde(rename_all = "camelCase")]
662 #[serde(rename_all = "camelCase")]
663 pub struct SetExceptionBreakpointsArguments {
663 pub struct SetExceptionBreakpointsArguments {
664 pub filters: Vec<String>,
664 pub filters: Vec<String>,
@@ -666,7 +666,7 @@ pub mod requests {
666 // pub exceptionOptions: Option<Vec<ExceptionOptions>>, // needs capability
666 // pub exceptionOptions: Option<Vec<ExceptionOptions>>, // needs capability
667 }
667 }
668
668
669− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
669+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
670 #[serde(rename_all = "camelCase")]
670 #[serde(rename_all = "camelCase")]
671 pub struct SetExceptionBreakpointsResponse {
671 pub struct SetExceptionBreakpointsResponse {
672 #[serde(skip_serializing_if = "Option::is_none")]
672 #[serde(skip_serializing_if = "Option::is_none")]
@@ -684,7 +684,7 @@ pub mod requests {
684
684
685 // Reverse Requests
685 // Reverse Requests
686
686
687− #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
687+ #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
688 #[serde(rename_all = "camelCase")]
688 #[serde(rename_all = "camelCase")]
689 pub struct RunInTerminalResponse {
689 pub struct RunInTerminalResponse {
690 #[serde(skip_serializing_if = "Option::is_none")]
690 #[serde(skip_serializing_if = "Option::is_none")]
@@ -693,7 +693,7 @@ pub mod requests {
693 pub shell_process_id: Option<u32>,
693 pub shell_process_id: Option<u32>,
694 }
694 }
695
695
696− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
696+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
697 #[serde(rename_all = "camelCase")]
697 #[serde(rename_all = "camelCase")]
698 pub struct RunInTerminalArguments {
698 pub struct RunInTerminalArguments {
699 #[serde(skip_serializing_if = "Option::is_none")]
699 #[serde(skip_serializing_if = "Option::is_none")]
@@ -745,7 +745,7 @@ pub mod events {
745 Memory(Memory),
745 Memory(Memory),
746 }
746 }
747
747
748− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
748+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
749 #[serde(rename_all = "camelCase")]
749 #[serde(rename_all = "camelCase")]
750 pub struct Stopped {
750 pub struct Stopped {
751 pub reason: String,
751 pub reason: String,
@@ -763,7 +763,7 @@ pub mod events {
763 pub hit_breakpoint_ids: Option<Vec<usize>>,
763 pub hit_breakpoint_ids: Option<Vec<usize>>,
764 }
764 }
765
765
766− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
766+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
767 #[serde(rename_all = "camelCase")]
767 #[serde(rename_all = "camelCase")]
768 pub struct Continued {
768 pub struct Continued {
769 pub thread_id: ThreadId,
769 pub thread_id: ThreadId,
@@ -771,27 +771,27 @@ pub mod events {
771 pub all_threads_continued: Option<bool>,
771 pub all_threads_continued: Option<bool>,
772 }
772 }
773
773
774− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
774+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
775 #[serde(rename_all = "camelCase")]
775 #[serde(rename_all = "camelCase")]
776 pub struct Exited {
776 pub struct Exited {
777 pub exit_code: usize,
777 pub exit_code: usize,
778 }
778 }
779
779
780− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
780+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
781 #[serde(rename_all = "camelCase")]
781 #[serde(rename_all = "camelCase")]
782 pub struct Terminated {
782 pub struct Terminated {
783 #[serde(skip_serializing_if = "Option::is_none")]
783 #[serde(skip_serializing_if = "Option::is_none")]
784 pub restart: Option<Value>,
784 pub restart: Option<Value>,
785 }
785 }
786
786
787− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
787+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
788 #[serde(rename_all = "camelCase")]
788 #[serde(rename_all = "camelCase")]
789 pub struct Thread {
789 pub struct Thread {
790 pub reason: String,
790 pub reason: String,
791 pub thread_id: ThreadId,
791 pub thread_id: ThreadId,
792 }
792 }
793
793
794− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
794+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
795 #[serde(rename_all = "camelCase")]
795 #[serde(rename_all = "camelCase")]
796 pub struct Output {
796 pub struct Output {
797 pub output: String,
797 pub output: String,
@@ -811,28 +811,28 @@ pub mod events {
811 pub data: Option<Value>,
811 pub data: Option<Value>,
812 }
812 }
813
813
814− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
814+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
815 #[serde(rename_all = "camelCase")]
815 #[serde(rename_all = "camelCase")]
816 pub struct Breakpoint {
816 pub struct Breakpoint {
817 pub reason: String,
817 pub reason: String,
818 pub breakpoint: super::Breakpoint,
818 pub breakpoint: super::Breakpoint,
819 }
819 }
820
820
821− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
821+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
822 #[serde(rename_all = "camelCase")]
822 #[serde(rename_all = "camelCase")]
823 pub struct Module {
823 pub struct Module {
824 pub reason: String,
824 pub reason: String,
825 pub module: super::Module,
825 pub module: super::Module,
826 }
826 }
827
827
828− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
828+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
829 #[serde(rename_all = "camelCase")]
829 #[serde(rename_all = "camelCase")]
830 pub struct LoadedSource {
830 pub struct LoadedSource {
831 pub reason: String,
831 pub reason: String,
832 pub source: super::Source,
832 pub source: super::Source,
833 }
833 }
834
834
835− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
835+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
836 #[serde(rename_all = "camelCase")]
836 #[serde(rename_all = "camelCase")]
837 pub struct Process {
837 pub struct Process {
838 pub name: String,
838 pub name: String,
@@ -846,13 +846,13 @@ pub mod events {
846 pub pointer_size: Option<usize>,
846 pub pointer_size: Option<usize>,
847 }
847 }
848
848
849− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
849+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
850 #[serde(rename_all = "camelCase")]
850 #[serde(rename_all = "camelCase")]
851 pub struct Capabilities {
851 pub struct Capabilities {
852 pub capabilities: super::DebuggerCapabilities,
852 pub capabilities: super::DebuggerCapabilities,
853 }
853 }
854
854
855− // #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
855+ // #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
856 // #[serde(rename_all = "camelCase")]
856 // #[serde(rename_all = "camelCase")]
857 // pub struct Invalidated {
857 // pub struct Invalidated {
858 // pub areas: Vec<InvalidatedArea>,
858 // pub areas: Vec<InvalidatedArea>,
@@ -860,7 +860,7 @@ pub mod events {
860 // pub stack_frame_id: Option<usize>,
860 // pub stack_frame_id: Option<usize>,
861 // }
861 // }
862
862
863− #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
863+ #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
864 #[serde(rename_all = "camelCase")]
864 #[serde(rename_all = "camelCase")]
865 pub struct Memory {
865 pub struct Memory {
866 pub memory_reference: String,
866 pub memory_reference: String,
helix-loader/src/grammar.rs+2−2
@@ -67,7 +67,7 @@ pub fn get_language(name: &str) -> Result<Language> {
67#[cfg(not(target_arch = "wasm32"))]
67#[cfg(not(target_arch = "wasm32"))]
68pub fn get_language(name: &str) -> Result<Language> {
68pub fn get_language(name: &str) -> Result<Language> {
69 use libloading::{Library, Symbol};
69 use libloading::{Library, Symbol};
70− let mut library_path = crate::runtime_dir().join("grammars").join(&name);
70+ let mut library_path = crate::runtime_dir().join("grammars").join(name);
71 library_path.set_extension(DYLIB_EXTENSION);
71 library_path.set_extension(DYLIB_EXTENSION);
72
72
73 let library = unsafe { Library::new(&library_path) }
73 let library = unsafe { Library::new(&library_path) }
@@ -429,7 +429,7 @@ fn build_tree_sitter_library(
429
429
430 if cfg!(all(windows, target_env = "msvc")) {
430 if cfg!(all(windows, target_env = "msvc")) {
431 command
431 command
432− .args(&["/nologo", "/LD", "/I"])
432+ .args(["/nologo", "/LD", "/I"])
433 .arg(header_path)
433 .arg(header_path)
434 .arg("/Od")
434 .arg("/Od")
435 .arg("/utf-8");
435 .arg("/utf-8");
helix-lsp/src/jsonrpc.rs+13−13
@@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
13use serde_json::Value;
13use serde_json::Value;
14
14
15// https://www.jsonrpc.org/specification#error_object
15// https://www.jsonrpc.org/specification#error_object
16−#[derive(Debug, PartialEq, Clone)]
16+#[derive(Debug, PartialEq, Eq, Clone)]
17pub enum ErrorCode {
17pub enum ErrorCode {
18 ParseError,
18 ParseError,
19 InvalidRequest,
19 InvalidRequest,
@@ -68,7 +68,7 @@ impl Serialize for ErrorCode {
68 }
68 }
69}
69}
70
70
71−#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
71+#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
72pub struct Error {
72pub struct Error {
73 pub code: ErrorCode,
73 pub code: ErrorCode,
74 pub message: String,
74 pub message: String,
@@ -100,7 +100,7 @@ impl std::error::Error for Error {}
100// https://www.jsonrpc.org/specification#request_object
100// https://www.jsonrpc.org/specification#request_object
101
101
102/// Request ID
102/// Request ID
103−#[derive(Debug, PartialEq, Clone, Hash, Eq, Deserialize, Serialize)]
103+#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, Serialize)]
104#[serde(untagged)]
104#[serde(untagged)]
105pub enum Id {
105pub enum Id {
106 Null,
106 Null,
@@ -109,7 +109,7 @@ pub enum Id {
109}
109}
110
110
111/// Protocol Version
111/// Protocol Version
112−#[derive(Debug, PartialEq, Clone, Copy, Hash, Eq)]
112+#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
113pub enum Version {
113pub enum Version {
114 V2,
114 V2,
115}
115}
@@ -153,7 +153,7 @@ impl<'de> Deserialize<'de> for Version {
153 }
153 }
154}
154}
155
155
156−#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
156+#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
157#[serde(untagged)]
157#[serde(untagged)]
158pub enum Params {
158pub enum Params {
159 None,
159 None,
@@ -182,7 +182,7 @@ impl From<Params> for Value {
182 }
182 }
183}
183}
184
184
185−#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
185+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
186#[serde(deny_unknown_fields)]
186#[serde(deny_unknown_fields)]
187pub struct MethodCall {
187pub struct MethodCall {
188 pub jsonrpc: Option<Version>,
188 pub jsonrpc: Option<Version>,
@@ -192,7 +192,7 @@ pub struct MethodCall {
192 pub id: Id,
192 pub id: Id,
193}
193}
194
194
195−#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
195+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
196#[serde(deny_unknown_fields)]
196#[serde(deny_unknown_fields)]
197pub struct Notification {
197pub struct Notification {
198 pub jsonrpc: Option<Version>,
198 pub jsonrpc: Option<Version>,
@@ -201,7 +201,7 @@ pub struct Notification {
201 pub params: Params,
201 pub params: Params,
202}
202}
203
203
204−#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
204+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
205#[serde(deny_unknown_fields)]
205#[serde(deny_unknown_fields)]
206#[serde(untagged)]
206#[serde(untagged)]
207pub enum Call {
207pub enum Call {
@@ -235,7 +235,7 @@ impl From<Notification> for Call {
235 }
235 }
236}
236}
237
237
238−#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
238+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
239#[serde(deny_unknown_fields)]
239#[serde(deny_unknown_fields)]
240#[serde(untagged)]
240#[serde(untagged)]
241pub enum Request {
241pub enum Request {
@@ -245,7 +245,7 @@ pub enum Request {
245
245
246// https://www.jsonrpc.org/specification#response_object
246// https://www.jsonrpc.org/specification#response_object
247
247
248−#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
248+#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
249pub struct Success {
249pub struct Success {
250 #[serde(skip_serializing_if = "Option::is_none")]
250 #[serde(skip_serializing_if = "Option::is_none")]
251 pub jsonrpc: Option<Version>,
251 pub jsonrpc: Option<Version>,
@@ -253,7 +253,7 @@ pub struct Success {
253 pub id: Id,
253 pub id: Id,
254}
254}
255
255
256−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
256+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
257pub struct Failure {
257pub struct Failure {
258 #[serde(skip_serializing_if = "Option::is_none")]
258 #[serde(skip_serializing_if = "Option::is_none")]
259 pub jsonrpc: Option<Version>,
259 pub jsonrpc: Option<Version>,
@@ -264,7 +264,7 @@ pub struct Failure {
264// Note that failure comes first because we're not using
264// Note that failure comes first because we're not using
265// #[serde(deny_unknown_field)]: we want a request that contains
265// #[serde(deny_unknown_field)]: we want a request that contains
266// both `result` and `error` to be a `Failure`.
266// both `result` and `error` to be a `Failure`.
267−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
267+#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
268#[serde(untagged)]
268#[serde(untagged)]
269pub enum Output {
269pub enum Output {
270 Failure(Failure),
270 Failure(Failure),
@@ -280,7 +280,7 @@ impl From<Output> for Result<Value, Error> {
280 }
280 }
281}
281}
282
282
283−#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
283+#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
284#[serde(untagged)]
284#[serde(untagged)]
285pub enum Response {
285pub enum Response {
286 Single(Output),
286 Single(Output),
helix-term/build.rs+1−1
@@ -6,7 +6,7 @@ const VERSION: &str = include_str!("../VERSION");
6
6
7fn main() {
7fn main() {
8 let git_hash = Command::new("git")
8 let git_hash = Command::new("git")
9− .args(&["rev-parse", "HEAD"])
9+ .args(["rev-parse", "HEAD"])
10 .output()
10 .output()
11 .ok()
11 .ok()
12 .filter(|output| output.status.success())
12 .filter(|output| output.status.success())
helix-term/src/application.rs+2−2
@@ -168,7 +168,7 @@ impl Application {
168 } else if !args.files.is_empty() {
168 } else if !args.files.is_empty() {
169 let first = &args.files[0].0; // we know it's not empty
169 let first = &args.files[0].0; // we know it's not empty
170 if first.is_dir() {
170 if first.is_dir() {
171− std::env::set_current_dir(&first).context("set current dir")?;
171+ std::env::set_current_dir(first).context("set current dir")?;
172 editor.new_file(Action::VerticalSplit);
172 editor.new_file(Action::VerticalSplit);
173 let picker = ui::file_picker(".".into(), &config.load().editor);
173 let picker = ui::file_picker(".".into(), &config.load().editor);
174 compositor.push(Box::new(overlayed(picker)));
174 compositor.push(Box::new(overlayed(picker)));
@@ -228,7 +228,7 @@ impl Application {
228 #[cfg(windows)]
228 #[cfg(windows)]
229 let signals = futures_util::stream::empty();
229 let signals = futures_util::stream::empty();
230 #[cfg(not(windows))]
230 #[cfg(not(windows))]
231− let signals = Signals::new(&[signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1])
231+ let signals = Signals::new([signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1])
232 .context("build signal handler")?;
232 .context("build signal handler")?;
233
233
234 let app = Self {
234 let app = Self {
helix-term/src/commands.rs+6−9
@@ -3933,15 +3933,12 @@ pub fn completion(cx: &mut Context) {
3933 };
3933 };
3934
3934
3935 if !prefix.is_empty() {
3935 if !prefix.is_empty() {
3936− items = items
3936+ items.retain(|item| {
3937− .into_iter()
3938− .filter(|item| {
3939− item.filter_text
3937+ item.filter_text
3940− .as_ref()
3938+ .as_ref()
3941− .unwrap_or(&item.label)
3939+ .unwrap_or(&item.label)
3942− .starts_with(&prefix)
3940+ .starts_with(&prefix)
3943− })
3941+ });
3944− .collect();
3945 }
3942 }
3946
3943
3947 if items.is_empty() {
3944 if items.is_empty() {
helix-term/src/commands/lsp.rs+3−3
@@ -57,7 +57,7 @@ impl ui::menu::Item for lsp::Location {
57 // allocation, for `to_file_path`, else there will be two (2), with `to_string_lossy`.
57 // allocation, for `to_file_path`, else there will be two (2), with `to_string_lossy`.
58 let mut write_path_to_res = || -> Option<()> {
58 let mut write_path_to_res = || -> Option<()> {
59 let path = self.uri.to_file_path().ok()?;
59 let path = self.uri.to_file_path().ok()?;
60− res.push_str(&path.strip_prefix(&cwdir).unwrap_or(&path).to_string_lossy());
60+ res.push_str(&path.strip_prefix(cwdir).unwrap_or(&path).to_string_lossy());
61 Some(())
61 Some(())
62 };
62 };
63 write_path_to_res();
63 write_path_to_res();
@@ -634,7 +634,7 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
634 // Create directory if it does not exist
634 // Create directory if it does not exist
635 if let Some(dir) = path.parent() {
635 if let Some(dir) = path.parent() {
636 if !dir.is_dir() {
636 if !dir.is_dir() {
637− fs::create_dir_all(&dir)?;
637+ fs::create_dir_all(dir)?;
638 }
638 }
639 }
639 }
640
640
@@ -910,7 +910,7 @@ pub fn goto_reference(cx: &mut Context) {
910 );
910 );
911}
911}
912
912
913−#[derive(PartialEq)]
913+#[derive(PartialEq, Eq)]
914pub enum SignatureHelpInvoked {
914pub enum SignatureHelpInvoked {
915 Manual,
915 Manual,
916 Automatic,
916 Automatic,
helix-term/src/ui/menu.rs+1−1
@@ -40,7 +40,7 @@ impl Item for PathBuf {
40 type Data = PathBuf;
40 type Data = PathBuf;
41
41
42 fn label(&self, root_path: &Self::Data) -> Spans {
42 fn label(&self, root_path: &Self::Data) -> Spans {
43− self.strip_prefix(&root_path)
43+ self.strip_prefix(root_path)
44 .unwrap_or(self)
44 .unwrap_or(self)
45 .to_string_lossy()
45 .to_string_lossy()
46 .into()
46 .into()
helix-term/src/ui/prompt.rs+2−2
@@ -32,7 +32,7 @@ pub struct Prompt {
32 next_char_handler: Option<PromptCharHandler>,
32 next_char_handler: Option<PromptCharHandler>,
33}
33}
34
34
35−#[derive(Clone, Copy, PartialEq)]
35+#[derive(Clone, Copy, PartialEq, Eq)]
36pub enum PromptEvent {
36pub enum PromptEvent {
37 /// The prompt input has been updated.
37 /// The prompt input has been updated.
38 Update,
38 Update,
@@ -408,7 +408,7 @@ impl Prompt {
408 surface.set_stringn(
408 surface.set_stringn(
409 area.x + col * (1 + col_width),
409 area.x + col * (1 + col_width),
410 area.y + row,
410 area.y + row,
411− &completion,
411+ completion,
412 col_width.saturating_sub(1) as usize,
412 col_width.saturating_sub(1) as usize,
413 color,
413 color,
414 );
414 );
helix-tui/src/buffer.rs+2−2
@@ -6,7 +6,7 @@ use unicode_segmentation::UnicodeSegmentation;
6use helix_view::graphics::{Color, Modifier, Rect, Style, UnderlineStyle};
6use helix_view::graphics::{Color, Modifier, Rect, Style, UnderlineStyle};
7
7
8/// A buffer cell
8/// A buffer cell
9−#[derive(Debug, Clone, PartialEq)]
9+#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct Cell {
10pub struct Cell {
11 pub symbol: String,
11 pub symbol: String,
12 pub fg: Color,
12 pub fg: Color,
@@ -119,7 +119,7 @@ impl Default for Cell {
119/// buf[(5, 0)].set_char('x');
119/// buf[(5, 0)].set_char('x');
120/// assert_eq!(buf[(5, 0)].symbol, "x");
120/// assert_eq!(buf[(5, 0)].symbol, "x");
121/// ```
121/// ```
122−#[derive(Debug, Default, Clone, PartialEq)]
122+#[derive(Debug, Default, Clone, PartialEq, Eq)]
123pub struct Buffer {
123pub struct Buffer {
124 /// The area represented by this buffer
124 /// The area represented by this buffer
125 pub area: Rect,
125 pub area: Rect,
helix-tui/src/layout.rs+1−1
@@ -46,7 +46,7 @@ impl Constraint {
46 }
46 }
47}
47}
48
48
49−#[derive(Debug, Clone, Copy, PartialEq)]
49+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
50pub enum Alignment {
50pub enum Alignment {
51 Left,
51 Left,
52 Center,
52 Center,
helix-tui/src/text.rs+4−4
@@ -53,14 +53,14 @@ use std::borrow::Cow;
53use unicode_segmentation::UnicodeSegmentation;
53use unicode_segmentation::UnicodeSegmentation;
54
54
55/// A grapheme associated to a style.
55/// A grapheme associated to a style.
56−#[derive(Debug, Clone, PartialEq)]
56+#[derive(Debug, Clone, PartialEq, Eq)]
57pub struct StyledGrapheme<'a> {
57pub struct StyledGrapheme<'a> {
58 pub symbol: &'a str,
58 pub symbol: &'a str,
59 pub style: Style,
59 pub style: Style,
60}
60}
61
61
62/// A string where all graphemes have the same style.
62/// A string where all graphemes have the same style.
63−#[derive(Debug, Clone, PartialEq)]
63+#[derive(Debug, Clone, PartialEq, Eq)]
64pub struct Span<'a> {
64pub struct Span<'a> {
65 pub content: Cow<'a, str>,
65 pub content: Cow<'a, str>,
66 pub style: Style,
66 pub style: Style,
@@ -209,7 +209,7 @@ impl<'a> From<Cow<'a, str>> for Span<'a> {
209}
209}
210
210
211/// A string composed of clusters of graphemes, each with their own style.
211/// A string composed of clusters of graphemes, each with their own style.
212−#[derive(Debug, Default, Clone, PartialEq)]
212+#[derive(Debug, Default, Clone, PartialEq, Eq)]
213pub struct Spans<'a>(pub Vec<Span<'a>>);
213pub struct Spans<'a>(pub Vec<Span<'a>>);
214
214
215impl<'a> Spans<'a> {
215impl<'a> Spans<'a> {
@@ -297,7 +297,7 @@ impl<'a> From<&Spans<'a>> for String {
297/// text.extend(Text::styled("Some more lines\nnow with more style!", style));
297/// text.extend(Text::styled("Some more lines\nnow with more style!", style));
298/// assert_eq!(6, text.height());
298/// assert_eq!(6, text.height());
299/// ```
299/// ```
300−#[derive(Debug, Default, Clone, PartialEq)]
300+#[derive(Debug, Default, Clone, PartialEq, Eq)]
301pub struct Text<'a> {
301pub struct Text<'a> {
302 pub lines: Vec<Spans<'a>>,
302 pub lines: Vec<Spans<'a>>,
303}
303}
helix-tui/src/widgets/block.rs+4−12
@@ -7,7 +7,7 @@ use crate::{
7use helix_view::graphics::{Rect, Style};
7use helix_view::graphics::{Rect, Style};
8
8
9/// Border render type. Defaults to [`BorderType::Plain`].
9/// Border render type. Defaults to [`BorderType::Plain`].
10−#[derive(Debug, Clone, Copy, PartialEq)]
10+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
11pub enum BorderType {
11pub enum BorderType {
12 Plain,
12 Plain,
13 Rounded,
13 Rounded,
@@ -47,7 +47,7 @@ impl Default for BorderType {
47/// .border_type(BorderType::Rounded)
47/// .border_type(BorderType::Rounded)
48/// .style(Style::default().bg(Color::Black));
48/// .style(Style::default().bg(Color::Black));
49/// ```
49/// ```
50−#[derive(Debug, Default, Clone, PartialEq)]
50+#[derive(Debug, Default, Clone, PartialEq, Eq)]
51pub struct Block<'a> {
51pub struct Block<'a> {
52 /// Optional title place on the upper left of the block
52 /// Optional title place on the upper left of the block
53 title: Option<Spans<'a>>,
53 title: Option<Spans<'a>>,
@@ -187,16 +187,8 @@ impl<'a> Widget for Block<'a> {
187 }
187 }
188
188
189 if let Some(title) = self.title {
189 if let Some(title) = self.title {
190− let lx = if self.borders.intersects(Borders::LEFT) {
190+ let lx = u16::from(self.borders.intersects(Borders::LEFT));
191− 1
192− } else {
193− 0
194− };
195− let rx = if self.borders.intersects(Borders::RIGHT) {
191+ let rx = u16::from(self.borders.intersects(Borders::RIGHT));
196− 1
197− } else {
198− 0
199− };
200 let width = area.width.saturating_sub(lx).saturating_sub(rx);
192 let width = area.width.saturating_sub(lx).saturating_sub(rx);
201 buf.set_spans(area.left() + lx, area.top(), &title, width);
193 buf.set_spans(area.left() + lx, area.top(), &title, width);
202 }
194 }
helix-tui/src/widgets/table.rs+3−3
@@ -34,7 +34,7 @@ use std::collections::HashMap;
34///
34///
35/// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling
35/// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling
36/// capabilities of [`Text`].
36/// capabilities of [`Text`].
37−#[derive(Debug, Clone, PartialEq, Default)]
37+#[derive(Debug, Clone, PartialEq, Eq, Default)]
38pub struct Cell<'a> {
38pub struct Cell<'a> {
39 pub content: Text<'a>,
39 pub content: Text<'a>,
40 style: Style,
40 style: Style,
@@ -79,7 +79,7 @@ where
79/// ```
79/// ```
80///
80///
81/// By default, a row has a height of 1 but you can change this using [`Row::height`].
81/// By default, a row has a height of 1 but you can change this using [`Row::height`].
82−#[derive(Debug, Clone, PartialEq, Default)]
82+#[derive(Debug, Clone, PartialEq, Eq, Default)]
83pub struct Row<'a> {
83pub struct Row<'a> {
84 pub cells: Vec<Cell<'a>>,
84 pub cells: Vec<Cell<'a>>,
85 height: u16,
85 height: u16,
@@ -179,7 +179,7 @@ impl<'a> Row<'a> {
179/// // ...and potentially show a symbol in front of the selection.
179/// // ...and potentially show a symbol in front of the selection.
180/// .highlight_symbol(">>");
180/// .highlight_symbol(">>");
181/// ```
181/// ```
182−#[derive(Debug, Clone, PartialEq)]
182+#[derive(Debug, Clone, PartialEq, Eq)]
183pub struct Table<'a> {
183pub struct Table<'a> {
184 /// A block to wrap the widget in
184 /// A block to wrap the widget in
185 block: Option<Block<'a>>,
185 block: Option<Block<'a>>,
helix-view/src/editor.rs+2−2
@@ -111,7 +111,7 @@ impl Default for FilePickerConfig {
111 }
111 }
112}
112}
113
113
114−#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
114+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
115#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
115#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
116pub struct Config {
116pub struct Config {
117 /// Padding to keep between the edge of the screen and the cursor when scrolling. Defaults to 5.
117 /// Padding to keep between the edge of the screen and the cursor when scrolling. Defaults to 5.
@@ -346,7 +346,7 @@ pub enum StatusLineElement {
346
346
347// Cursor shape is read and used on every rendered frame and so needs
347// Cursor shape is read and used on every rendered frame and so needs
348// to be fast. Therefore we avoid a hashmap and use an enum indexed array.
348// to be fast. Therefore we avoid a hashmap and use an enum indexed array.
349−#[derive(Debug, Clone, PartialEq)]
349+#[derive(Debug, Clone, PartialEq, Eq)]
350pub struct CursorShapeConfig([CursorKind; 3]);
350pub struct CursorShapeConfig([CursorKind; 3]);
351
351
352impl CursorShapeConfig {
352impl CursorShapeConfig {
helix-view/src/graphics.rs+4−4
@@ -5,7 +5,7 @@ use std::{
5 str::FromStr,
5 str::FromStr,
6};
6};
7
7
8−#[derive(Debug, Clone, Copy, PartialEq, Deserialize, Serialize)]
8+#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
9#[serde(rename_all = "lowercase")]
9#[serde(rename_all = "lowercase")]
10/// UNSTABLE
10/// UNSTABLE
11pub enum CursorKind {
11pub enum CursorKind {
@@ -250,7 +250,7 @@ impl Rect {
250 }
250 }
251}
251}
252
252
253−#[derive(Debug, Clone, Copy, PartialEq)]
253+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
254#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
254#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
255pub enum Color {
255pub enum Color {
256 Reset,
256 Reset,
@@ -303,7 +303,7 @@ impl From<Color> for crossterm::style::Color {
303 }
303 }
304}
304}
305
305
306−#[derive(Debug, Clone, Copy, PartialEq)]
306+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
307pub enum UnderlineStyle {
307pub enum UnderlineStyle {
308 Reset,
308 Reset,
309 Line,
309 Line,
@@ -449,7 +449,7 @@ impl FromStr for Modifier {
449/// buffer[(0, 0)].style(),
449/// buffer[(0, 0)].style(),
450/// );
450/// );
451/// ```
451/// ```
452−#[derive(Debug, Clone, Copy, PartialEq)]
452+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
453#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
453#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
454pub struct Style {
454pub struct Style {
455 pub fg: Option<Color>,
455 pub fg: Option<Color>,