X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Fbuiltin.rs;h=a9530cd1bbf397c8a5fb4b2e6952422b11009b1d;hb=976348603485b216b0d5314eca674a2b24df4c73;hp=734b32bb92f1e88d4233b44de19690cc1769bbc1;hpb=0986b2d0e3c5f49de2a318b7ff441be664b8d51c;p=rust.git diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 734b32bb92f..a9530cd1bbf 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -2050,7 +2050,7 @@ fn lifetimes_outliving_lifetime<'tcx>( inferred_outlives .iter() .filter_map(|(pred, _)| match pred.kind().skip_binder() { - ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => match a { + ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => match *a { ty::ReEarlyBound(ebr) if ebr.index == index => Some(b), _ => None, }, @@ -2111,10 +2111,10 @@ fn collect_outlives_bound_spans<'tcx>( if let hir::GenericBound::Outlives(lifetime) = bound { let is_inferred = match tcx.named_region(lifetime.hir_id) { Some(Region::Static) if infer_static => { - inferred_outlives.iter().any(|r| matches!(r, ty::ReStatic)) + inferred_outlives.iter().any(|r| matches!(**r, ty::ReStatic)) } Some(Region::EarlyBound(index, ..)) => inferred_outlives.iter().any(|r| { - if let ty::ReEarlyBound(ebr) = r { ebr.index == index } else { false } + if let ty::ReEarlyBound(ebr) = **r { ebr.index == index } else { false } }), _ => false, }; @@ -2634,7 +2634,7 @@ fn ty_find_init_error<'tcx>( // We are extremely conservative with what we warn about. let conjured_ty = cx.typeck_results().expr_ty(expr); if let Some((msg, span)) = - with_no_trimmed_paths(|| ty_find_init_error(cx.tcx, conjured_ty, init)) + with_no_trimmed_paths!(ty_find_init_error(cx.tcx, conjured_ty, init)) { cx.struct_span_lint(INVALID_VALUE, expr.span, |lint| { let mut err = lint.build(&format!( @@ -2895,26 +2895,22 @@ fn structurally_same_type_impl<'tcx>( } (Array(a_ty, a_const), Array(b_ty, b_const)) => { // For arrays, we also check the constness of the type. - a_const.val == b_const.val - && structurally_same_type_impl(seen_types, cx, a_ty, b_ty, ckind) + a_const.val() == b_const.val() + && structurally_same_type_impl(seen_types, cx, *a_ty, *b_ty, ckind) } (Slice(a_ty), Slice(b_ty)) => { - structurally_same_type_impl(seen_types, cx, a_ty, b_ty, ckind) + structurally_same_type_impl(seen_types, cx, *a_ty, *b_ty, ckind) } (RawPtr(a_tymut), RawPtr(b_tymut)) => { a_tymut.mutbl == b_tymut.mutbl && structurally_same_type_impl( - seen_types, - cx, - &a_tymut.ty, - &b_tymut.ty, - ckind, + seen_types, cx, a_tymut.ty, b_tymut.ty, ckind, ) } (Ref(_a_region, a_ty, a_mut), Ref(_b_region, b_ty, b_mut)) => { // For structural sameness, we don't need the region to be same. a_mut == b_mut - && structurally_same_type_impl(seen_types, cx, a_ty, b_ty, ckind) + && structurally_same_type_impl(seen_types, cx, *a_ty, *b_ty, ckind) } (FnDef(..), FnDef(..)) => { let a_poly_sig = a.fn_sig(tcx); @@ -2927,7 +2923,7 @@ fn structurally_same_type_impl<'tcx>( (a_sig.abi, a_sig.unsafety, a_sig.c_variadic) == (b_sig.abi, b_sig.unsafety, b_sig.c_variadic) && a_sig.inputs().iter().eq_by(b_sig.inputs().iter(), |a, b| { - structurally_same_type_impl(seen_types, cx, a, b, ckind) + structurally_same_type_impl(seen_types, cx, *a, *b, ckind) }) && structurally_same_type_impl( seen_types,