summaryrefslogtreecommitdiffstats
path: root/openpgp/src/regex
diff options
context:
space:
mode:
authorNora Widdecke <nora@sequoia-pgp.org>2021-11-22 14:09:11 +0100
committerNora Widdecke <nora@sequoia-pgp.org>2021-11-29 11:53:55 +0100
commitf63f3181c87877a5a5b261d0f1e206615de613f6 (patch)
tree4b60ec88bab4a16f4bac795fc8614e1664d7272d /openpgp/src/regex
parent049055e3ff5ffe86700b668e924fbff96e82be94 (diff)
Simplify filter_map
- Replace .filter_map(|x| x) with .flatten(), which is easier to read. - Found with clippy: filter_map_identity.
Diffstat (limited to 'openpgp/src/regex')
-rw-r--r--openpgp/src/regex/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/openpgp/src/regex/mod.rs b/openpgp/src/regex/mod.rs
index 0584bcbe..f42009a7 100644
--- a/openpgp/src/regex/mod.rs
+++ b/openpgp/src/regex/mod.rs
@@ -342,7 +342,7 @@ fn generate_class(caret: bool, chars: impl Iterator<Item=char>) -> Hir
}
}
})
- .filter_map(|r| r);
+ .flatten();
let mut class = hir::Class::Unicode(hir::ClassUnicode::new(r));
if caret {
class.negate();
@@ -728,7 +728,7 @@ impl RegexSet {
Some(None)
}
})
- .filter_map(|re| re));
+ .flatten());
if !have_valid_utf8 && have_invalid_utf8 {
// None of the strings were valid UTF-8. Reject