Skip to content

Commit 37f4fbb

Browse files
committed
Auto merge of #13157 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents df0cb6c + 71b0f0f commit 37f4fbb

26 files changed

+112
-76
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.81"
3+
version = "0.1.82"
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_config/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_config"
3-
version = "0.1.81"
3+
version = "0.1.82"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

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.81"
3+
version = "0.1.82"
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/eta_reduction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::ty::{
1515
use rustc_session::declare_lint_pass;
1616
use rustc_span::symbol::sym;
1717
use rustc_target::spec::abi::Abi;
18-
use rustc_trait_selection::error_reporting::traits::InferCtxtExt as _;
18+
use rustc_trait_selection::error_reporting::InferCtxtErrorExt as _;
1919

2020
declare_clippy_lint! {
2121
/// ### What it does
@@ -178,7 +178,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
178178
// 'cuz currently nothing changes after deleting this check.
179179
local_used_in(cx, l, args) || local_used_after_expr(cx, l, expr)
180180
}) {
181-
match cx.tcx.infer_ctxt().build().type_implements_fn_trait(
181+
match cx.tcx.infer_ctxt().build().err_ctxt().type_implements_fn_trait(
182182
cx.param_env,
183183
Binder::bind_with_vars(callee_ty_adjusted, List::empty()),
184184
ty::PredicatePolarity::Positive,

clippy_lints/src/functions/must_use.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use clippy_utils::source::snippet_opt;
1616
use clippy_utils::ty::is_must_use_ty;
1717
use clippy_utils::visitors::for_each_expr_without_closures;
1818
use clippy_utils::{return_ty, trait_ref_of_method};
19+
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
1920

2021
use core::ops::ControlFlow;
2122

@@ -117,11 +118,11 @@ fn check_needless_must_use(
117118
// Ignore async functions unless Future::Output type is a must_use type
118119
if sig.header.is_async() {
119120
let infcx = cx.tcx.infer_ctxt().build();
120-
if let Some(future_ty) = infcx.get_impl_future_output_ty(return_ty(cx, item_id))
121+
if let Some(future_ty) = infcx.err_ctxt().get_impl_future_output_ty(return_ty(cx, item_id))
121122
&& !is_must_use_ty(cx, future_ty)
122123
{
123124
return;
124-
}
125+
};
125126
}
126127

127128
span_lint_and_help(

clippy_lints/src/future_not_send.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::ty::{self, AliasTy, ClauseKind, PredicateKind};
99
use rustc_session::declare_lint_pass;
1010
use rustc_span::def_id::LocalDefId;
1111
use rustc_span::{sym, Span};
12-
use rustc_trait_selection::error_reporting::traits::suggestions::TypeErrCtxtExt;
12+
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
1313
use rustc_trait_selection::traits::{self, FulfillmentError, ObligationCtxt};
1414

1515
declare_clippy_lint! {

clippy_lints/src/inherent_impl.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,18 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
5656
let Ok(impls) = cx.tcx.crate_inherent_impls(()) else {
5757
return;
5858
};
59-
let inherent_impls = cx
60-
.tcx
61-
.with_stable_hashing_context(|hcx| impls.inherent_impls.to_sorted(&hcx, true));
6259

63-
for (_, impl_ids) in inherent_impls.into_iter().filter(|(&id, impls)| {
64-
impls.len() > 1
60+
for (&id, impl_ids) in &impls.inherent_impls {
61+
if impl_ids.len() < 2
6562
// Check for `#[allow]` on the type definition
66-
&& !is_lint_allowed(
63+
|| is_lint_allowed(
6764
cx,
6865
MULTIPLE_INHERENT_IMPL,
6966
cx.tcx.local_def_id_to_hir_id(id),
70-
)
71-
}) {
67+
) {
68+
continue;
69+
}
70+
7271
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
7372
let impl_ty = cx.tcx.type_of(impl_id).instantiate_identity();
7473
match type_map.entry(impl_ty) {

clippy_lints/src/large_stack_arrays.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ fn might_be_expanded<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) -> bool {
106106
///
107107
/// This is a fail-safe to a case where even the `is_from_proc_macro` is unable to determain the
108108
/// correct result.
109-
fn repeat_expr_might_be_expanded<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) -> bool {
110-
let ExprKind::Repeat(_, ArrayLen::Body(anon_const)) = expr.kind else {
109+
fn repeat_expr_might_be_expanded(expr: &Expr<'_>) -> bool {
110+
let ExprKind::Repeat(_, ArrayLen::Body(len_ct)) = expr.kind else {
111111
return false;
112112
};
113-
let len_span = cx.tcx.def_span(anon_const.def_id);
114-
!expr.span.contains(len_span)
113+
!expr.span.contains(len_ct.span())
115114
}
116115

117-
expr.span.from_expansion() || is_from_proc_macro(cx, expr) || repeat_expr_might_be_expanded(cx, expr)
116+
expr.span.from_expansion() || is_from_proc_macro(cx, expr) || repeat_expr_might_be_expanded(expr)
118117
}

clippy_lints/src/min_ident_chars.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ impl Visitor<'_> for IdentVisitor<'_, '_> {
139139
return;
140140
}
141141

142-
// `struct Awa<T>(T)`
143-
// ^
142+
// `struct Array<T, const N: usize>([T; N])`
143+
// ^ ^
144144
if let Node::PathSegment(path) = node {
145145
if let Res::Def(def_kind, ..) = path.res
146-
&& let DefKind::TyParam = def_kind
146+
&& let DefKind::TyParam | DefKind::ConstParam = def_kind
147147
{
148148
return;
149149
}

clippy_lints/src/misc_early/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ declare_lint_pass!(MiscEarlyLints => [
364364
]);
365365

366366
impl EarlyLintPass for MiscEarlyLints {
367-
fn check_generics(&mut self, cx: &EarlyContext<'_>, gen: &Generics) {
368-
for param in &gen.params {
367+
fn check_generics(&mut self, cx: &EarlyContext<'_>, generics: &Generics) {
368+
for param in &generics.params {
369369
builtin_type_shadow::check(cx, param);
370370
}
371371
}

0 commit comments

Comments
 (0)