aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorNathan Vegdahl2021-06-13 18:54:56 +0000
committerNathan Vegdahl2021-06-15 01:32:23 +0000
commit5ca043c17a28323bebe7517f9bcdea8a293bcfab (patch)
tree6bf4d2e7d4122dd8f46d6b953904e9ab6cbc2cd3 /helix-view
parent2329512122105ab146395b1889b0eed4f2fb522b (diff)
Fix clippy warnings.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/document.rs26
1 files changed, 12 insertions, 14 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 71678f82..86dee16f 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