Skip to content

Commit a859e5c

Browse files
committed
Auto merge of rust-lang#11971 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 29bdc8b + 71f48ee commit a859e5c

Some content is hidden

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

65 files changed

+251
-367
lines changed

clippy_lints/src/absolute_paths.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl LateLintPass<'_> for AbsolutePaths {
6262
} = self;
6363

6464
if !path.span.from_expansion()
65-
&& let Some(node) = cx.tcx.hir().find(hir_id)
65+
&& let Some(node) = cx.tcx.opt_hir_node(hir_id)
6666
&& !matches!(node, Node::Item(item) if matches!(item.kind, ItemKind::Use(_, _)))
6767
&& let [first, rest @ ..] = path.segments
6868
// Handle `::std`

clippy_lints/src/casts/as_ptr_cast_mut.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ use rustc_middle::ty::{self, Ty, TypeAndMut};
99
use super::AS_PTR_CAST_MUT;
1010

1111
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>, cast_to: Ty<'_>) {
12-
if let ty::RawPtr(
13-
ptrty @ TypeAndMut {
14-
mutbl: Mutability::Mut, ..
15-
},
16-
) = cast_to.kind()
12+
if let ty::RawPtr(TypeAndMut {
13+
mutbl: Mutability::Mut,
14+
ty: ptrty,
15+
}) = cast_to.kind()
1716
&& let ty::RawPtr(TypeAndMut {
1817
mutbl: Mutability::Not, ..
1918
}) = cx.typeck_results().node_type(cast_expr.hir_id).kind()
@@ -34,7 +33,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
3433
cx,
3534
AS_PTR_CAST_MUT,
3635
expr.span,
37-
&format!("casting the result of `as_ptr` to *{ptrty}"),
36+
&format!("casting the result of `as_ptr` to *mut {ptrty}"),
3837
"replace with",
3938
format!("{recv}.as_mut_ptr()"),
4039
applicability,

