From 7e4c3e098771d9caab3531b30c252686fbf14083 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 25 Jun 2021 13:18:52 +0200 Subject: [PATCH] clippy fixes Signed-off-by: Wolfgang Bumiller --- src/pattern.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pattern.rs b/src/pattern.rs index a9441d3..1611308 100644 --- a/src/pattern.rs +++ b/src/pattern.rs @@ -317,7 +317,7 @@ impl Pattern { } b'[' if pattern[(i + 1)..].starts_with(b":print:]") => { i += 8; - class.named.push(|b| b >= 0x20 && b <= 0x7f); + class.named.push(|b| (0x20..=0x7f).contains(&b)); } b'[' if pattern[(i + 1)..].starts_with(b":punct:]") => { i += 8; @@ -397,10 +397,7 @@ impl Pattern { /// Check whether this pattern matches a text. pub fn matches>(&self, text: T) -> bool { - match self.do_matches(0, text.as_ref(), false) { - MatchResult::Match => true, - _ => false, - } + matches!(self.do_matches(0, text.as_ref(), false), MatchResult::Match) } // The algorithm is ported from git's wildmatch.c. @@ -436,7 +433,7 @@ impl Pattern { literal }; - if !starts_with(text, &literal, self.flags) { + if !starts_with(text, literal, self.flags) { return MatchResult::NoMatch; }