]> git.lizzy.rs Git - rust.git/commitdiff
Use more elegant way to check for prelude string
authorChristian Stefanescu <chris@0chris.com>
Fri, 21 Aug 2020 12:03:42 +0000 (14:03 +0200)
committerChristian Stefanescu <chris@0chris.com>
Sat, 22 Aug 2020 12:22:02 +0000 (14:22 +0200)
clippy_lints/src/wildcard_imports.rs

index 717741129a8f8d083f85519684794ccc8b8aa9df..5683a71efea4eff68208fd420aeda4c0d95b73d5 100644 (file)
@@ -198,7 +198,7 @@ fn check_exceptions(&self, item: &Item<'_>, segments: &[PathSegment<'_>]) -> boo
 // Allow "...prelude::..::*" imports.
 // Many crates have a prelude, and it is imported as a glob by design.
 fn is_prelude_import(segments: &[PathSegment<'_>]) -> bool {
-    segments.iter().filter(|ps| ps.ident.as_str() == "prelude").count() > 0
+    segments.iter().any(|ps| ps.ident.as_str() == "prelude")
 }
 
 // Allow "super::*" imports in tests.