1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-02-14 17:08:37 +00:00

Fix clippy::manual_pattern_char_comparison warnings

This commit is contained in:
einfachIrgendwer0815 2025-01-30 18:18:33 +01:00
parent 2c49d905e4
commit cbc9c3629d
No known key found for this signature in database
GPG Key ID: 58D55E5F117DA873

View File

@ -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;