Skip to content

Commit 392b0c5

Browse files
committed
Auto merge of #8057 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 8ad56c8 + ec57cc1 commit 392b0c5

File tree

10 files changed

+13
-16
lines changed

10 files changed

+13
-16
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.58"
3+
version = "0.1.59"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.58"
3+
version = "0.1.59"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/derive.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use clippy_utils::paths;
33
use clippy_utils::ty::{implements_trait, is_copy};
44
use clippy_utils::{get_trait_def_id, is_automatically_derived, is_lint_allowed, match_def_path};
55
use if_chain::if_chain;
6-
use rustc_hir::def_id::DefId;
76
use rustc_hir::intravisit::{walk_expr, walk_fn, walk_item, FnKind, NestedVisitorMap, Visitor};
87
use rustc_hir::{
98
BlockCheckMode, BodyId, Expr, ExprKind, FnDecl, HirId, Impl, Item, ItemKind, TraitRef, UnsafeSource, Unsafety,
@@ -347,11 +346,6 @@ fn check_unsafe_derive_deserialize<'tcx>(
347346
trait_ref: &TraitRef<'_>,
348347
ty: Ty<'tcx>,
349348
) {
350-
fn item_from_def_id<'tcx>(cx: &LateContext<'tcx>, def_id: DefId) -> &'tcx Item<'tcx> {
351-
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
352-
cx.tcx.hir().expect_item(hir_id)
353-
}
354-
355349
fn has_unsafe<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>) -> bool {
356350
let mut visitor = UnsafeVisitor { cx, has_unsafe: false };
357351
walk_item(&mut visitor, item);
@@ -367,7 +361,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
367361
if !is_lint_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id);
368362
if cx.tcx.inherent_impls(def.did)
369363
.iter()
370-
.map(|imp_did| item_from_def_id(cx, *imp_did))
364+
.map(|imp_did| cx.tcx.hir().expect_item(imp_did.expect_local()))
371365
.any(|imp| has_unsafe(cx, imp));
372366
then {
373367
span_lint_and_help(

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
20272027
return;
20282028
}
20292029
let name = impl_item.ident.name.as_str();
2030-
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
2030+
let parent = cx.tcx.hir().get_parent_did(impl_item.hir_id());
20312031
let item = cx.tcx.hir().expect_item(parent);
20322032
let self_ty = cx.tcx.type_of(item.def_id);
20332033

clippy_lints/src/non_copy_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
281281

282282
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx ImplItem<'_>) {
283283
if let ImplItemKind::Const(hir_ty, body_id) = &impl_item.kind {
284-
let item_hir_id = cx.tcx.hir().get_parent_node(impl_item.hir_id());
285-
let item = cx.tcx.hir().expect_item(item_hir_id);
284+
let item_def_id = cx.tcx.hir().get_parent_did(impl_item.hir_id());
285+
let item = cx.tcx.hir().expect_item(item_def_id);
286286

287287
match &item.kind {
288288
ItemKind::Impl(Impl {

clippy_lints/src/self_named_constructors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructors {
5151
_ => return,
5252
}
5353

54-
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
54+
let parent = cx.tcx.hir().get_parent_did(impl_item.hir_id());
5555
let item = cx.tcx.hir().expect_item(parent);
5656
let self_ty = cx.tcx.type_of(item.def_id);
5757
let ret_ty = return_ty(cx, impl_item.hir_id());

clippy_lints/src/unused_self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedSelf {
4242
if impl_item.span.from_expansion() {
4343
return;
4444
}
45-
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
45+
let parent = cx.tcx.hir().get_parent_did(impl_item.hir_id());
4646
let parent_item = cx.tcx.hir().expect_item(parent);
4747
let assoc_item = cx.tcx.associated_item(impl_item.def_id);
4848
if_chain! {

clippy_utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_utils"
3-
version = "0.1.58"
3+
version = "0.1.59"
44
edition = "2021"
55
publish = false
66

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2021-11-23"
2+
channel = "nightly-2021-12-02"
33
components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]

tests/ui/crashes/ice-6250.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ LL | | }
2424
error[E0308]: mismatched types
2525
--> $DIR/ice-6250.rs:12:14
2626
|
27+
LL | for reference in vec![1, 2, 3] {
28+
| --------- expected due to the type of this binding
29+
...
2730
LL | Some(reference) = cache.data.get(key) {
2831
| ^^^^^^^^^ expected integer, found `&i32`
2932
|

0 commit comments

Comments
 (0)