From 7c4fa18764ed6a6c30125ed6bfc9b025216e9668 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Mon, 21 Jun 2021 12:02:44 -0700 Subject: [PATCH] Fix clippy warnings. --- helix-core/src/line_ending.rs | 14 +++++++------- helix-term/src/commands.rs | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/helix-core/src/line_ending.rs b/helix-core/src/line_ending.rs index 19de22317..dfc745519 100644 --- a/helix-core/src/line_ending.rs +++ b/helix-core/src/line_ending.rs @@ -132,19 +132,19 @@ pub fn get_line_ending(line: &RopeSlice) -> Option { pub fn get_line_ending_of_str(line: &str) -> Option { if line.ends_with("\u{000D}\u{000A}") { Some(LineEnding::Crlf) - } else if line.ends_with("\u{000A}") { + } else if line.ends_with('\u{000A}') { Some(LineEnding::LF) - } else if line.ends_with("\u{000B}") { + } else if line.ends_with('\u{000B}') { Some(LineEnding::VT) - } else if line.ends_with("\u{000C}") { + } else if line.ends_with('\u{000C}') { Some(LineEnding::FF) - } else if line.ends_with("\u{000D}") { + } else if line.ends_with('\u{000D}') { Some(LineEnding::CR) - } else if line.ends_with("\u{0085}") { + } else if line.ends_with('\u{0085}') { Some(LineEnding::Nel) - } else if line.ends_with("\u{2028}") { + } else if line.ends_with('\u{2028}') { Some(LineEnding::LS) - } else if line.ends_with("\u{2029}") { + } else if line.ends_with('\u{2029}') { Some(LineEnding::PS) } else { None diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 6ccbaaff2..5cb30da6b 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1304,7 +1304,10 @@ mod cmd { fn yank_joined_to_clipboard(editor: &mut Editor, args: &[&str], _: PromptEvent) { let (_, doc) = current!(editor); - let separator = args.first().copied().unwrap_or(doc.line_ending.as_str()); + let separator = args + .first() + .copied() + .unwrap_or_else(|| doc.line_ending.as_str()); yank_joined_to_clipboard_impl(editor, separator); }