Skip to content

Commit f0cdee4

Browse files
committed
Auto merge of #11903 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents d166fab + 9d36c18 commit f0cdee4

File tree

180 files changed

+257
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+257
-242
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ toml = "0.7.3"
3737
walkdir = "2.3"
3838
# This is used by the `collect-metadata` alias.
3939
filetime = "0.2"
40-
itertools = "0.10.1"
40+
itertools = "0.11"
4141

4242
# UI test dependencies
4343
clippy_utils = { path = "clippy_utils" }

clippy_dev/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
aho-corasick = "0.7"
88
clap = "4.1.4"
99
indoc = "1.0"
10-
itertools = "0.10.1"
10+
itertools = "0.11"
1111
opener = "0.5"
1212
shell-escape = "0.1"
1313
walkdir = "2.3"

clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cargo_metadata = "0.15.3"
1414
clippy_config = { path = "../clippy_config" }
1515
clippy_utils = { path = "../clippy_utils" }
1616
declare_clippy_lint = { path = "../declare_clippy_lint" }
17-
itertools = "0.10.1"
17+
itertools = "0.11"
1818
quine-mc_cluskey = "0.2"
1919
regex-syntax = "0.7"
2020
serde = { version = "1.0", features = ["derive"] }

clippy_lints/src/booleans.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
424424
improvements.push(suggestion);
425425
}
426426
}
427-
let nonminimal_bool_lint = |suggestions: Vec<_>| {
427+
let nonminimal_bool_lint = |mut suggestions: Vec<_>| {
428428
if self.cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, e.hir_id).0 != Level::Allow {
429+
suggestions.sort();
429430
span_lint_hir_and_then(
430431
self.cx,
431432
NONMINIMAL_BOOL,

clippy_lints/src/dereference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ impl TyCoercionStability {
771771
DefinedTy::Mir(ty) => Self::for_mir_ty(
772772
cx.tcx,
773773
ty.param_env,
774-
cx.tcx.erase_late_bound_regions(ty.value),
774+
cx.tcx.instantiate_bound_regions_with_erased(ty.value),
775775
for_return,
776776
),
777777
}

clippy_lints/src/derive.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn check_hash_peq<'tcx>(
255255
"you are deriving `Hash` but have implemented `PartialEq` explicitly",
256256
|diag| {
257257
if let Some(local_def_id) = impl_id.as_local() {
258-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
258+
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
259259
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialEq` implemented here");
260260
}
261261
},
@@ -299,7 +299,7 @@ fn check_ord_partial_ord<'tcx>(
299299

300300
span_lint_and_then(cx, DERIVE_ORD_XOR_PARTIAL_ORD, span, mess, |diag| {
301301
if let Some(local_def_id) = impl_id.as_local() {
302-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
302+
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
303303
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialOrd` implemented here");
304304
}
305305
});
@@ -381,7 +381,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
381381
&& match_def_path(cx, trait_def_id, &paths::SERDE_DESERIALIZE)
382382
&& let ty::Adt(def, _) = ty.kind()
383383
&& let Some(local_def_id) = def.did().as_local()
384-
&& let adt_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id)
384+
&& let adt_hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id)
385385
&& !is_lint_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id)
386386
&& cx
387387
.tcx

