Skip to content

Commit a859e5c

Browse files
committed
Auto merge of #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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 6 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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)

0 commit comments

Comments
 (0)