File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Expand file tree Collapse file tree 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 {
7070
7171 // Check if the method call actually calls the libcore
7272 // `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+ } ;
8278
8379 // As this is a method call expression, we have at least one argument.
8480 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> {
988988 fn visit_expr ( & mut self , expr : & ' tcx hir:: Expr < ' tcx > ) {
989989 if let hir:: ExprKind :: Struct ( qpath, fields, ref base) = expr. kind {
990990 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 ( ) ;
995992 let variant = adt. variant_of_res ( res) ;
996993 if let Some ( base) = * base {
997994 // 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