clippy_lints/src/equatable_if_let.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ fn unary_pattern(pat: &Pat<'_>) -> bool {
4646
pats.iter().all(unary_pattern)
4747
}
4848
match &pat.kind {
49-
PatKind::Slice(_, _, _) | PatKind::Range(_, _, _) | PatKind::Binding(..) | PatKind::Wild | PatKind::Or(_) => {
50-
false
51-
},
49+
PatKind::Slice(_, _, _)
50+
| PatKind::Range(_, _, _)
51+
| PatKind::Binding(..)
52+
| PatKind::Wild
53+
| PatKind::Never
54+
| PatKind::Or(_) => false,
5255
PatKind::Struct(_, a, etc) => !etc && a.iter().all(|x| unary_pattern(x.pat)),
5356
PatKind::Tuple(a, etc) | PatKind::TupleStruct(_, a, etc) => etc.as_opt_usize().is_none() && array_rec(a),
5457
PatKind::Ref(x, _) | PatKind::Box(x) => unary_pattern(x),

clippy_lints/src/error_impl_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for ErrorImplError {
5858
if let Some(trait_def_id) = imp.of_trait.and_then(|t| t.trait_def_id())
5959
&& error_def_id == trait_def_id
6060
&& let Some(def_id) = path_res(cx, imp.self_ty).opt_def_id().and_then(DefId::as_local)
61-
&& let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id)
61+
&& let hir_id = cx.tcx.local_def_id_to_hir_id(def_id)
6262
&& let Some(ident) = cx.tcx.opt_item_ident(def_id.to_def_id())
6363
&& ident.name == sym::Error
6464
&& is_visible_outside_module(cx, def_id) =>

clippy_lints/src/escape.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
7474
let parent_id = cx
7575
.tcx
7676
.hir()
77-
.get_parent_item(cx.tcx.hir().local_def_id_to_hir_id(fn_def_id))
77+
.get_parent_item(cx.tcx.local_def_id_to_hir_id(fn_def_id))
7878
.def_id;
7979
let parent_node = cx.tcx.hir().find_by_def_id(parent_id);
8080

clippy_lints/src/excessive_bools.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
171171
span: Span,
172172
def_id: LocalDefId,
173173
) {
174-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
174+
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
175175
if let Some(fn_header) = fn_kind.header()
176176
&& fn_header.abi == Abi::Rust
177177
&& get_parent_as_impl(cx.tcx, hir_id).map_or(true, |impl_item| impl_item.of_trait.is_none())

clippy_lints/src/formatting.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_note};
22
use clippy_utils::is_span_if;
33
use clippy_utils::source::snippet_opt;
4-
use rustc_ast::ast::{BinOpKind, Block, Expr, ExprKind, StmtKind, UnOp};
4+
use rustc_ast::ast::{BinOpKind, Block, Expr, ExprKind, StmtKind};
55
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
66
use rustc_middle::lint::in_external_macro;
77
use rustc_session::declare_lint_pass;
@@ -144,7 +144,7 @@ fn check_assign(cx: &EarlyContext<'_>, expr: &Expr) {
144144
let eq_span = lhs.span.between(rhs.span);
145145
if let ExprKind::Unary(op, ref sub_rhs) = rhs.kind {
146146
if let Some(eq_snippet) = snippet_opt(cx, eq_span) {
147-
let op = UnOp::to_string(op);
147+
let op = op.as_str();
148148
let eqop_span = lhs.span.between(sub_rhs.span);
149149
if eq_snippet.ends_with('=') {
150150
span_lint_and_note(
@@ -177,11 +177,11 @@ fn check_unop(cx: &EarlyContext<'_>, expr: &Expr) {
177177
&& let unop_operand_span = rhs.span.until(un_rhs.span)
178178
&& let Some(binop_snippet) = snippet_opt(cx, binop_span)
179179
&& let Some(unop_operand_snippet) = snippet_opt(cx, unop_operand_span)
180-
&& let binop_str = BinOpKind::to_string(&binop.node)
180+
&& let binop_str = binop.node.as_str()
181181
// no space after BinOp operator and space after UnOp operator
182182
&& binop_snippet.ends_with(binop_str) && unop_operand_snippet.ends_with(' ')
183183
{
184-
let unop_str = UnOp::to_string(op);
184+
let unop_str = op.as_str();
185185
let eqop_span = lhs.span.between(un_rhs.span);
186186
span_lint_and_help(
187187
cx,

clippy_lints/src/functions/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
407407
span: Span,
408408
def_id: LocalDefId,
409409
) {
410-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
410+
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
411411
too_many_arguments::check_fn(cx, kind, decl, span, hir_id, self.too_many_arguments_threshold);
412412
too_many_lines::check_fn(cx, kind, span, body, self.too_many_lines_threshold);
413413
not_unsafe_ptr_arg_deref::check_fn(cx, kind, decl, body, def_id);

clippy_lints/src/functions/result.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn result_err_ty<'tcx>(
2323
&& let hir::FnRetTy::Return(hir_ty) = decl.output
2424
&& let ty = cx
2525
.tcx
26-
.erase_late_bound_regions(cx.tcx.fn_sig(id).instantiate_identity().output())
26+
.instantiate_bound_regions_with_erased(cx.tcx.fn_sig(id).instantiate_identity().output())
2727
&& is_type_diagnostic_item(cx, ty, sym::Result)
2828
&& let ty::Adt(_, args) = ty.kind()
2929
{

clippy_lints/src/future_not_send.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6262
if let FnKind::Closure = kind {
6363
return;
6464
}
65-
let ret_ty = return_ty(cx, cx.tcx.hir().local_def_id_to_hir_id(fn_def_id).expect_owner());
65+
let ret_ty = return_ty(cx, cx.tcx.local_def_id_to_hir_id(fn_def_id).expect_owner());
6666
if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind() {
6767
let preds = cx.tcx.explicit_item_bounds(def_id);
6868
let mut is_future = false;

clippy_lints/src/inherent_impl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
6363
&& !is_lint_allowed(
6464
cx,
6565
MULTIPLE_INHERENT_IMPL,
66-
cx.tcx.hir().local_def_id_to_hir_id(id),
66+
cx.tcx.local_def_id_to_hir_id(id),
6767
)
6868
}) {
6969
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
@@ -117,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
117117

118118
/// Gets the span for the given impl block unless it's not being considered by the lint.
119119
fn get_impl_span(cx: &LateContext<'_>, id: LocalDefId) -> Option<Span> {
120-
let id = cx.tcx.hir().local_def_id_to_hir_id(id);
120+
let id = cx.tcx.local_def_id_to_hir_id(id);
121121
if let Node::Item(&Item {
122122
kind: ItemKind::Impl(impl_item),
123123
span,

clippy_lints/src/iter_not_returning_iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn check_sig(cx: &LateContext<'_>, name: &str, sig: &FnSig<'_>, fn_id: LocalDefI
7171
if sig.decl.implicit_self.has_implicit_self() {
7272
let ret_ty = cx
7373
.tcx
74-
.erase_late_bound_regions(cx.tcx.fn_sig(fn_id).instantiate_identity().output());
74+
.instantiate_bound_regions_with_erased(cx.tcx.fn_sig(fn_id).instantiate_identity().output());
7575
let ret_ty = cx
7676
.tcx
7777
.try_normalize_erasing_regions(cx.param_env, ret_ty)

clippy_lints/src/len_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
142142
&& let TyKind::Path(ty_path) = &imp.self_ty.kind
143143
&& let Some(ty_id) = cx.qpath_res(ty_path, imp.self_ty.hir_id).opt_def_id()
144144
&& let Some(local_id) = ty_id.as_local()
145-
&& let ty_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_id)
145+
&& let ty_hir_id = cx.tcx.local_def_id_to_hir_id(local_id)
146146
&& !is_lint_allowed(cx, LEN_WITHOUT_IS_EMPTY, ty_hir_id)
147147
&& let Some(output) =
148148
parse_len_output(cx, cx.tcx.fn_sig(item.owner_id).instantiate_identity().skip_binder())

clippy_lints/src/manual_non_exhaustive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
188188
.contains(&(enum_id.to_def_id(), variant_id.to_def_id()))
189189
})
190190
{
191-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(enum_id);
191+
let hir_id = cx.tcx.local_def_id_to_hir_id(enum_id);
192192
span_lint_hir_and_then(
193193
cx,
194194
MANUAL_NON_EXHAUSTIVE,

clippy_lints/src/matches/match_same_arms.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
152152
#[derive(Clone, Copy)]
153153
enum NormalizedPat<'a> {
154154
Wild,
155+
Never,
155156
Struct(Option<DefId>, &'a [(Symbol, Self)]),
156157
Tuple(Option<DefId>, &'a [Self]),
157158
Or(&'a [Self]),
@@ -223,14 +224,15 @@ fn iter_matching_struct_fields<'a>(
223224
Iter(left.iter(), right.iter())
224225
}
225226

226-
#[expect(clippy::similar_names)]
227+
#[expect(clippy::similar_names, clippy::too_many_lines)]
227228
impl<'a> NormalizedPat<'a> {
228229
fn from_pat(cx: &LateContext<'_>, arena: &'a DroplessArena, pat: &'a Pat<'_>) -> Self {
229230
match pat.kind {
230231
PatKind::Wild | PatKind::Binding(.., None) => Self::Wild,
231232
PatKind::Binding(.., Some(pat)) | PatKind::Box(pat) | PatKind::Ref(pat, _) => {
232233
Self::from_pat(cx, arena, pat)
233234
},
235+
PatKind::Never => Self::Never,
234236
PatKind::Struct(ref path, fields, _) => {
235237
let fields =
236238
arena.alloc_from_iter(fields.iter().map(|f| (f.ident.name, Self::from_pat(cx, arena, f.pat))));
@@ -334,7 +336,7 @@ impl<'a> NormalizedPat<'a> {
334336
/// type.
335337
fn has_overlapping_values(&self, other: &Self) -> bool {
336338
match (*self, *other) {
337-
(Self::Wild, _) | (_, Self::Wild) => true,
339+
(Self::Wild, _) | (_, Self::Wild) | (Self::Never, Self::Never) => true,
338340
(Self::Or(pats), ref other) | (ref other, Self::Or(pats)) => {
339341
pats.iter().any(|pat| pat.has_overlapping_values(other))
340342
},

clippy_lints/src/methods/clone_on_copy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub(super) fn check(
6161
// ? is a Call, makes sure not to rec *x?, but rather (*x)?
6262
ExprKind::Call(hir_callee, _) => matches!(
6363
hir_callee.kind,
64-
ExprKind::Path(QPath::LangItem(rustc_hir::LangItem::TryTraitBranch, _, _))
64+
ExprKind::Path(QPath::LangItem(rustc_hir::LangItem::TryTraitBranch, ..))
6565
),
6666
ExprKind::MethodCall(_, self_arg, ..) if expr.hir_id == self_arg.hir_id => true,
6767
ExprKind::Match(_, _, MatchSource::TryDesugar(_) | MatchSource::AwaitDesugar)

clippy_lints/src/methods/filter_map_bool_then.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, arg: &
2727
closure.def_id.to_def_id(),
2828
Binder::bind_with_vars(
2929
cx.typeck_results().node_type(param_ty.hir_id),
30-
cx.tcx.late_bound_vars(cx.tcx.hir().local_def_id_to_hir_id(closure.def_id)),
30+
cx.tcx.late_bound_vars(cx.tcx.local_def_id_to_hir_id(closure.def_id)),
3131
),
3232
)
3333
&& is_copy(cx, param_ty)

clippy_lints/src/methods/map_flatten.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn is_map_to_option(cx: &LateContext<'_>, map_arg: &Expr<'_>) -> bool {
6363
ty::Closure(_, args) => args.as_closure().sig(),
6464
_ => map_closure_ty.fn_sig(cx.tcx),
6565
};
66-
let map_closure_return_ty = cx.tcx.erase_late_bound_regions(map_closure_sig.output());
66+
let map_closure_return_ty = cx.tcx.instantiate_bound_regions_with_erased(map_closure_sig.output());
6767
is_type_diagnostic_item(cx, map_closure_return_ty, sym::Option)
6868
},
6969
_ => false,

clippy_lints/src/methods/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3969,7 +3969,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
39693969
let implements_trait = matches!(item.kind, hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }));
39703970
if let hir::ImplItemKind::Fn(ref sig, id) = impl_item.kind {
39713971
let method_sig = cx.tcx.fn_sig(impl_item.owner_id).instantiate_identity();
3972-
let method_sig = cx.tcx.erase_late_bound_regions(method_sig);
3972+
let method_sig = cx.tcx.instantiate_bound_regions_with_erased(method_sig);
39733973
let first_arg_ty_opt = method_sig.inputs().iter().next().copied();
39743974
// if this impl block implements a trait, lint in trait definition instead
39753975
if !implements_trait && cx.effective_visibilities.is_exported(impl_item.owner_id.def_id) {

clippy_lints/src/methods/needless_collect.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ fn is_contains_sig(cx: &LateContext<'_>, call_id: HirId, iter_expr: &Expr<'_>) -
225225
&& let sig = cx.tcx.fn_sig(id).instantiate_identity()
226226
&& sig.skip_binder().output().is_bool()
227227
&& let [_, search_ty] = *sig.skip_binder().inputs()
228-
&& let ty::Ref(_, search_ty, Mutability::Not) = *cx.tcx.erase_late_bound_regions(sig.rebind(search_ty)).kind()
228+
&& let ty::Ref(_, search_ty, Mutability::Not) = *cx
229+
.tcx
230+
.instantiate_bound_regions_with_erased(sig.rebind(search_ty))
231+
.kind()
229232
&& let Some(iter_trait) = cx.tcx.get_diagnostic_item(sym::Iterator)
230233
&& let Some(iter_item) = cx.tcx.associated_items(iter_trait).find_by_name_and_kind(
231234
cx.tcx,

clippy_lints/src/missing_const_for_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn {
131131
FnKind::Closure => return,
132132
}
133133

134-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
134+
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
135135

136136
// Const fns are not allowed as methods in a trait.
137137
{

clippy_lints/src/mixed_read_write_in_expression.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
165165
match typ.kind() {
166166
ty::FnDef(..) | ty::FnPtr(_) => {
167167
let sig = typ.fn_sig(self.cx.tcx);
168-
if self.cx.tcx.erase_late_bound_regions(sig).output().kind() == &ty::Never {
168+
if self.cx.tcx.instantiate_bound_regions_with_erased(sig).output().kind() == &ty::Never {
169169
self.report_diverging_sub_expr(e);
170170
}
171171
},

clippy_lints/src/mut_key.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ impl MutableKeyType {
143143
for (hir_ty, ty) in iter::zip(decl.inputs, fn_sig.inputs().skip_binder()) {
144144
self.check_ty_(cx, hir_ty.span, *ty);
145145
}
146-
self.check_ty_(cx, decl.output.span(), cx.tcx.erase_late_bound_regions(fn_sig.output()));
146+
self.check_ty_(
147+
cx,
148+
decl.output.span(),
149+
cx.tcx.instantiate_bound_regions_with_erased(fn_sig.output()),
150+
);
147151
}
148152

149153
// We want to lint 1. sets or maps with 2. not immutable key types and 3. no unerased

clippy_lints/src/needless_pass_by_ref_mut.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
137137
return;
138138
}
139139

140-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(fn_def_id);
140+
let hir_id = cx.tcx.local_def_id_to_hir_id(fn_def_id);
141141
let is_async = match kind {
142142
FnKind::ItemFn(.., header) => {
143143
if header.is_unsafe() {
@@ -256,7 +256,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
256256
span_lint_hir_and_then(
257257
cx,
258258
NEEDLESS_PASS_BY_REF_MUT,
259-
cx.tcx.hir().local_def_id_to_hir_id(*fn_def_id),
259+
cx.tcx.local_def_id_to_hir_id(*fn_def_id),
260260
sp,
261261
"this argument is a mutable reference, but not used mutably",
262262
|diag| {

clippy_lints/src/needless_pass_by_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
8686
return;
8787
}
8888

89-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(fn_def_id);
89+
let hir_id = cx.tcx.local_def_id_to_hir_id(fn_def_id);
9090

9191
match kind {
9292
FnKind::ItemFn(.., header) => {

clippy_lints/src/new_without_default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
106106
let ty = cx.tcx.type_of(d).instantiate_identity();
107107
if let Some(ty_def) = ty.ty_adt_def() {
108108
if let Some(local_def_id) = ty_def.did().as_local() {
109-
impls.insert(cx.tcx.hir().local_def_id_to_hir_id(local_def_id));
109+
impls.insert(cx.tcx.local_def_id_to_hir_id(local_def_id));
110110
}
111111
}
112112
});
@@ -119,7 +119,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
119119
&& let self_def = cx.tcx.type_of(self_def_id).instantiate_identity()
120120
&& let Some(self_def) = self_def.ty_adt_def()
121121
&& let Some(self_local_did) = self_def.did().as_local()
122-
&& let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_local_did)
122+
&& let self_id = cx.tcx.local_def_id_to_hir_id(self_local_did)
123123
&& impling_types.contains(&self_id)
124124
{
125125
return;

clippy_lints/src/non_send_fields_in_send_ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSendFieldInSendTy {
100100
if let Some(field_hir_id) = field
101101
.did
102102
.as_local()
103-
.map(|local_def_id| hir_map.local_def_id_to_hir_id(local_def_id))
103+
.map(|local_def_id| cx.tcx.local_def_id_to_hir_id(local_def_id))
104104
&& !is_lint_allowed(cx, NON_SEND_FIELDS_IN_SEND_TY, field_hir_id)
105105
&& let field_ty = field.ty(cx.tcx, impl_trait_args)
106106
&& !ty_allowed_in_send(cx, field_ty, send_trait)

0 commit comments

Comments
 (0)