File tree 2 files changed +6
-13
lines changed
2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -70,15 +70,11 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
70
70
71
71
// Check if the method call actually calls the libcore
72
72
// `IntoIterator::into_iter`.
73
- let trait_id = cx
74
- . typeck_results ( )
75
- . type_dependent_def_id ( expr. hir_id )
76
- . and_then ( |did| cx. tcx . trait_of_item ( did) ) ;
77
- if trait_id. is_none ( )
78
- || !cx. tcx . is_diagnostic_item ( sym:: IntoIterator , trait_id. unwrap ( ) )
79
- {
80
- return ;
81
- }
73
+ let def_id = cx. typeck_results ( ) . type_dependent_def_id ( expr. hir_id ) . unwrap ( ) ;
74
+ match cx. tcx . trait_of_item ( def_id) {
75
+ Some ( trait_id) if cx. tcx . is_diagnostic_item ( sym:: IntoIterator , trait_id) => { }
76
+ _ => return ,
77
+ } ;
82
78
83
79
// As this is a method call expression, we have at least one argument.
84
80
let receiver_ty = cx. typeck_results ( ) . expr_ty ( receiver_arg) ;
Original file line number Diff line number Diff line change @@ -988,10 +988,7 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
988
988
fn visit_expr ( & mut self , expr : & ' tcx hir:: Expr < ' tcx > ) {
989
989
if let hir:: ExprKind :: Struct ( qpath, fields, ref base) = expr. kind {
990
990
let res = self . typeck_results ( ) . qpath_res ( qpath, expr. hir_id ) ;
991
- let Some ( adt) = self . typeck_results ( ) . expr_ty ( expr) . ty_adt_def ( ) else {
992
- self . tcx . dcx ( ) . span_delayed_bug ( expr. span , "no adt_def for expression" ) ;
993
- return ;
994
- } ;
991
+ let adt = self . typeck_results ( ) . expr_ty ( expr) . ty_adt_def ( ) . unwrap ( ) ;
995
992
let variant = adt. variant_of_res ( res) ;
996
993
if let Some ( base) = * base {
997
994
// If the expression uses FRU we need to make sure all the unmentioned fields
You can’t perform that action at this time.
0 commit comments