@@ -1165,33 +1165,28 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
11651165 let ty = self . lower_assoc_ty ( span, assoc_ty_did, assoc_segment, bound) ;
11661166
11671167 if let Some ( variant_def_id) = variant_resolution {
1168- tcx. node_span_lint (
1169- AMBIGUOUS_ASSOCIATED_ITEMS ,
1170- hir_ref_id,
1171- span,
1172- "ambiguous associated item" ,
1173- |lint| {
1174- let mut could_refer_to = |kind : DefKind , def_id, also| {
1175- let note_msg = format ! (
1176- "`{}` could{} refer to the {} defined here" ,
1177- assoc_ident,
1178- also,
1179- tcx. def_kind_descr( kind, def_id)
1180- ) ;
1181- lint. span_note ( tcx. def_span ( def_id) , note_msg) ;
1182- } ;
1168+ tcx. node_span_lint ( AMBIGUOUS_ASSOCIATED_ITEMS , hir_ref_id, span, |lint| {
1169+ lint. primary_message ( "ambiguous associated item" ) ;
1170+ let mut could_refer_to = |kind : DefKind , def_id, also| {
1171+ let note_msg = format ! (
1172+ "`{}` could{} refer to the {} defined here" ,
1173+ assoc_ident,
1174+ also,
1175+ tcx. def_kind_descr( kind, def_id)
1176+ ) ;
1177+ lint. span_note ( tcx. def_span ( def_id) , note_msg) ;
1178+ } ;
11831179
1184- could_refer_to ( DefKind :: Variant , variant_def_id, "" ) ;
1185- could_refer_to ( DefKind :: AssocTy , assoc_ty_did, " also" ) ;
1180+ could_refer_to ( DefKind :: Variant , variant_def_id, "" ) ;
1181+ could_refer_to ( DefKind :: AssocTy , assoc_ty_did, " also" ) ;
11861182
1187- lint. span_suggestion (
1188- span,
1189- "use fully-qualified syntax" ,
1190- format ! ( "<{} as {}>::{}" , qself_ty, tcx. item_name( trait_did) , assoc_ident) ,
1191- Applicability :: MachineApplicable ,
1192- ) ;
1193- } ,
1194- ) ;
1183+ lint. span_suggestion (
1184+ span,
1185+ "use fully-qualified syntax" ,
1186+ format ! ( "<{} as {}>::{}" , qself_ty, tcx. item_name( trait_did) , assoc_ident) ,
1187+ Applicability :: MachineApplicable ,
1188+ ) ;
1189+ } ) ;
11951190 }
11961191 Ok ( ( ty, DefKind :: AssocTy , assoc_ty_did) )
11971192 }
0 commit comments