@@ -5,14 +5,14 @@ use clippy_utils::disallowed_profiles::{ProfileEntry, ProfileResolver};
55use clippy_utils:: paths:: PathNS ;
66use clippy_utils:: sym;
77use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
8+ use rustc_data_structures:: smallvec:: SmallVec ;
89use rustc_hir:: def:: { DefKind , Res } ;
910use rustc_hir:: def_id:: DefIdMap ;
1011use rustc_hir:: { AmbigArg , Item , ItemKind , PolyTraitRef , PrimTy , Ty , TyKind , UseKind } ;
1112use rustc_lint:: { LateContext , LateLintPass } ;
1213use rustc_middle:: ty:: TyCtxt ;
1314use rustc_session:: impl_lint_pass;
1415use rustc_span:: { Span , Symbol } ;
15- use smallvec:: SmallVec ;
1616
1717declare_clippy_lint ! {
1818 /// ### What it does
@@ -179,20 +179,22 @@ impl DisallowedTypes {
179179 . get ( symbol)
180180 . and_then ( |lookup| lookup. find ( res) . map ( |info| ( * symbol, info) ) )
181181 } ) {
182+ let diag_amendment = disallowed_path. diag_amendment ( span) ;
182183 span_lint_and_then (
183184 cx,
184185 DISALLOWED_TYPES ,
185186 span,
186187 format ! ( "use of a disallowed type `{path}` (profile: {profile})" ) ,
187- disallowed_path . diag_amendment ( span ) ,
188+ |diag| diag_amendment ( diag ) ,
188189 ) ;
189190 } else if let Some ( ( path, disallowed_path) ) = self . default . find ( res) {
191+ let diag_amendment = disallowed_path. diag_amendment ( span) ;
190192 span_lint_and_then (
191193 cx,
192194 DISALLOWED_TYPES ,
193195 span,
194196 format ! ( "use of a disallowed type `{path}`" ) ,
195- disallowed_path . diag_amendment ( span ) ,
197+ |diag| diag_amendment ( diag ) ,
196198 ) ;
197199 }
198200 }
0 commit comments