clippy_lints/src/casts/cast_slice_different_sizes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: &Msrv
6969
fn is_child_of_cast(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
7070
let map = cx.tcx.hir();
7171
if let Some(parent_id) = map.opt_parent_id(expr.hir_id)
72-
&& let Some(parent) = map.find(parent_id)
72+
&& let Some(parent) = cx.tcx.opt_hir_node(parent_id)
7373
{
7474
let expr = match parent {
7575
Node::Block(block) => {

clippy_lints/src/crate_in_macro_def.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn contains_unhygienic_crate_reference(tts: &TokenStream) -> Option<Span> {
9292
{
9393
return Some(span);
9494
}
95-
if let TokenTree::Delimited(_, _, tts) = &curr {
95+
if let TokenTree::Delimited(.., tts) = &curr {
9696
let span = contains_unhygienic_crate_reference(tts);
9797
if span.is_some() {
9898
return span;

clippy_lints/src/declared_lints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
688688
crate::unit_types::UNIT_ARG_INFO,
689689
crate::unit_types::UNIT_CMP_INFO,
690690
crate::unnamed_address::FN_ADDRESS_COMPARISONS_INFO,
691-
crate::unnamed_address::VTABLE_ADDRESS_COMPARISONS_INFO,
692691
crate::unnecessary_box_returns::UNNECESSARY_BOX_RETURNS_INFO,
693692
crate::unnecessary_map_on_constructor::UNNECESSARY_MAP_ON_CONSTRUCTOR_INFO,
694693
crate::unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS_INFO,

clippy_lints/src/dereference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ fn report<'tcx>(
10901090
if parent_id == data.first_expr.hir_id {
10911091
return;
10921092
}
1093-
(cx.tcx.hir().get(parent_id).expect_expr().span, true)
1093+
(cx.tcx.hir_node(parent_id).expect_expr().span, true)
10941094
} else {
10951095
(expr.span, false)
10961096
};

clippy_lints/src/derivable_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
195195
&& let Some(def_id) = trait_ref.trait_def_id()
196196
&& cx.tcx.is_diagnostic_item(sym::Default, def_id)
197197
&& let impl_item_hir = child.id.hir_id()
198-
&& let Some(Node::ImplItem(impl_item)) = cx.tcx.hir().find(impl_item_hir)
198+
&& let Some(Node::ImplItem(impl_item)) = cx.tcx.opt_hir_node(impl_item_hir)
199199
&& let ImplItemKind::Fn(_, b) = &impl_item.kind
200200
&& let Body { value: func_expr, .. } = cx.tcx.hir().body(*b)
201201
&& let &Adt(adt_def, args) = cx.tcx.type_of(item.owner_id).instantiate_identity().kind()

clippy_lints/src/derive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,12 @@ fn check_partial_eq_without_eq<'tcx>(cx: &LateContext<'tcx>, span: Span, trait_r
450450
&& let Some(def_id) = trait_ref.trait_def_id()
451451
&& cx.tcx.is_diagnostic_item(sym::PartialEq, def_id)
452452
&& let param_env = param_env_for_derived_eq(cx.tcx, adt.did(), eq_trait_def_id)
453-
&& !implements_trait_with_env(cx.tcx, param_env, ty, eq_trait_def_id, &[])
453+
&& !implements_trait_with_env(cx.tcx, param_env, ty, eq_trait_def_id, adt.did(),&[])
454454
// If all of our fields implement `Eq`, we can implement `Eq` too
455455
&& adt
456456
.all_fields()
457457
.map(|f| f.ty(cx.tcx, args))
458-
.all(|ty| implements_trait_with_env(cx.tcx, param_env, ty, eq_trait_def_id, &[]))
458+
.all(|ty| implements_trait_with_env(cx.tcx, param_env, ty, eq_trait_def_id, adt.did(), &[]))
459459
{
460460
span_lint_and_sugg(
461461
cx,

clippy_lints/src/doc/needless_doctest_main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{io, thread};
33

44
use crate::doc::{NEEDLESS_DOCTEST_MAIN, TEST_ATTR_IN_DOCTEST};
55
use clippy_utils::diagnostics::span_lint;
6-
use rustc_ast::{Async, Fn, FnRetTy, Item, ItemKind};
6+
use rustc_ast::{CoroutineKind, Fn, FnRetTy, Item, ItemKind};
77
use rustc_data_structures::sync::Lrc;
88
use rustc_errors::emitter::EmitterWriter;
99
use rustc_errors::Handler;
@@ -69,7 +69,7 @@ pub fn check(
6969
if !ignore {
7070
get_test_spans(&item, &mut test_attr_spans);
7171
}
72-
let is_async = matches!(sig.header.asyncness, Async::Yes { .. });
72+
let is_async = matches!(sig.header.coroutine_kind, Some(CoroutineKind::Async { .. }));
7373
let returns_nothing = match &sig.decl.output {
7474
FnRetTy::Default(..) => true,
7575
FnRetTy::Ty(ty) if ty.kind.is_unit() => true,

clippy_lints/src/empty_drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl LateLintPass<'_> for EmptyDrop {
4242
}) = item.kind
4343
&& trait_ref.trait_def_id() == cx.tcx.lang_items().drop_trait()
4444
&& let impl_item_hir = child.id.hir_id()
45-
&& let Some(Node::ImplItem(impl_item)) = cx.tcx.hir().find(impl_item_hir)
45+
&& let Some(Node::ImplItem(impl_item)) = cx.tcx.opt_hir_node(impl_item_hir)
4646
&& let ImplItemKind::Fn(_, b) = &impl_item.kind
4747
&& let Body { value: func_expr, .. } = cx.tcx.hir().body(*b)
4848
&& let func_expr = peel_blocks(func_expr)

clippy_lints/src/escape.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use clippy_utils::diagnostics::span_lint_hir;
2-
use rustc_hir::{self, intravisit, AssocItemKind, Body, FnDecl, HirId, HirIdSet, Impl, ItemKind, Node, Pat, PatKind};
2+
use rustc_hir::{intravisit, AssocItemKind, Body, FnDecl, HirId, HirIdSet, Impl, ItemKind, Node, Pat, PatKind};
33
use rustc_hir_typeck::expr_use_visitor::{Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
44
use rustc_infer::infer::TyCtxtInferExt;
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::mir::FakeReadCause;
77
use rustc_middle::ty::layout::LayoutOf;
8-
use rustc_middle::ty::{self, TraitRef, Ty};
8+
use rustc_middle::ty::{self, TraitRef, Ty, TyCtxt};
99
use rustc_session::impl_lint_pass;
1010
use rustc_span::def_id::LocalDefId;
1111
use rustc_span::symbol::kw;
@@ -76,7 +76,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
7676
.hir()
7777
.get_parent_item(cx.tcx.local_def_id_to_hir_id(fn_def_id))
7878
.def_id;
79-
let parent_node = cx.tcx.hir().find_by_def_id(parent_id);
79+
let parent_node = cx.tcx.opt_hir_node_by_def_id(parent_id);
8080

8181
let mut trait_self_ty = None;
8282
if let Some(Node::Item(item)) = parent_node {
@@ -122,16 +122,16 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
122122
}
123123

124124
// TODO: Replace with Map::is_argument(..) when it's fixed
125-
fn is_argument(map: rustc_middle::hir::map::Map<'_>, id: HirId) -> bool {
126-
match map.find(id) {
125+
fn is_argument(tcx: TyCtxt<'_>, id: HirId) -> bool {
126+
match tcx.opt_hir_node(id) {
127127
Some(Node::Pat(Pat {
128128
kind: PatKind::Binding(..),
129129
..
130130
})) => (),
131131
_ => return false,
132132
}
133133

134-
matches!(map.find_parent(id), Some(Node::Param(_)))
134+
matches!(tcx.hir().find_parent(id), Some(Node::Param(_)))
135135
}
136136

137137
impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
@@ -154,7 +154,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
154154
fn mutate(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) {
155155
if cmt.place.projections.is_empty() {
156156
let map = &self.cx.tcx.hir();
157-
if is_argument(*map, cmt.hir_id) {
157+
if is_argument(self.cx.tcx, cmt.hir_id) {
158158
// Skip closure arguments
159159
let parent_id = map.parent_id(cmt.hir_id);
160160
if let Some(Node::Expr(..)) = map.find_parent(parent_id) {

clippy_lints/src/exit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<'tcx> LateLintPass<'tcx> for Exit {
4646
&& let Some(def_id) = cx.qpath_res(path, path_expr.hir_id).opt_def_id()
4747
&& cx.tcx.is_diagnostic_item(sym::process_exit, def_id)
4848
&& let parent = cx.tcx.hir().get_parent_item(e.hir_id).def_id
49-
&& let Some(Node::Item(Item{kind: ItemKind::Fn(..), ..})) = cx.tcx.hir().find_by_def_id(parent)
49+
&& let Some(Node::Item(Item{kind: ItemKind::Fn(..), ..})) = cx.tcx.opt_hir_node_by_def_id(parent)
5050
// If the next item up is a function we check if it is an entry point
5151
// and only then emit a linter warning
5252
&& !is_entrypoint_fn(cx, parent.to_def_id())

clippy_lints/src/explicit_write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn look_in_block<'tcx, 'hir>(cx: &LateContext<'tcx>, kind: &'tcx ExprKind<'hir>)
111111
// Find id of the local that expr_end_of_block resolves to
112112
&& let ExprKind::Path(QPath::Resolved(None, expr_path)) = expr_end_of_block.kind
113113
&& let Res::Local(expr_res) = expr_path.res
114-
&& let Some(Node::Pat(res_pat)) = cx.tcx.hir().find(expr_res)
114+
&& let Some(Node::Pat(res_pat)) = cx.tcx.opt_hir_node(expr_res)
115115

116116
// Find id of the local we found in the block
117117
&& let PatKind::Binding(BindingAnnotation::NONE, local_hir_id, _ident, None) = local.pat.kind

clippy_lints/src/functions/result.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn check_result_large_err<'tcx>(cx: &LateContext<'tcx>, err_ty: Ty<'tcx>, hir_ty
9292
.expect("already checked this is adt")
9393
.did()
9494
.as_local()
95-
&& let Some(hir::Node::Item(item)) = cx.tcx.hir().find_by_def_id(local_def_id)
95+
&& let Some(hir::Node::Item(item)) = cx.tcx.opt_hir_node_by_def_id(local_def_id)
9696
&& let hir::ItemKind::Enum(ref def, _) = item.kind
9797
{
9898
let variants_size = AdtVariantInfo::new(cx, *adt, subst);

clippy_lints/src/implied_bounds_in_impls.rs

+9
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ fn is_same_generics<'tcx>(
194194
.enumerate()
195195
.skip(1) // skip `Self` implicit arg
196196
.all(|(arg_index, arg)| {
197+
if [
198+
implied_by_generics.host_effect_index,
199+
implied_generics.host_effect_index,
200+
]
201+
.contains(&Some(arg_index))
202+
{
203+
// skip host effect params in determining whether generics are same
204+
return true;
205+
}
197206
if let Some(ty) = arg.as_type() {
198207
if let &ty::Param(ty::ParamTy { index, .. }) = ty.kind()
199208
// `index == 0` means that it's referring to `Self`,

clippy_lints/src/index_refutable_slice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,15 @@ impl<'a, 'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'a, 'tcx> {
248248

249249
// Checking for slice indexing
250250
&& let parent_id = map.parent_id(expr.hir_id)
251-
&& let Some(hir::Node::Expr(parent_expr)) = map.find(parent_id)
251+
&& let Some(hir::Node::Expr(parent_expr)) = cx.tcx.opt_hir_node(parent_id)
252252
&& let hir::ExprKind::Index(_, index_expr, _) = parent_expr.kind
253253
&& let Some(Constant::Int(index_value)) = constant(cx, cx.typeck_results(), index_expr)
254254
&& let Ok(index_value) = index_value.try_into()
255255
&& index_value < max_suggested_slice
256256

257257
// Make sure that this slice index is read only
258258
&& let maybe_addrof_id = map.parent_id(parent_id)
259-
&& let Some(hir::Node::Expr(maybe_addrof_expr)) = map.find(maybe_addrof_id)
259+
&& let Some(hir::Node::Expr(maybe_addrof_expr)) = cx.tcx.opt_hir_node(maybe_addrof_id)
260260
&& let hir::ExprKind::AddrOf(_kind, hir::Mutability::Not, _inner_expr) = maybe_addrof_expr.kind
261261
{
262262
use_info.index_use.push((index_value, map.span(parent_expr.hir_id)));

clippy_lints/src/inherent_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn get_impl_span(cx: &LateContext<'_>, id: LocalDefId) -> Option<Span> {
122122
kind: ItemKind::Impl(impl_item),
123123
span,
124124
..
125-
}) = cx.tcx.hir().get(id)
125+
}) = cx.tcx.hir_node(id)
126126
{
127127
(!span.from_expansion()
128128
&& impl_item.generics.params.is_empty()

clippy_lints/src/len_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
147147
&& let Some(output) =
148148
parse_len_output(cx, cx.tcx.fn_sig(item.owner_id).instantiate_identity().skip_binder())
149149
{
150-
let (name, kind) = match cx.tcx.hir().find(ty_hir_id) {
150+
let (name, kind) = match cx.tcx.opt_hir_node(ty_hir_id) {
151151
Some(Node::ForeignItem(x)) => (x.ident.name, "extern type"),
152152
Some(Node::Item(x)) => match x.kind {
153153
ItemKind::Struct(..) => (x.ident.name, "struct"),

clippy_lints/src/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn check_fn_inner<'tcx>(
195195
.iter()
196196
// In principle, the result of the call to `Node::ident` could be `unwrap`ped, as `DefId` should refer to a
197197
// `Node::GenericParam`.
198-
.filter_map(|&def_id| cx.tcx.hir().get_by_def_id(def_id).ident())
198+
.filter_map(|&def_id| cx.tcx.hir_node_by_def_id(def_id).ident())
199199
.map(|ident| ident.to_string())
200200
.collect::<Vec<_>>()
201201
.join(", ");

clippy_lints/src/loops/explicit_iter_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn is_ref_iterable<'tcx>(
118118
.liberate_late_bound_regions(fn_id, cx.tcx.fn_sig(fn_id).skip_binder())
119119
&& let &[req_self_ty, req_res_ty] = &**sig.inputs_and_output
120120
&& let param_env = cx.tcx.param_env(fn_id)
121-
&& implements_trait_with_env(cx.tcx, param_env, req_self_ty, trait_id, &[])
121+
&& implements_trait_with_env(cx.tcx, param_env, req_self_ty, trait_id, fn_id, &[])
122122
&& let Some(into_iter_ty) =
123123
make_normalized_projection_with_regions(cx.tcx, param_env, trait_id, sym!(IntoIter), [req_self_ty])
124124
&& let req_res_ty = normalize_with_regions(cx.tcx, param_env, req_res_ty)

clippy_lints/src/loops/manual_memcpy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use rustc_lint::LateContext;
1212
use rustc_middle::ty::{self, Ty};
1313
use rustc_span::symbol::sym;
1414
use std::fmt::Display;
15-
use std::iter::Iterator;
1615

1716
/// Checks for `for` loops that sequentially copy items from one slice-like
1817
/// object to another.

clippy_lints/src/loops/mut_range_bound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn mut_warn_with_span(cx: &LateContext<'_>, span: Option<Span>) {
4040

4141
fn check_for_mutability(cx: &LateContext<'_>, bound: &Expr<'_>) -> Option<HirId> {
4242
if let Some(hir_id) = path_to_local(bound)
43-
&& let Node::Pat(pat) = cx.tcx.hir().get(hir_id)
43+
&& let Node::Pat(pat) = cx.tcx.hir_node(hir_id)
4444
&& let PatKind::Binding(BindingAnnotation::MUT, ..) = pat.kind
4545
{
4646
return Some(hir_id);

clippy_lints/src/loops/needless_range_loop.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ use rustc_lint::LateContext;
1313
use rustc_middle::middle::region;
1414
use rustc_middle::ty::{self, Ty};
1515
use rustc_span::symbol::{sym, Symbol};
16-
use std::iter::{self, Iterator};
17-
use std::mem;
16+
use std::{iter, mem};
1817

1918
/// Checks for looping over a range and then indexing a sequence with it.
2019
/// The iteratee must be a range literal.

clippy_lints/src/loops/never_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_errors::Applicability;
88
use rustc_hir::{Block, Destination, Expr, ExprKind, HirId, InlineAsmOperand, Pat, Stmt, StmtKind};
99
use rustc_lint::LateContext;
1010
use rustc_span::{sym, Span};
11-
use std::iter::{once, Iterator};
11+
use std::iter::once;
1212

1313
pub(super) fn check<'tcx>(
1414
cx: &LateContext<'tcx>,

clippy_lints/src/loops/same_item_push.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, Mutability, Nod
1111
use rustc_lint::LateContext;
1212
use rustc_span::symbol::sym;
1313
use rustc_span::SyntaxContext;
14-
use std::iter::Iterator;
1514

1615
/// Detects for loop pushing the same item into a Vec
1716
pub(super) fn check<'tcx>(
@@ -59,12 +58,12 @@ pub(super) fn check<'tcx>(
5958
match cx.qpath_res(qpath, pushed_item.hir_id) {
6059
// immutable bindings that are initialized with literal or constant
6160
Res::Local(hir_id) => {
62-
let node = cx.tcx.hir().get(hir_id);
61+
let node = cx.tcx.hir_node(hir_id);
6362
if let Node::Pat(pat) = node
6463
&& let PatKind::Binding(bind_ann, ..) = pat.kind
6564
&& !matches!(bind_ann, BindingAnnotation(_, Mutability::Mut))
6665
&& let parent_node = cx.tcx.hir().parent_id(hir_id)
67-
&& let Some(Node::Local(parent_let_expr)) = cx.tcx.hir().find(parent_node)
66+
&& let Some(Node::Local(parent_let_expr)) = cx.tcx.opt_hir_node(parent_node)
6867
&& let Some(init) = parent_let_expr.init
6968
{
7069
match init.kind {

clippy_lints/src/loops/utils.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_middle::hir::nested_filter;
99
use rustc_middle::ty::{self, Ty};
1010
use rustc_span::source_map::Spanned;
1111
use rustc_span::symbol::{sym, Symbol};
12-
use std::iter::Iterator;
1312

1413
#[derive(Debug, PartialEq, Eq)]
1514
enum IncrementVisitorVarState {

clippy_lints/src/manual_async_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualAsyncFn {
5858
&& block.stmts.is_empty()
5959
&& let Some(closure_body) = desugared_async_block(cx, block)
6060
&& let Node::Item(Item {vis_span, ..}) | Node::ImplItem(ImplItem {vis_span, ..}) =
61-
cx.tcx.hir().get_by_def_id(def_id)
61+
cx.tcx.hir_node_by_def_id(def_id)
6262
{
6363
let header_span = span.with_hi(ret_ty.span.hi());
6464

clippy_lints/src/manual_rem_euclid.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualRemEuclid {
7676
// Also ensures the const is nonzero since zero can't be a divisor
7777
&& const1 == const2 && const2 == const3
7878
&& let Some(hir_id) = path_to_local(expr3)
79-
&& let Some(Node::Pat(_)) = cx.tcx.hir().find(hir_id)
79+
&& let Some(Node::Pat(_)) = cx.tcx.opt_hir_node(hir_id)
8080
{
8181
// Apply only to params or locals with annotated types
8282
match cx.tcx.hir().find_parent(hir_id) {

clippy_lints/src/methods/filter_next.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub(super) fn check<'tcx>(
4444
// add note if not multi-line
4545
span_lint_and_then(cx, FILTER_NEXT, expr.span, msg, |diag| {
4646
let (applicability, pat) = if let Some(id) = path_to_local(recv)
47-
&& let Some(hir::Node::Pat(pat)) = cx.tcx.hir().find(id)
47+
&& let Some(hir::Node::Pat(pat)) = cx.tcx.opt_hir_node(id)
4848
&& let hir::PatKind::Binding(BindingAnnotation(_, Mutability::Not), _, ident, _) = pat.kind
4949
{
5050
(Applicability::Unspecified, Some((pat.span, ident)))

clippy_lints/src/methods/iter_skip_next.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr
2020
"called `skip(..).next()` on an iterator",
2121
|diag| {
2222
if let Some(id) = path_to_local(recv)
23-
&& let Node::Pat(pat) = cx.tcx.hir().get(id)
23+
&& let Node::Pat(pat) = cx.tcx.hir_node(id)
2424
&& let PatKind::Binding(ann, _, _, _) = pat.kind
2525
&& ann != BindingAnnotation::MUT
2626
{

0 commit comments

Comments
 (0)