From 2b45a039d1d5e5b768044cfaaa830f314ee6bda1 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Fri, 27 Mar 2020 10:41:46 +0100 Subject: [PATCH] fix clippy warning --- src/components/diff.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/diff.rs b/src/components/diff.rs index b66e277a..05796585 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -169,17 +169,18 @@ impl DiffComponent { .modifier(Modifier::BOLD); let filled = if selected { + // selected line format!( "{:w$}\n", line.content.trim_matches('\n'), w = width as usize ) + } else if line.content.matches('\n').count() == 1 { + // regular line, no selection (cheapest) + line.content.clone() } else { - if line.content.matches('\n').count() == 1 { - line.content.clone() - } else { - format!("{}\n", line.content.trim_matches('\n')) - } + // weird eof missing eol line + format!("{}\n", line.content.trim_matches('\n')) }; let content = Cow::from(filled);