Skip to content

Commit 0ff61e7

Browse files
committed
fix review
1 parent c86fcd0 commit 0ff61e7

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

clippy_lints/src/disallowed_methods.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use clippy_utils::disallowed_profiles::{ProfileEntry, ProfileResolver};
55
use clippy_utils::paths::PathNS;
66
use clippy_utils::sym;
77
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
8+
use rustc_data_structures::smallvec::SmallVec;
89
use rustc_hir::def::{CtorKind, DefKind, Res};
910
use rustc_hir::def_id::DefIdMap;
1011
use rustc_hir::{Expr, ExprKind};
1112
use rustc_lint::{LateContext, LateLintPass};
1213
use rustc_middle::ty::TyCtxt;
1314
use rustc_session::impl_lint_pass;
1415
use rustc_span::{Span, Symbol};
15-
use smallvec::SmallVec;
1616

1717
declare_clippy_lint! {
1818
/// ### What it does
@@ -204,20 +204,22 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedMethods {
204204
.get(symbol)
205205
.and_then(|map| map.get(&id).map(|info| (*symbol, info)))
206206
}) {
207+
let diag_amendment = disallowed_path.diag_amendment(span);
207208
span_lint_and_then(
208209
cx,
209210
DISALLOWED_METHODS,
210211
span,
211212
format!("use of a disallowed method `{path}` (profile: {profile})"),
212-
disallowed_path.diag_amendment(span),
213+
|diag| diag_amendment(diag),
213214
);
214215
} else if let Some(&(path, disallowed_path)) = self.default.get(&id) {
216+
let diag_amendment = disallowed_path.diag_amendment(span);
215217
span_lint_and_then(
216218
cx,
217219
DISALLOWED_METHODS,
218220
span,
219221
format!("use of a disallowed method `{path}`"),
220-
disallowed_path.diag_amendment(span),
222+
|diag| diag_amendment(diag),
221223
);
222224
}
223225
}

clippy_lints/src/disallowed_types.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use clippy_utils::disallowed_profiles::{ProfileEntry, ProfileResolver};
55
use clippy_utils::paths::PathNS;
66
use clippy_utils::sym;
77
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
8+
use rustc_data_structures::smallvec::SmallVec;
89
use rustc_hir::def::{DefKind, Res};
910
use rustc_hir::def_id::DefIdMap;
1011
use rustc_hir::{AmbigArg, Item, ItemKind, PolyTraitRef, PrimTy, Ty, TyKind, UseKind};
1112
use rustc_lint::{LateContext, LateLintPass};
1213
use rustc_middle::ty::TyCtxt;
1314
use rustc_session::impl_lint_pass;
1415
use rustc_span::{Span, Symbol};
15-
use smallvec::SmallVec;
1616

1717
declare_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
}

clippy_utils/src/disallowed_profiles.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::sym;
22
use rustc_ast::ast::{LitKind, MetaItemInner};
33
use rustc_data_structures::fx::FxHashMap;
4+
use rustc_data_structures::smallvec::SmallVec;
45
use rustc_hir::{Attribute, HirId};
56
use rustc_lint::LateContext;
67
use rustc_span::{Span, Symbol};
7-
use smallvec::SmallVec;
88

99
#[derive(Clone)]
1010
pub struct ProfileEntry {

0 commit comments

Comments
 (0)