]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_resolve/src/late/lifetimes.rs
Replace `&mut DiagnosticBuilder`, in signatures, with `&mut Diagnostic`.
[rust.git] / compiler / rustc_resolve / src / late / lifetimes.rs
index 3bea95fa1d554ecfcaa418cd8c909dbce92902e2..206da43ffd459a2b69ef41278deafac3704d6d9e 100644 (file)
@@ -9,7 +9,7 @@
 use crate::late::diagnostics::{ForLifetimeSpanType, MissingLifetimeSpot};
 use rustc_ast::walk_list;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
-use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
+use rustc_errors::{struct_span_err, Applicability, Diagnostic};
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
 use rustc_hir::def_id::{DefIdMap, LocalDefId};
@@ -1748,10 +1748,7 @@ fn add_bounds(set: &mut Set1<hir::LifetimeName>, bounds: &[hir::GenericBound<'_>
             let param_def_id = tcx.hir().local_def_id(param.hir_id);
             for predicate in generics.where_clause.predicates {
                 // Look for `type: ...` where clauses.
-                let data = match *predicate {
-                    hir::WherePredicate::BoundPredicate(ref data) => data,
-                    _ => continue,
-                };
+                let hir::WherePredicate::BoundPredicate(ref data) = *predicate else { continue };
 
                 // Ignore `for<'a> type: ...` as they can change what
                 // lifetimes mean (although we could "just" handle it).
@@ -1876,7 +1873,7 @@ fn lifetime_deletion_span(&self, name: Ident, generics: &hir::Generics<'_>) -> O
     // or from `fn rah<'a>(T<'a>)` to `fn rah(T<'_>)`
     fn suggest_eliding_single_use_lifetime(
         &self,
-        err: &mut DiagnosticBuilder<'_>,
+        err: &mut Diagnostic,
         def_id: DefId,
         lifetime: &hir::Lifetime,
     ) {
@@ -1976,12 +1973,9 @@ fn suggest_eliding_single_use_lifetime(
     }
 
     fn check_uses_for_lifetimes_defined_by_scope(&mut self) {
-        let defined_by = match self.scope {
-            Scope::Binder { lifetimes, .. } => lifetimes,
-            _ => {
-                debug!("check_uses_for_lifetimes_defined_by_scope: not in a binder scope");
-                return;
-            }
+        let Scope::Binder { lifetimes: defined_by, .. } = self.scope else {
+            debug!("check_uses_for_lifetimes_defined_by_scope: not in a binder scope");
+            return;
         };
 
         let def_ids: Vec<_> = defined_by
@@ -2636,9 +2630,8 @@ fn supertrait_hrtb_lifetimes(
             smallvec![(def_id, smallvec![])];
         let mut visited: FxHashSet<DefId> = FxHashSet::default();
         loop {
-            let (def_id, bound_vars) = match stack.pop() {
-                Some(next) => next,
-                None => break None,
+            let Some((def_id, bound_vars)) = stack.pop() else {
+                break None;
             };
             // See issue #83753. If someone writes an associated type on a non-trait, just treat it as
             // there being no supertrait HRTBs.
@@ -2723,10 +2716,7 @@ fn visit_fn_like_elision(
             }
         });
 
-        let output = match output {
-            Some(ty) => ty,
-            None => return,
-        };
+        let Some(output) = output else { return };
 
         debug!("determine output");