From c5c64d48b7d96a0ffc2f8181ccf3a27b0d4f62b8 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 21 Jun 2019 09:04:54 +0200 Subject: [PATCH] Use map_or instead of match --- src/util/strext.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/strext.rs b/src/util/strext.rs index 6f81367a..5886d6cb 100644 --- a/src/util/strext.rs +++ b/src/util/strext.rs @@ -8,9 +8,9 @@ impl _StrExt for str { if index == self.len() { return true; } - match self.as_bytes().get(index) { - None => false, - Some(&b) => b < 128 || b >= 192, - } + + self.as_bytes() + .get(index) + .map_or(false, |&b| b < 128 || b >= 192) } }