1- use clippy_utils:: { MaybePath , get_attr, higher, path_def_id, sym} ;
1+ use clippy_utils:: res:: MaybeQPath ;
2+ use clippy_utils:: { get_attr, higher, path_def_id, sym} ;
23use itertools:: Itertools ;
34use rustc_ast:: LitIntType ;
45use rustc_ast:: ast:: { LitFloatType , LitKind } ;
@@ -268,16 +269,16 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
268269 chain ! ( self , "{symbol}.as_str() == {:?}" , symbol. value. as_str( ) ) ;
269270 }
270271
271- fn qpath < ' p > ( & self , qpath : & Binding < & QPath < ' _ > > , has_hir_id : & Binding < & impl MaybePath < ' p > > ) {
272+ fn qpath ( & self , qpath : & Binding < & QPath < ' _ > > , hir_id_binding : & str , hir_id : HirId ) {
272273 if let QPath :: LangItem ( lang_item, ..) = * qpath. value {
273274 chain ! ( self , "matches!({qpath}, QPath::LangItem(LangItem::{lang_item:?}, _))" ) ;
274- } else if let Some ( def_id) = self . cx . qpath_res ( qpath. value , has_hir_id . value . hir_id ( ) ) . opt_def_id ( )
275+ } else if let Some ( def_id) = self . cx . qpath_res ( qpath. value , hir_id) . opt_def_id ( )
275276 && !def_id. is_local ( )
276277 {
277278 bind ! ( self , def_id) ;
278279 chain ! (
279280 self ,
280- "let Some({def_id}) = cx.qpath_res({qpath}, {has_hir_id }.hir_id).opt_def_id()"
281+ "let Some({def_id}) = cx.qpath_res({qpath}, {hir_id_binding }.hir_id).opt_def_id()"
281282 ) ;
282283 if let Some ( name) = self . cx . tcx . get_diagnostic_name ( def_id. value ) {
283284 chain ! ( self , "cx.tcx.is_diagnostic_item(sym::{name}, {def_id})" ) ;
@@ -291,7 +292,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
291292 }
292293 }
293294
294- fn maybe_path < ' p > ( & self , path : & Binding < & impl MaybePath < ' p > > ) {
295+ fn maybe_path < ' p > ( & self , path : & Binding < impl MaybeQPath < ' p > > ) {
295296 if let Some ( id) = path_def_id ( self . cx , path. value )
296297 && !id. is_local ( )
297298 {
@@ -671,7 +672,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
671672 StructTailExpr :: None | StructTailExpr :: DefaultFields ( _) => None ,
672673 } ) ;
673674 kind ! ( "Struct({qpath}, {fields}, {base})" ) ;
674- self . qpath ( qpath, expr) ;
675+ self . qpath ( qpath, & expr. name , expr . value . hir_id ) ;
675676 self . slice ( fields, |field| {
676677 self . ident ( field ! ( field. ident) ) ;
677678 self . expr ( field ! ( field. expr) ) ;
@@ -757,7 +758,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
757758 let ignore = etc. is_some ( ) ;
758759 bind ! ( self , qpath, fields) ;
759760 kind ! ( "Struct(ref {qpath}, {fields}, {ignore})" ) ;
760- self . qpath ( qpath, pat) ;
761+ self . qpath ( qpath, & pat. name , pat . value . hir_id ) ;
761762 self . slice ( fields, |field| {
762763 self . ident ( field ! ( field. ident) ) ;
763764 self . pat ( field ! ( field. pat) ) ;
@@ -771,7 +772,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
771772 PatKind :: TupleStruct ( ref qpath, fields, skip_pos) => {
772773 bind ! ( self , qpath, fields) ;
773774 kind ! ( "TupleStruct(ref {qpath}, {fields}, {skip_pos:?})" ) ;
774- self . qpath ( qpath, pat) ;
775+ self . qpath ( qpath, & pat. name , pat . value . hir_id ) ;
775776 self . slice ( fields, |pat| self . pat ( pat) ) ;
776777 } ,
777778 PatKind :: Tuple ( fields, skip_pos) => {
0 commit comments