Skip to content

Commit 26ac6aa

Browse files
committed
Auto merge of #12130 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 87ff58d + 7d8b6e4 commit 26ac6aa

Some content is hidden

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

51 files changed

+163
-252
lines changed

clippy_config/src/msrvs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl Msrv {
109109
if let Some(duplicate) = msrv_attrs.last() {
110110
sess.dcx()
111111
.struct_span_err(duplicate.span, "`clippy::msrv` is defined multiple times")
112-
.span_note(msrv_attr.span, "first definition found here")
112+
.with_span_note(msrv_attr.span, "first definition found here")
113113
.emit();
114114
}
115115

clippy_lints/src/casts/unnecessary_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub(super) fn check<'tcx>(
145145
if cast_from.kind() == cast_to.kind() && !in_external_macro(cx.sess(), expr.span) {
146146
if let Some(id) = path_to_local(cast_expr)
147147
&& let Some(span) = cx.tcx.hir().opt_span(id)
148-
&& span.ctxt() != cast_expr.span.ctxt()
148+
&& !span.eq_ctxt(cast_expr.span)
149149
{
150150
// Binding context is different than the identifiers context.
151151
// Weird macro wizardry could be involved here.

clippy_lints/src/copies.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use rustc_errors::Applicability;
1212
use rustc_hir::def_id::DefIdSet;
1313
use rustc_hir::{intravisit, BinOpKind, Block, Expr, ExprKind, HirId, HirIdSet, Stmt, StmtKind};
1414
use rustc_lint::{LateContext, LateLintPass};
15-
use rustc_middle::query::Key;
1615
use rustc_session::impl_lint_pass;
1716
use rustc_span::hygiene::walk_chain;
1817
use rustc_span::source_map::SourceMap;
@@ -574,7 +573,7 @@ fn method_caller_is_mutable(cx: &LateContext<'_>, caller_expr: &Expr<'_>, ignore
574573
let caller_ty = cx.typeck_results().expr_ty(caller_expr);
575574
// Check if given type has inner mutability and was not set to ignored by the configuration
576575
let is_inner_mut_ty = is_interior_mut_ty(cx, caller_ty)
577-
&& !matches!(caller_ty.ty_adt_id(), Some(adt_id) if ignored_ty_ids.contains(&adt_id));
576+
&& !matches!(caller_ty.ty_adt_def(), Some(adt) if ignored_ty_ids.contains(&adt.did()));
578577

579578
is_inner_mut_ty
580579
|| caller_ty.is_mutable_ptr()

clippy_lints/src/doc/missing_headers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn check(
7272
&& let body = cx.tcx.hir().body(body_id)
7373
&& let ret_ty = typeck.expr_ty(body.value)
7474
&& implements_trait(cx, ret_ty, future, &[])
75-
&& let ty::Coroutine(_, subs, _) = ret_ty.kind()
75+
&& let ty::Coroutine(_, subs) = ret_ty.kind()
7676
&& is_type_diagnostic_item(cx, subs.as_coroutine().return_ty(), sym::Result)
7777
{
7878
span_lint(

clippy_lints/src/doc/needless_doctest_main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::doc::{NEEDLESS_DOCTEST_MAIN, TEST_ATTR_IN_DOCTEST};
55
use clippy_utils::diagnostics::span_lint;
66
use rustc_ast::{CoroutineKind, Fn, FnRetTy, Item, ItemKind};
77
use rustc_data_structures::sync::Lrc;
8-
use rustc_errors::emitter::EmitterWriter;
8+
use rustc_errors::emitter::HumanEmitter;
99
use rustc_errors::DiagCtxt;
1010
use rustc_lint::LateContext;
1111
use rustc_parse::maybe_new_parser_from_source_str;
@@ -44,7 +44,7 @@ pub fn check(
4444

4545
let fallback_bundle =
4646
rustc_errors::fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false);
47-
let emitter = EmitterWriter::new(Box::new(io::sink()), fallback_bundle);
47+
let emitter = HumanEmitter::new(Box::new(io::sink()), fallback_bundle);
4848
let dcx = DiagCtxt::with_emitter(Box::new(emitter)).disable_warnings();
4949
#[expect(clippy::arc_with_non_send_sync)] // `Lrc` is expected by with_dcx
5050
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));

clippy_lints/src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use core::fmt::{self, Write};
88
use rustc_errors::Applicability;
99
use rustc_hir::hir_id::HirIdSet;
1010
use rustc_hir::intravisit::{walk_expr, Visitor};
11-
use rustc_hir::{Block, Expr, ExprKind, Guard, HirId, Let, Pat, Stmt, StmtKind, UnOp};
11+
use rustc_hir::{Block, Expr, ExprKind, HirId, Pat, Stmt, StmtKind, UnOp};
1212
use rustc_lint::{LateContext, LateLintPass};
1313
use rustc_session::declare_lint_pass;
1414
use rustc_span::{Span, SyntaxContext, DUMMY_SP};
@@ -465,7 +465,7 @@ impl<'tcx> Visitor<'tcx> for InsertSearcher<'_, 'tcx> {
465465
let mut is_map_used = self.is_map_used;
466466
for arm in arms {
467467
self.visit_pat(arm.pat);
468-
if let Some(Guard::If(guard) | Guard::IfLet(&Let { init: guard, .. })) = arm.guard {
468+
if let Some(guard) = arm.guard {
469469
self.visit_non_tail_expr(guard);
470470
}
471471
is_map_used |= self.visit_cond_arm(arm.body);

clippy_lints/src/implicit_hasher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
118118
vis.visit_ty(impl_.self_ty);
119119

120120
for target in &vis.found {
121-
if item.span.ctxt() != target.span().ctxt() {
121+
if !item.span.eq_ctxt(target.span()) {
122122
return;
123123
}
124124

clippy_lints/src/implicit_return.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitReturn {
225225
_: LocalDefId,
226226
) {
227227
if (!matches!(kind, FnKind::Closure) && matches!(decl.output, FnRetTy::DefaultReturn(_)))
228-
|| span.ctxt() != body.value.span.ctxt()
228+
|| !span.eq_ctxt(body.value.span)
229229
|| in_external_macro(cx.sess(), span)
230230
{
231231
return;

clippy_lints/src/manual_clamp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use clippy_utils::{
1111
use itertools::Itertools;
1212
use rustc_errors::{Applicability, Diagnostic};
1313
use rustc_hir::def::Res;
14-
use rustc_hir::{Arm, BinOpKind, Block, Expr, ExprKind, Guard, HirId, PatKind, PathSegment, PrimTy, QPath, StmtKind};
14+
use rustc_hir::{Arm, BinOpKind, Block, Expr, ExprKind, HirId, PatKind, PathSegment, PrimTy, QPath, StmtKind};
1515
use rustc_lint::{LateContext, LateLintPass};
1616
use rustc_middle::ty::Ty;
1717
use rustc_session::impl_lint_pass;
@@ -394,7 +394,7 @@ fn is_match_pattern<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Opt
394394
// Find possible min/max branches
395395
let minmax_values = |a: &'tcx Arm<'tcx>| {
396396
if let PatKind::Binding(_, var_hir_id, _, None) = &a.pat.kind
397-
&& let Some(Guard::If(e)) = a.guard
397+
&& let Some(e) = a.guard
398398
{
399399
Some((e, var_hir_id, a.body))
400400
} else {

clippy_lints/src/matches/collapsible_match.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use clippy_utils::{
77
};
88
use rustc_errors::MultiSpan;
99
use rustc_hir::LangItem::OptionNone;
10-
use rustc_hir::{Arm, Expr, Guard, HirId, Let, Pat, PatKind};
10+
use rustc_hir::{Arm, Expr, HirId, Pat, PatKind};
1111
use rustc_lint::LateContext;
1212
use rustc_span::Span;
1313

@@ -16,7 +16,7 @@ use super::COLLAPSIBLE_MATCH;
1616
pub(super) fn check_match<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
1717
if let Some(els_arm) = arms.iter().rfind(|arm| arm_is_wild_like(cx, arm)) {
1818
for arm in arms {
19-
check_arm(cx, true, arm.pat, arm.body, arm.guard.as_ref(), Some(els_arm.body));
19+
check_arm(cx, true, arm.pat, arm.body, arm.guard, Some(els_arm.body));
2020
}
2121
}
2222
}
@@ -35,7 +35,7 @@ fn check_arm<'tcx>(
3535
outer_is_match: bool,
3636
outer_pat: &'tcx Pat<'tcx>,
3737
outer_then_body: &'tcx Expr<'tcx>,
38-
outer_guard: Option<&'tcx Guard<'tcx>>,
38+
outer_guard: Option<&'tcx Expr<'tcx>>,
3939
outer_else_body: Option<&'tcx Expr<'tcx>>,
4040
) {
4141
let inner_expr = peel_blocks_with_stmt(outer_then_body);
@@ -71,7 +71,7 @@ fn check_arm<'tcx>(
7171
// the binding must not be used in the if guard
7272
&& outer_guard.map_or(
7373
true,
74-
|(Guard::If(e) | Guard::IfLet(Let { init: e, .. }))| !is_local_used(cx, *e, binding_id)
74+
|e| !is_local_used(cx, e, binding_id)
7575
)
7676
// ...or anywhere in the inner expression
7777
&& match inner {

0 commit comments

Comments
 (0)