From 3d0f0c056552deb0ca080e3f09378997c1664d2a Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Thu, 30 Jan 2025 18:14:29 +0100 Subject: [PATCH] Fix `clippy::unnecessary_map_or` warnings --- src/printer.rs | 6 +++--- src/syntax_mapping.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index ab00a66e..04300acb 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -267,7 +267,7 @@ impl<'a> InteractivePrinter<'a> { let is_printing_binary = input .reader .content_type - .map_or(false, |c| c.is_binary() && !config.show_nonprintable); + .is_some_and(|c| c.is_binary() && !config.show_nonprintable); let needs_to_match_syntax = (!is_printing_binary || matches!(config.binary, BinaryBehavior::AsText)) @@ -544,7 +544,7 @@ impl<'a> Printer for InteractivePrinter<'a> { })?; if self.config.style_components.grid() { - if self.content_type.map_or(false, |c| c.is_text()) + if self.content_type.is_some_and(|c| c.is_text()) || self.config.show_nonprintable || matches!(self.config.binary, BinaryBehavior::AsText) { @@ -559,7 +559,7 @@ impl<'a> Printer for InteractivePrinter<'a> { fn print_footer(&mut self, handle: &mut OutputHandle, _input: &OpenedInput) -> Result<()> { if self.config.style_components.grid() - && (self.content_type.map_or(false, |c| c.is_text()) + && (self.content_type.is_some_and(|c| c.is_text()) || self.config.show_nonprintable || matches!(self.config.binary, BinaryBehavior::AsText)) { diff --git a/src/syntax_mapping.rs b/src/syntax_mapping.rs index a149f9bb..306443e6 100644 --- a/src/syntax_mapping.rs +++ b/src/syntax_mapping.rs @@ -153,7 +153,7 @@ impl<'a> SyntaxMapping<'a> { if glob.is_match_candidate(&candidate) || candidate_filename .as_ref() - .map_or(false, |filename| glob.is_match_candidate(filename)) + .is_some_and(|filename| glob.is_match_candidate(filename)) { return Some(*syntax); }