From 5ca043c17a28323bebe7517f9bcdea8a293bcfab Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sun, 13 Jun 2021 11:54:56 -0700 Subject: [PATCH] Fix clippy warnings. --- helix-view/src/document.rs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 71678f820..86dee16f2 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -280,18 +280,16 @@ impl Document { // TODO: this is probably a generally useful utility function. Where // should we put it? fn char_is_linebreak(c: char) -> bool { - match c { - '\u{000A}' | // LineFeed - '\u{000B}' | // VerticalTab - '\u{000C}' | // FormFeed - '\u{000D}' | // CarriageReturn - '\u{0085}' | // NextLine - '\u{2028}' | // Line Separator - '\u{2029}' // ParagraphSeparator - => true, - - _ => false, - } + [ + '\u{000A}', // LineFeed + '\u{000B}', // VerticalTab + '\u{000C}', // FormFeed + '\u{000D}', // CarriageReturn + '\u{0085}', // NextLine + '\u{2028}', // Line Separator + '\u{2029}', // ParagraphSeparator + ] + .contains(&c) } // Determine whether a character qualifies as (non-line-break) @@ -320,7 +318,7 @@ impl Document { // En Quad, Em Quad, En Space, Em Space, Three-per-em Space, // Four-per-em Space, Six-per-em Space, Figure Space, // Punctuation Space, Thin Space, Hair Space, Zero Width Space. - c if c >= '\u{2000}' && c <= '\u{200B}' => true, + c if ('\u{2000}' ..= '\u{200B}').contains(&c) => true, _ => false, } @@ -436,7 +434,7 @@ impl Document { .and_then(|config| config.indent.as_ref()) .map_or(" ", |config| config.unit.as_str()); // fallback to 2 spaces - self.indent_style = if indent.starts_with(" ") { + self.indent_style = if indent.starts_with(' ') { IndentStyle::Spaces(indent.len() as u8) } else { IndentStyle::Tabs