Resolve a bunch of upcoming clippy lints

pull/4590/head
Blaž Hrastnik 2 years ago
parent 921d351013
commit c2c1280f02
No known key found for this signature in database
GPG Key ID: 1238B9C4AD889640

@ -282,7 +282,7 @@ impl History {
} }
/// Whether to undo by a number of edits or a duration of time. /// 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 { pub enum UndoKind {
Steps(usize), Steps(usize),
TimePeriod(std::time::Duration), TimePeriod(std::time::Duration),

@ -110,8 +110,8 @@ impl<'a> Increment for NumberIncrementor<'a> {
let (lower_count, upper_count): (usize, usize) = let (lower_count, upper_count): (usize, usize) =
old_text.chars().skip(2).fold((0, 0), |(lower, upper), c| { old_text.chars().skip(2).fold((0, 0), |(lower, upper), c| {
( (
lower + c.is_ascii_lowercase().then(|| 1).unwrap_or(0), lower + usize::from(c.is_ascii_lowercase()),
upper + c.is_ascii_uppercase().then(|| 1).unwrap_or(0), upper + usize::from(c.is_ascii_uppercase()),
) )
}); });
if upper_count > lower_count { if upper_count > lower_count {

@ -6,7 +6,7 @@ pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::Crlf;
pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::LF; pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::LF;
/// Represents one of the valid Unicode line endings. /// Represents one of the valid Unicode line endings.
#[derive(PartialEq, Copy, Clone, Debug)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum LineEnding { pub enum LineEnding {
Crlf, // CarriageReturn followed by LineFeed Crlf, // CarriageReturn followed by LineFeed
LF, // U+000A -- LineFeed LF, // U+000A -- LineFeed

@ -13,7 +13,7 @@ pub const PAIRS: &[(char, char)] = &[
('', ''), ('', ''),
]; ];
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub enum Error { pub enum Error {
PairNotFound, PairNotFound,
CursorOverlap, CursorOverlap,

@ -218,7 +218,7 @@ pub struct FormatterConfiguration {
pub args: Vec<String>, pub args: Vec<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
pub struct AdvancedCompletion { pub struct AdvancedCompletion {
pub name: Option<String>, pub name: Option<String>,
@ -226,14 +226,14 @@ pub struct AdvancedCompletion {
pub default: Option<String>, pub default: Option<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case", untagged)] #[serde(rename_all = "kebab-case", untagged)]
pub enum DebugConfigCompletion { pub enum DebugConfigCompletion {
Named(String), Named(String),
Advanced(AdvancedCompletion), Advanced(AdvancedCompletion),
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum DebugArgumentValue { pub enum DebugArgumentValue {
String(String), String(String),
@ -241,7 +241,7 @@ pub enum DebugArgumentValue {
Boolean(bool), Boolean(bool),
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
pub struct DebugTemplate { pub struct DebugTemplate {
pub name: String, pub name: String,
@ -250,7 +250,7 @@ pub struct DebugTemplate {
pub args: HashMap<String, DebugArgumentValue>, pub args: HashMap<String, DebugArgumentValue>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
pub struct DebugAdapterConfig { pub struct DebugAdapterConfig {
pub name: String, pub name: String,
@ -266,7 +266,7 @@ pub struct DebugAdapterConfig {
} }
// Different workarounds for adapters' differences // Different workarounds for adapters' differences
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct DebuggerQuirks { pub struct DebuggerQuirks {
#[serde(default)] #[serde(default)]
pub absolute_paths: bool, pub absolute_paths: bool,
@ -280,7 +280,7 @@ pub struct IndentationConfiguration {
} }
/// Configuration for auto pairs /// 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)] #[serde(rename_all = "kebab-case", deny_unknown_fields, untagged)]
pub enum AutoPairConfig { pub enum AutoPairConfig {
/// Enables or disables auto pairing. False means disabled. True means to use the default pairs. /// Enables or disables auto pairing. False means disabled. True means to use the default pairs.

@ -22,7 +22,7 @@ pub struct Request {
pub arguments: Option<Value>, pub arguments: Option<Value>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
pub struct Response { pub struct Response {
// seq is omitted as unused and is not sent by some implementations // seq is omitted as unused and is not sent by some implementations
pub request_seq: u64, pub request_seq: u64,

@ -22,7 +22,7 @@ pub trait Request {
const COMMAND: &'static str; const COMMAND: &'static str;
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ColumnDescriptor { pub struct ColumnDescriptor {
pub attribute_name: String, pub attribute_name: String,
@ -35,7 +35,7 @@ pub struct ColumnDescriptor {
pub width: Option<usize>, pub width: Option<usize>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ExceptionBreakpointsFilter { pub struct ExceptionBreakpointsFilter {
pub filter: String, pub filter: String,
@ -50,7 +50,7 @@ pub struct ExceptionBreakpointsFilter {
pub condition_description: Option<String>, pub condition_description: Option<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct DebuggerCapabilities { pub struct DebuggerCapabilities {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -131,14 +131,14 @@ pub struct DebuggerCapabilities {
pub supported_checksum_algorithms: Option<Vec<String>>, pub supported_checksum_algorithms: Option<Vec<String>>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Checksum { pub struct Checksum {
pub algorithm: String, pub algorithm: String,
pub checksum: String, pub checksum: String,
} }
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Source { pub struct Source {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -159,7 +159,7 @@ pub struct Source {
pub checksums: Option<Vec<Checksum>>, pub checksums: Option<Vec<Checksum>>,
} }
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SourceBreakpoint { pub struct SourceBreakpoint {
pub line: usize, pub line: usize,
@ -173,7 +173,7 @@ pub struct SourceBreakpoint {
pub log_message: Option<String>, pub log_message: Option<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Breakpoint { pub struct Breakpoint {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -197,7 +197,7 @@ pub struct Breakpoint {
pub offset: Option<usize>, pub offset: Option<usize>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StackFrameFormat { pub struct StackFrameFormat {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -216,7 +216,7 @@ pub struct StackFrameFormat {
pub include_all: Option<bool>, pub include_all: Option<bool>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StackFrame { pub struct StackFrame {
pub id: usize, pub id: usize,
@ -239,14 +239,14 @@ pub struct StackFrame {
pub presentation_hint: Option<String>, pub presentation_hint: Option<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Thread { pub struct Thread {
pub id: ThreadId, pub id: ThreadId,
pub name: String, pub name: String,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Scope { pub struct Scope {
pub name: String, pub name: String,
@ -270,14 +270,14 @@ pub struct Scope {
pub end_column: Option<usize>, pub end_column: Option<usize>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ValueFormat { pub struct ValueFormat {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub hex: Option<bool>, pub hex: Option<bool>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VariablePresentationHint { pub struct VariablePresentationHint {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -288,7 +288,7 @@ pub struct VariablePresentationHint {
pub visibility: Option<String>, pub visibility: Option<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Variable { pub struct Variable {
pub name: String, pub name: String,
@ -308,7 +308,7 @@ pub struct Variable {
pub memory_reference: Option<String>, pub memory_reference: Option<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Module { pub struct Module {
pub id: String, // TODO: || number pub id: String, // TODO: || number
@ -333,7 +333,7 @@ pub struct Module {
pub mod requests { pub mod requests {
use super::*; use super::*;
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct InitializeArguments { pub struct InitializeArguments {
#[serde(rename = "clientID", skip_serializing_if = "Option::is_none")] #[serde(rename = "clientID", skip_serializing_if = "Option::is_none")]
@ -409,7 +409,7 @@ pub mod requests {
const COMMAND: &'static str = "configurationDone"; const COMMAND: &'static str = "configurationDone";
} }
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SetBreakpointsArguments { pub struct SetBreakpointsArguments {
pub source: Source, pub source: Source,
@ -420,7 +420,7 @@ pub mod requests {
pub source_modified: Option<bool>, pub source_modified: Option<bool>,
} }
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SetBreakpointsResponse { pub struct SetBreakpointsResponse {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -436,13 +436,13 @@ pub mod requests {
const COMMAND: &'static str = "setBreakpoints"; const COMMAND: &'static str = "setBreakpoints";
} }
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContinueArguments { pub struct ContinueArguments {
pub thread_id: ThreadId, pub thread_id: ThreadId,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContinueResponse { pub struct ContinueResponse {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -458,7 +458,7 @@ pub mod requests {
const COMMAND: &'static str = "continue"; const COMMAND: &'static str = "continue";
} }
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StackTraceArguments { pub struct StackTraceArguments {
pub thread_id: ThreadId, pub thread_id: ThreadId,
@ -470,7 +470,7 @@ pub mod requests {
pub format: Option<StackFrameFormat>, pub format: Option<StackFrameFormat>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StackTraceResponse { pub struct StackTraceResponse {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -487,7 +487,7 @@ pub mod requests {
const COMMAND: &'static str = "stackTrace"; const COMMAND: &'static str = "stackTrace";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ThreadsResponse { pub struct ThreadsResponse {
pub threads: Vec<Thread>, pub threads: Vec<Thread>,
@ -502,13 +502,13 @@ pub mod requests {
const COMMAND: &'static str = "threads"; const COMMAND: &'static str = "threads";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ScopesArguments { pub struct ScopesArguments {
pub frame_id: usize, pub frame_id: usize,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ScopesResponse { pub struct ScopesResponse {
pub scopes: Vec<Scope>, pub scopes: Vec<Scope>,
@ -523,7 +523,7 @@ pub mod requests {
const COMMAND: &'static str = "scopes"; const COMMAND: &'static str = "scopes";
} }
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VariablesArguments { pub struct VariablesArguments {
pub variables_reference: usize, pub variables_reference: usize,
@ -537,7 +537,7 @@ pub mod requests {
pub format: Option<ValueFormat>, pub format: Option<ValueFormat>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VariablesResponse { pub struct VariablesResponse {
pub variables: Vec<Variable>, pub variables: Vec<Variable>,
@ -552,7 +552,7 @@ pub mod requests {
const COMMAND: &'static str = "variables"; const COMMAND: &'static str = "variables";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StepInArguments { pub struct StepInArguments {
pub thread_id: ThreadId, pub thread_id: ThreadId,
@ -571,7 +571,7 @@ pub mod requests {
const COMMAND: &'static str = "stepIn"; const COMMAND: &'static str = "stepIn";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StepOutArguments { pub struct StepOutArguments {
pub thread_id: ThreadId, pub thread_id: ThreadId,
@ -588,7 +588,7 @@ pub mod requests {
const COMMAND: &'static str = "stepOut"; const COMMAND: &'static str = "stepOut";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct NextArguments { pub struct NextArguments {
pub thread_id: ThreadId, pub thread_id: ThreadId,
@ -605,7 +605,7 @@ pub mod requests {
const COMMAND: &'static str = "next"; const COMMAND: &'static str = "next";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PauseArguments { pub struct PauseArguments {
pub thread_id: ThreadId, pub thread_id: ThreadId,
@ -620,7 +620,7 @@ pub mod requests {
const COMMAND: &'static str = "pause"; const COMMAND: &'static str = "pause";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct EvaluateArguments { pub struct EvaluateArguments {
pub expression: String, pub expression: String,
@ -632,7 +632,7 @@ pub mod requests {
pub format: Option<ValueFormat>, pub format: Option<ValueFormat>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct EvaluateResponse { pub struct EvaluateResponse {
pub result: String, pub result: String,
@ -658,7 +658,7 @@ pub mod requests {
const COMMAND: &'static str = "evaluate"; const COMMAND: &'static str = "evaluate";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SetExceptionBreakpointsArguments { pub struct SetExceptionBreakpointsArguments {
pub filters: Vec<String>, pub filters: Vec<String>,
@ -666,7 +666,7 @@ pub mod requests {
// pub exceptionOptions: Option<Vec<ExceptionOptions>>, // needs capability // pub exceptionOptions: Option<Vec<ExceptionOptions>>, // needs capability
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SetExceptionBreakpointsResponse { pub struct SetExceptionBreakpointsResponse {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -684,7 +684,7 @@ pub mod requests {
// Reverse Requests // Reverse Requests
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct RunInTerminalResponse { pub struct RunInTerminalResponse {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -693,7 +693,7 @@ pub mod requests {
pub shell_process_id: Option<u32>, pub shell_process_id: Option<u32>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct RunInTerminalArguments { pub struct RunInTerminalArguments {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -745,7 +745,7 @@ pub mod events {
Memory(Memory), Memory(Memory),
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Stopped { pub struct Stopped {
pub reason: String, pub reason: String,
@ -763,7 +763,7 @@ pub mod events {
pub hit_breakpoint_ids: Option<Vec<usize>>, pub hit_breakpoint_ids: Option<Vec<usize>>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Continued { pub struct Continued {
pub thread_id: ThreadId, pub thread_id: ThreadId,
@ -771,27 +771,27 @@ pub mod events {
pub all_threads_continued: Option<bool>, pub all_threads_continued: Option<bool>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Exited { pub struct Exited {
pub exit_code: usize, pub exit_code: usize,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Terminated { pub struct Terminated {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub restart: Option<Value>, pub restart: Option<Value>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Thread { pub struct Thread {
pub reason: String, pub reason: String,
pub thread_id: ThreadId, pub thread_id: ThreadId,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Output { pub struct Output {
pub output: String, pub output: String,
@ -811,28 +811,28 @@ pub mod events {
pub data: Option<Value>, pub data: Option<Value>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Breakpoint { pub struct Breakpoint {
pub reason: String, pub reason: String,
pub breakpoint: super::Breakpoint, pub breakpoint: super::Breakpoint,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Module { pub struct Module {
pub reason: String, pub reason: String,
pub module: super::Module, pub module: super::Module,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct LoadedSource { pub struct LoadedSource {
pub reason: String, pub reason: String,
pub source: super::Source, pub source: super::Source,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Process { pub struct Process {
pub name: String, pub name: String,
@ -846,13 +846,13 @@ pub mod events {
pub pointer_size: Option<usize>, pub pointer_size: Option<usize>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Capabilities { pub struct Capabilities {
pub capabilities: super::DebuggerCapabilities, pub capabilities: super::DebuggerCapabilities,
} }
// #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] // #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
// #[serde(rename_all = "camelCase")] // #[serde(rename_all = "camelCase")]
// pub struct Invalidated { // pub struct Invalidated {
// pub areas: Vec<InvalidatedArea>, // pub areas: Vec<InvalidatedArea>,
@ -860,7 +860,7 @@ pub mod events {
// pub stack_frame_id: Option<usize>, // pub stack_frame_id: Option<usize>,
// } // }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Memory { pub struct Memory {
pub memory_reference: String, pub memory_reference: String,

@ -67,7 +67,7 @@ pub fn get_language(name: &str) -> Result<Language> {
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub fn get_language(name: &str) -> Result<Language> { pub fn get_language(name: &str) -> Result<Language> {
use libloading::{Library, Symbol}; 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); library_path.set_extension(DYLIB_EXTENSION);
let library = unsafe { Library::new(&library_path) } let library = unsafe { Library::new(&library_path) }
@ -429,7 +429,7 @@ fn build_tree_sitter_library(
if cfg!(all(windows, target_env = "msvc")) { if cfg!(all(windows, target_env = "msvc")) {
command command
.args(&["/nologo", "/LD", "/I"]) .args(["/nologo", "/LD", "/I"])
.arg(header_path) .arg(header_path)
.arg("/Od") .arg("/Od")
.arg("/utf-8"); .arg("/utf-8");

@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;
// https://www.jsonrpc.org/specification#error_object // https://www.jsonrpc.org/specification#error_object
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Eq, Clone)]
pub enum ErrorCode { pub enum ErrorCode {
ParseError, ParseError,
InvalidRequest, 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 struct Error {
pub code: ErrorCode, pub code: ErrorCode,
pub message: String, pub message: String,
@ -100,7 +100,7 @@ impl std::error::Error for Error {}
// https://www.jsonrpc.org/specification#request_object // https://www.jsonrpc.org/specification#request_object
/// Request ID /// Request ID
#[derive(Debug, PartialEq, Clone, Hash, Eq, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum Id { pub enum Id {
Null, Null,
@ -109,7 +109,7 @@ pub enum Id {
} }
/// Protocol Version /// Protocol Version
#[derive(Debug, PartialEq, Clone, Copy, Hash, Eq)] #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub enum Version { pub enum Version {
V2, 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)] #[serde(untagged)]
pub enum Params { pub enum Params {
None, 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)] #[serde(deny_unknown_fields)]
pub struct MethodCall { pub struct MethodCall {
pub jsonrpc: Option<Version>, pub jsonrpc: Option<Version>,
@ -192,7 +192,7 @@ pub struct MethodCall {
pub id: Id, pub id: Id,
} }
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct Notification { pub struct Notification {
pub jsonrpc: Option<Version>, pub jsonrpc: Option<Version>,
@ -201,7 +201,7 @@ pub struct Notification {
pub params: Params, pub params: Params,
} }
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(untagged)] #[serde(untagged)]
pub enum Call { 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(deny_unknown_fields)]
#[serde(untagged)] #[serde(untagged)]
pub enum Request { pub enum Request {
@ -245,7 +245,7 @@ pub enum Request {
// https://www.jsonrpc.org/specification#response_object // https://www.jsonrpc.org/specification#response_object
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Success { pub struct Success {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub jsonrpc: Option<Version>, pub jsonrpc: Option<Version>,
@ -253,7 +253,7 @@ pub struct Success {
pub id: Id, pub id: Id,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
pub struct Failure { pub struct Failure {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub jsonrpc: Option<Version>, pub jsonrpc: Option<Version>,
@ -264,7 +264,7 @@ pub struct Failure {
// Note that failure comes first because we're not using // Note that failure comes first because we're not using
// #[serde(deny_unknown_field)]: we want a request that contains // #[serde(deny_unknown_field)]: we want a request that contains
// both `result` and `error` to be a `Failure`. // both `result` and `error` to be a `Failure`.
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum Output { pub enum Output {
Failure(Failure), 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)] #[serde(untagged)]
pub enum Response { pub enum Response {
Single(Output), Single(Output),

@ -6,7 +6,7 @@ const VERSION: &str = include_str!("../VERSION");
fn main() { fn main() {
let git_hash = Command::new("git") let git_hash = Command::new("git")
.args(&["rev-parse", "HEAD"]) .args(["rev-parse", "HEAD"])
.output() .output()
.ok() .ok()
.filter(|output| output.status.success()) .filter(|output| output.status.success())

@ -168,7 +168,7 @@ impl Application {
} else if !args.files.is_empty() { } else if !args.files.is_empty() {
let first = &args.files[0].0; // we know it's not empty let first = &args.files[0].0; // we know it's not empty
if first.is_dir() { 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); editor.new_file(Action::VerticalSplit);
let picker = ui::file_picker(".".into(), &config.load().editor); let picker = ui::file_picker(".".into(), &config.load().editor);
compositor.push(Box::new(overlayed(picker))); compositor.push(Box::new(overlayed(picker)));
@ -228,7 +228,7 @@ impl Application {
#[cfg(windows)] #[cfg(windows)]
let signals = futures_util::stream::empty(); let signals = futures_util::stream::empty();
#[cfg(not(windows))] #[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")?; .context("build signal handler")?;
let app = Self { let app = Self {

@ -3933,15 +3933,12 @@ pub fn completion(cx: &mut Context) {
}; };
if !prefix.is_empty() { if !prefix.is_empty() {
items = items items.retain(|item| {
.into_iter() item.filter_text
.filter(|item| { .as_ref()
item.filter_text .unwrap_or(&item.label)
.as_ref() .starts_with(&prefix)
.unwrap_or(&item.label) });
.starts_with(&prefix)
})
.collect();
} }
if items.is_empty() { if items.is_empty() {

@ -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`. // allocation, for `to_file_path`, else there will be two (2), with `to_string_lossy`.
let mut write_path_to_res = || -> Option<()> { let mut write_path_to_res = || -> Option<()> {
let path = self.uri.to_file_path().ok()?; 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(()) Some(())
}; };
write_path_to_res(); 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 // Create directory if it does not exist
if let Some(dir) = path.parent() { if let Some(dir) = path.parent() {
if !dir.is_dir() { 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 { pub enum SignatureHelpInvoked {
Manual, Manual,
Automatic, Automatic,

@ -40,7 +40,7 @@ impl Item for PathBuf {
type Data = PathBuf; type Data = PathBuf;
fn label(&self, root_path: &Self::Data) -> Spans { fn label(&self, root_path: &Self::Data) -> Spans {
self.strip_prefix(&root_path) self.strip_prefix(root_path)
.unwrap_or(self) .unwrap_or(self)
.to_string_lossy() .to_string_lossy()
.into() .into()

@ -32,7 +32,7 @@ pub struct Prompt {
next_char_handler: Option<PromptCharHandler>, next_char_handler: Option<PromptCharHandler>,
} }
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq, Eq)]
pub enum PromptEvent { pub enum PromptEvent {
/// The prompt input has been updated. /// The prompt input has been updated.
Update, Update,
@ -408,7 +408,7 @@ impl Prompt {
surface.set_stringn( surface.set_stringn(
area.x + col * (1 + col_width), area.x + col * (1 + col_width),
area.y + row, area.y + row,
&completion, completion,
col_width.saturating_sub(1) as usize, col_width.saturating_sub(1) as usize,
color, color,
); );

@ -6,7 +6,7 @@ use unicode_segmentation::UnicodeSegmentation;
use helix_view::graphics::{Color, Modifier, Rect, Style, UnderlineStyle}; use helix_view::graphics::{Color, Modifier, Rect, Style, UnderlineStyle};
/// A buffer cell /// A buffer cell
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct Cell { pub struct Cell {
pub symbol: String, pub symbol: String,
pub fg: Color, pub fg: Color,
@ -119,7 +119,7 @@ impl Default for Cell {
/// buf[(5, 0)].set_char('x'); /// buf[(5, 0)].set_char('x');
/// assert_eq!(buf[(5, 0)].symbol, "x"); /// assert_eq!(buf[(5, 0)].symbol, "x");
/// ``` /// ```
#[derive(Debug, Default, Clone, PartialEq)] #[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Buffer { pub struct Buffer {
/// The area represented by this buffer /// The area represented by this buffer
pub area: Rect, pub area: Rect,

@ -46,7 +46,7 @@ impl Constraint {
} }
} }
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Alignment { pub enum Alignment {
Left, Left,
Center, Center,

@ -53,14 +53,14 @@ use std::borrow::Cow;
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
/// A grapheme associated to a style. /// A grapheme associated to a style.
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct StyledGrapheme<'a> { pub struct StyledGrapheme<'a> {
pub symbol: &'a str, pub symbol: &'a str,
pub style: Style, pub style: Style,
} }
/// A string where all graphemes have the same style. /// A string where all graphemes have the same style.
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct Span<'a> { pub struct Span<'a> {
pub content: Cow<'a, str>, pub content: Cow<'a, str>,
pub style: Style, 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. /// 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>>); pub struct Spans<'a>(pub Vec<Span<'a>>);
impl<'a> Spans<'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)); /// text.extend(Text::styled("Some more lines\nnow with more style!", style));
/// assert_eq!(6, text.height()); /// assert_eq!(6, text.height());
/// ``` /// ```
#[derive(Debug, Default, Clone, PartialEq)] #[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Text<'a> { pub struct Text<'a> {
pub lines: Vec<Spans<'a>>, pub lines: Vec<Spans<'a>>,
} }

@ -7,7 +7,7 @@ use crate::{
use helix_view::graphics::{Rect, Style}; use helix_view::graphics::{Rect, Style};
/// Border render type. Defaults to [`BorderType::Plain`]. /// Border render type. Defaults to [`BorderType::Plain`].
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BorderType { pub enum BorderType {
Plain, Plain,
Rounded, Rounded,
@ -47,7 +47,7 @@ impl Default for BorderType {
/// .border_type(BorderType::Rounded) /// .border_type(BorderType::Rounded)
/// .style(Style::default().bg(Color::Black)); /// .style(Style::default().bg(Color::Black));
/// ``` /// ```
#[derive(Debug, Default, Clone, PartialEq)] #[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Block<'a> { pub struct Block<'a> {
/// Optional title place on the upper left of the block /// Optional title place on the upper left of the block
title: Option<Spans<'a>>, title: Option<Spans<'a>>,
@ -187,16 +187,8 @@ impl<'a> Widget for Block<'a> {
} }
if let Some(title) = self.title { if let Some(title) = self.title {
let lx = if self.borders.intersects(Borders::LEFT) { let lx = u16::from(self.borders.intersects(Borders::LEFT));
1 let rx = u16::from(self.borders.intersects(Borders::RIGHT));
} else {
0
};
let rx = if self.borders.intersects(Borders::RIGHT) {
1
} else {
0
};
let width = area.width.saturating_sub(lx).saturating_sub(rx); let width = area.width.saturating_sub(lx).saturating_sub(rx);
buf.set_spans(area.left() + lx, area.top(), &title, width); buf.set_spans(area.left() + lx, area.top(), &title, width);
} }

@ -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 /// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling
/// capabilities of [`Text`]. /// capabilities of [`Text`].
#[derive(Debug, Clone, PartialEq, Default)] #[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct Cell<'a> { pub struct Cell<'a> {
pub content: Text<'a>, pub content: Text<'a>,
style: Style, style: Style,
@ -79,7 +79,7 @@ where
/// ``` /// ```
/// ///
/// By default, a row has a height of 1 but you can change this using [`Row::height`]. /// 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 struct Row<'a> {
pub cells: Vec<Cell<'a>>, pub cells: Vec<Cell<'a>>,
height: u16, height: u16,
@ -179,7 +179,7 @@ impl<'a> Row<'a> {
/// // ...and potentially show a symbol in front of the selection. /// // ...and potentially show a symbol in front of the selection.
/// .highlight_symbol(">>"); /// .highlight_symbol(">>");
/// ``` /// ```
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct Table<'a> { pub struct Table<'a> {
/// A block to wrap the widget in /// A block to wrap the widget in
block: Option<Block<'a>>, block: Option<Block<'a>>,

@ -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)] #[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
pub struct Config { pub struct Config {
/// Padding to keep between the edge of the screen and the cursor when scrolling. Defaults to 5. /// 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 // 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. // 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]); pub struct CursorShapeConfig([CursorKind; 3]);
impl CursorShapeConfig { impl CursorShapeConfig {

@ -5,7 +5,7 @@ use std::{
str::FromStr, str::FromStr,
}; };
#[derive(Debug, Clone, Copy, PartialEq, Deserialize, Serialize)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
/// UNSTABLE /// UNSTABLE
pub enum CursorKind { 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))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Color { pub enum Color {
Reset, 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 { pub enum UnderlineStyle {
Reset, Reset,
Line, Line,
@ -449,7 +449,7 @@ impl FromStr for Modifier {
/// buffer[(0, 0)].style(), /// buffer[(0, 0)].style(),
/// ); /// );
/// ``` /// ```
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Style { pub struct Style {
pub fg: Option<Color>, pub fg: Option<Color>,

Loading…
Cancel
Save