Use is_some_and
/is_ok_and
in less obvious spots
This commit is contained in:
parent
fb0f74a8c9
commit
307799a711
19 changed files with 53 additions and 88 deletions
|
@ -117,16 +117,11 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
|
|||
match item.kind {
|
||||
ast::UseTreeKind::Simple(Some(ident)) => {
|
||||
if ident.name == kw::Underscore
|
||||
&& !self
|
||||
.r
|
||||
.import_res_map
|
||||
.get(&id)
|
||||
.map(|per_ns| {
|
||||
per_ns.iter().filter_map(|res| res.as_ref()).any(|res| {
|
||||
matches!(res, Res::Def(DefKind::Trait | DefKind::TraitAlias, _))
|
||||
})
|
||||
&& !self.r.import_res_map.get(&id).is_some_and(|per_ns| {
|
||||
per_ns.iter().filter_map(|res| res.as_ref()).any(|res| {
|
||||
matches!(res, Res::Def(DefKind::Trait | DefKind::TraitAlias, _))
|
||||
})
|
||||
.unwrap_or(false)
|
||||
})
|
||||
{
|
||||
self.unused_import(self.base_id).add(id);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue