From cbc9c3629d72e7708805f8b3c1a5a4927ff66a39 Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Thu, 30 Jan 2025 18:18:33 +0100 Subject: [PATCH] Fix `clippy::manual_pattern_char_comparison` warnings --- src/printer.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index 04300acb..abc84464 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -144,7 +144,7 @@ impl<'a> Printer for SimplePrinter<'a> { // Skip squeezed lines. if let Some(squeeze_limit) = self.config.squeeze_lines { if String::from_utf8_lossy(line_buffer) - .trim_end_matches(|c| c == '\r' || c == '\n') + .trim_end_matches(['\r', '\n']) .is_empty() { self.consecutive_empty_lines += 1; @@ -644,7 +644,7 @@ impl<'a> Printer for InteractivePrinter<'a> { // Skip squeezed lines. if let Some(squeeze_limit) = self.config.squeeze_lines { - if line.trim_end_matches(|c| c == '\r' || c == '\n').is_empty() { + if line.trim_end_matches(['\r', '\n']).is_empty() { self.consecutive_empty_lines += 1; if self.consecutive_empty_lines > squeeze_limit { return Ok(()); @@ -697,7 +697,7 @@ impl<'a> Printer for InteractivePrinter<'a> { // Regular text. EscapeSequence::Text(text) => { let text = self.preprocess(text, &mut cursor_total); - let text_trimmed = text.trim_end_matches(|c| c == '\r' || c == '\n'); + let text_trimmed = text.trim_end_matches(['\r', '\n']); write!( handle, @@ -751,10 +751,8 @@ impl<'a> Printer for InteractivePrinter<'a> { match chunk { // Regular text. EscapeSequence::Text(text) => { - let text = self.preprocess( - text.trim_end_matches(|c| c == '\r' || c == '\n'), - &mut cursor_total, - ); + let text = self + .preprocess(text.trim_end_matches(['\r', '\n']), &mut cursor_total); let mut max_width = cursor_max - cursor;