Skip to content

Commit 1480cea

Browse files
committed
Auto merge of #10242 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 54e929b + 6f9c70a commit 1480cea

29 files changed

+108
-90
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.68"
3+
version = "0.1.69"
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.68"
3+
version = "0.1.69"
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/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_>, name: Symbol, items: &[NestedMe
472472

473473
fn check_lint_reason(cx: &LateContext<'_>, name: Symbol, items: &[NestedMetaItem], attr: &'_ Attribute) {
474474
// Check for the feature
475-
if !cx.tcx.sess.features_untracked().lint_reasons {
475+
if !cx.tcx.features().lint_reasons {
476476
return;
477477
}
478478

clippy_lints/src/derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ fn check_hash_peq<'tcx>(
251251

252252
// Only care about `impl PartialEq<Foo> for Foo`
253253
// For `impl PartialEq<B> for A, input_types is [A, B]
254-
if trait_ref.substs.type_at(1) == ty {
254+
if trait_ref.subst_identity().substs.type_at(1) == ty {
255255
span_lint_and_then(
256256
cx,
257257
DERIVED_HASH_WITH_MANUAL_EQ,
@@ -299,7 +299,7 @@ fn check_ord_partial_ord<'tcx>(
299299

300300
// Only care about `impl PartialOrd<Foo> for Foo`
301301
// For `impl PartialOrd<B> for A, input_types is [A, B]
302-
if trait_ref.substs.type_at(1) == ty {
302+
if trait_ref.subst_identity().substs.type_at(1) == ty {
303303
let mess = if partial_ord_is_automatically_derived {
304304
"you are implementing `Ord` explicitly but have derived `PartialOrd`"
305305
} else {

clippy_lints/src/fallible_impl_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'tcx> LateLintPass<'tcx> for FallibleImplFrom {
5656
if_chain! {
5757
if let hir::ItemKind::Impl(impl_) = &item.kind;
5858
if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id);
59-
if cx.tcx.is_diagnostic_item(sym::From, impl_trait_ref.def_id);
59+
if cx.tcx.is_diagnostic_item(sym::From, impl_trait_ref.skip_binder().def_id);
6060
then {
6161
lint_impl_body(cx, item.span, impl_.items);
6262
}

clippy_lints/src/format_args.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use clippy_utils::macros::{
77
};
88
use clippy_utils::msrvs::{self, Msrv};
99
use clippy_utils::source::snippet_opt;
10-
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
10+
use clippy_utils::ty::{implements_trait, is_type_lang_item};
1111
use if_chain::if_chain;
1212
use itertools::Itertools;
1313
use rustc_errors::{
1414
Applicability,
1515
SuggestionStyle::{CompletelyHidden, ShowCode},
1616
};
17-
use rustc_hir::{Expr, ExprKind, HirId, QPath};
17+
use rustc_hir::{Expr, ExprKind, HirId, LangItem, QPath};
1818
use rustc_lint::{LateContext, LateLintPass, LintContext};
1919
use rustc_middle::ty::adjustment::{Adjust, Adjustment};
2020
use rustc_middle::ty::Ty;
@@ -237,7 +237,7 @@ fn check_unused_format_specifier(cx: &LateContext<'_>, arg: &FormatArg<'_>) {
237237
);
238238
}
239239

240-
if is_type_diagnostic_item(cx, param_ty, sym::Arguments) && !arg.format.is_default_for_trait() {
240+
if is_type_lang_item(cx, param_ty, LangItem::FormatArguments) && !arg.format.is_default_for_trait() {
241241
span_lint_and_then(
242242
cx,
243243
UNUSED_FORMAT_SPECS,

clippy_lints/src/from_over_into.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'tcx> LateLintPass<'tcx> for FromOverInto {
7676
&& let Some(into_trait_seg) = hir_trait_ref.path.segments.last()
7777
// `impl Into<target_ty> for self_ty`
7878
&& let Some(GenericArgs { args: [GenericArg::Type(target_ty)], .. }) = into_trait_seg.args
79-
&& let Some(middle_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id)
79+
&& let Some(middle_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id).map(ty::EarlyBinder::subst_identity)
8080
&& cx.tcx.is_diagnostic_item(sym::Into, middle_trait_ref.def_id)
8181
&& !matches!(middle_trait_ref.substs.type_at(1).kind(), ty::Alias(ty::Opaque, _))
8282
{

clippy_lints/src/future_not_send.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
7878
let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
7979
let span = decl.output.span();
8080
let infcx = cx.tcx.infer_ctxt().build();
81-
let cause = traits::ObligationCause::misc(span, hir_id);
81+
let def_id = cx.tcx.hir().local_def_id(hir_id);
82+
let cause = traits::ObligationCause::misc(span, def_id);
8283
let send_errors = traits::fully_solve_bound(&infcx, cause, cx.param_env, ret_ty, send_trait);
8384
if !send_errors.is_empty() {
8485
span_lint_and_then(

clippy_lints/src/inherent_impl.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,19 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
5252
// List of spans to lint. (lint_span, first_span)
5353
let mut lint_spans = Vec::new();
5454

55-
for (_, impl_ids) in cx
55+
let inherent_impls = cx
5656
.tcx
57-
.crate_inherent_impls(())
58-
.inherent_impls
59-
.iter()
60-
.filter(|(&id, impls)| {
61-
impls.len() > 1
62-
// Check for `#[allow]` on the type definition
63-
&& !is_lint_allowed(
64-
cx,
65-
MULTIPLE_INHERENT_IMPL,
66-
cx.tcx.hir().local_def_id_to_hir_id(id),
67-
)
68-
})
69-
{
57+
.with_stable_hashing_context(|hcx| cx.tcx.crate_inherent_impls(()).inherent_impls.to_sorted(&hcx, true));
58+
59+
for (_, impl_ids) in inherent_impls.into_iter().filter(|(&id, impls)| {
60+
impls.len() > 1
61+
// Check for `#[allow]` on the type definition
62+
&& !is_lint_allowed(
63+
cx,
64+
MULTIPLE_INHERENT_IMPL,
65+
cx.tcx.hir().local_def_id_to_hir_id(id),
66+
)
67+
}) {
7068
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
7169
match type_map.entry(cx.tcx.type_of(impl_id)) {
7270
Entry::Vacant(e) => {

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fn check_trait_items(cx: &LateContext<'_>, visited_trait: &Item<'_>, trait_items
219219
let is_empty = sym!(is_empty);
220220

221221
let is_empty_method_found = current_and_super_traits
222-
.iter()
222+
.items()
223223
.flat_map(|&i| cx.tcx.associated_items(i).filter_by_name_unhygienic(is_empty))
224224
.any(|i| {
225225
i.kind == ty::AssocKind::Fn

0 commit comments

Comments
 (0)