Use more elegant way to check for prelude string

This commit is contained in:
Christian Stefanescu 2020-08-21 14:03:42 +02:00
parent 53508aeb65
commit e615a26ae4

View File

@ -198,7 +198,7 @@ impl WildcardImports {
// 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.