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};
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).
// 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,
) {
}
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
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.
}
});
- let output = match output {
- Some(ty) => ty,
- None => return,
- };
+ let Some(output) = output else { return };
debug!("determine output");