diff options
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/build_reduced_graph.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/check_unused.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 2 |
5 files changed, 11 insertions, 12 deletions
diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index b3d0e4ba258..72777733345 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -129,7 +129,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { expn_id, self.def_span(def_id), // FIXME: Account for `#[no_implicit_prelude]` attributes. - parent.map_or(false, |module| module.no_implicit_prelude), + parent.is_some_and(|module| module.no_implicit_prelude), )); } } diff --git a/compiler/rustc_resolve/src/check_unused.rs b/compiler/rustc_resolve/src/check_unused.rs index 17c4a6be049..e5de5963195 100644 --- a/compiler/rustc_resolve/src/check_unused.rs +++ b/compiler/rustc_resolve/src/check_unused.rs @@ -469,7 +469,7 @@ impl Resolver<'_, '_> { .r .extern_prelude .get(&extern_crate.ident) - .map_or(false, |entry| !entry.introduced_by_item) + .is_some_and(|entry| !entry.introduced_by_item) { continue; } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index ed0a792d387..8c6ac822a77 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1843,7 +1843,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { None, ) } - } else if ident.name.as_str().chars().next().map_or(false, |c| c.is_ascii_uppercase()) { + } else if ident.name.as_str().chars().next().is_some_and(|c| c.is_ascii_uppercase()) { // Check whether the name refers to an item in the value namespace. let binding = if let Some(ribs) = ribs { self.resolve_ident_in_lexical_scope( @@ -2165,7 +2165,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let is_definitely_crate = import .module_path .first() - .map_or(false, |f| f.ident.name != kw::SelfLower && f.ident.name != kw::Super); + .is_some_and(|f| f.ident.name != kw::SelfLower && f.ident.name != kw::Super); // Add the import to the start, with a `{` if required. let start_point = source_map.start_point(after_crate_name); diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index c9131d8c8a9..b710e73e1dd 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -722,7 +722,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { if let TypoCandidate::Shadowed(res, Some(sugg_span)) = typo_sugg && res .opt_def_id() - .map_or(false, |id| id.is_local() || is_in_same_file(span, sugg_span)) + .is_some_and(|id| id.is_local() || is_in_same_file(span, sugg_span)) { err.span_label( sugg_span, @@ -856,7 +856,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { // The current function has a `self` parameter, but we were unable to resolve // a reference to `self`. This can only happen if the `self` identifier we // are resolving came from a different hygiene context. - if fn_kind.decl().inputs.get(0).map_or(false, |p| p.is_self()) { + if fn_kind.decl().inputs.get(0).is_some_and(|p| p.is_self()) { err.span_label(*span, "this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters"); } else { let doesnt = if is_assoc_fn { @@ -1632,7 +1632,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { .tcx .fn_arg_names(def_id) .first() - .map_or(false, |ident| ident.name == kw::SelfLower), + .is_some_and(|ident| ident.name == kw::SelfLower), }; if has_self { return Some(AssocSuggestion::MethodWithSelf { called }); @@ -1931,10 +1931,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { let def_id = self.r.tcx.parent(ctor_def_id); match kind { CtorKind::Const => false, - CtorKind::Fn => !self - .r - .field_def_ids(def_id) - .map_or(false, |field_ids| field_ids.is_empty()), + CtorKind::Fn => { + !self.r.field_def_ids(def_id).is_some_and(|field_ids| field_ids.is_empty()) + } } }; diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 1e31a0ff278..3d2bd842906 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1477,7 +1477,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } fn is_builtin_macro(&mut self, res: Res) -> bool { - self.get_macro(res).map_or(false, |macro_data| macro_data.ext.builtin_name.is_some()) + self.get_macro(res).is_some_and(|macro_data| macro_data.ext.builtin_name.is_some()) } fn macro_def(&self, mut ctxt: SyntaxContext) -> DefId { |
