Skip to content
Merged

Rustup #15531

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
849f71f
remove gate
Kivooeo Aug 3, 2025
eb15cf0
Merge commit '334fb906aef13d20050987b13448f37391bb97a2' into clippy-s…
flip1995 Aug 7, 2025
0a70523
remove `P`
fee1-dead Aug 9, 2025
a5469b8
Constify remaining operators
clarfonthey Jul 15, 2025
bec5346
fix clippy test
estebank Aug 11, 2025
c8c483d
Account for new `assert!` desugaring in `!condition` suggestion
estebank Aug 11, 2025
7fe9a40
Extract ast TraitImplHeader
camsteffen Jul 22, 2025
9f98857
Propagate TraitImplHeader to hir
camsteffen Jul 24, 2025
68c1574
make no_mangle explicit on foreign items
jdonszelmann Jul 29, 2025
2dd7208
Rollup merge of #145238 - estebank:attr-overhaul, r=jdonszelmann
Zalathar Aug 12, 2025
12087f1
Rollup merge of #145273 - estebank:not-not, r=samueltardieu
Zalathar Aug 12, 2025
f2f0665
Revert "Partially outline code inside the panic! macro".
m-ou-se Aug 12, 2025
a493e27
Auto merge of #144678 - jdonszelmann:no-mangle-extern, r=bjorn3
bors Aug 12, 2025
e7e18a3
clippy: Update for switch to `MacroKinds`
joshtriplett Aug 9, 2025
0a522cc
Change the desugaring of `assert!` for better error output
estebank Mar 17, 2024
d42a48d
Rollup merge of #144870 - Kivooeo:file_prefix-stabilize, r=tgross35
Kobzol Aug 13, 2025
cb3dedc
Update clippy tests
petrochenkov Aug 13, 2025
cf42ac6
Rollup merge of #145153 - joshtriplett:macro-kinds-plural, r=petroche…
GuillaumeGomez Aug 13, 2025
e7d8d34
Auto merge of #144793 - petrochenkov:extprel3, r=davidtwco
bors Aug 13, 2025
210097a
Rollup merge of #122661 - estebank:assert-macro-span, r=petrochenkov
Zalathar Aug 15, 2025
cdcce5a
Auto merge of #145304 - m-ou-se:simplify-panic, r=oli-obk
bors Aug 16, 2025
c1dfeea
Prevent impossible combinations in `ast::ModKind`.
nnethercote Aug 19, 2025
4b2b9c2
bless tests with new lint messages
karolzwolak Apr 28, 2025
bea2e2b
Rollup merge of #145590 - nnethercote:ModKind-Inline, r=petrochenkov
jhpratt Aug 21, 2025
284b596
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Aug 22, 2025
567b65e
Ignore unexpected_cfgs warning for bootstrap
flip1995 Aug 22, 2025
9de86f4
Dogfood fixes
flip1995 Aug 22, 2025
60374e2
Bump nightly version -> 2025-08-22
flip1995 Aug 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ harness = false
# without increasing total build times.
[profile.dev.package.quine-mc_cluskey]
opt-level = 3

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = ['cfg(bootstrap)']
Comment on lines +75 to +77
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from miri. This is now necessary, as Clippy is now build as a stage1 tool in the Rust repo.

1 change: 1 addition & 0 deletions clippy_lints/src/arbitrary_source_item_ordering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ fn get_item_name(item: &Item<'_>) -> Option<String> {

if let Some(of_trait) = im.of_trait {
let mut trait_segs: Vec<String> = of_trait
.trait_ref
.path
.segments
.iter()
Expand Down
24 changes: 14 additions & 10 deletions clippy_lints/src/bool_assert_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,22 @@ impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {

let mut suggestions = vec![(name_span, non_eq_mac.to_string()), (lit_span, String::new())];

if bool_value ^ eq_macro {
let Some(sugg) = Sugg::hir_opt(cx, non_lit_expr) else {
return;
if let Some(sugg) = Sugg::hir_opt(cx, non_lit_expr) {
let sugg = if bool_value ^ eq_macro {
!sugg.maybe_paren()
} else if ty::Bool == *non_lit_ty.kind() {
sugg
} else {
!!sugg.maybe_paren()
};
suggestions.push((non_lit_expr.span, (!sugg).to_string()));
}
suggestions.push((non_lit_expr.span, sugg.to_string()));

diag.multipart_suggestion(
format!("replace it with `{non_eq_mac}!(..)`"),
suggestions,
Applicability::MachineApplicable,
);
diag.multipart_suggestion(
format!("replace it with `{non_eq_mac}!(..)`"),
suggestions,
Applicability::MachineApplicable,
);
}
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/copy_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
impl<'tcx> LateLintPass<'tcx> for CopyIterator {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(trait_ref),
of_trait: Some(of_trait),
..
}) = item.kind
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()
&& is_copy(cx, ty)
&& let Some(trait_id) = trait_ref.trait_def_id()
&& let Some(trait_id) = of_trait.trait_ref.trait_def_id()
&& cx.tcx.is_diagnostic_item(sym::Iterator, trait_id)
{
span_lint_and_note(
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/derivable_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ fn check_enum<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>, func_expr: &Ex
impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(trait_ref),
of_trait: Some(of_trait),
items: [child],
self_ty,
..
}) = item.kind
&& !cx.tcx.is_automatically_derived(item.owner_id.to_def_id())
&& !item.span.from_expansion()
&& let Some(def_id) = trait_ref.trait_def_id()
&& let Some(def_id) = of_trait.trait_ref.trait_def_id()
&& cx.tcx.is_diagnostic_item(sym::Default, def_id)
&& let impl_item_hir = child.hir_id()
&& let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir)
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,11 @@ declare_lint_pass!(Derive => [
impl<'tcx> LateLintPass<'tcx> for Derive {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(trait_ref),
of_trait: Some(of_trait),
..
}) = item.kind
{
let trait_ref = &of_trait.trait_ref;
let ty = cx.tcx.type_of(item.owner_id).instantiate_identity();
let is_automatically_derived = cx.tcx.is_automatically_derived(item.owner_id.to_def_id());

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/duplicate_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl_lint_pass!(DuplicateMod => [DUPLICATE_MOD]);

impl EarlyLintPass for DuplicateMod {
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
if let ItemKind::Mod(_, _, ModKind::Loaded(_, Inline::No, mod_spans, _)) = &item.kind
if let ItemKind::Mod(_, _, ModKind::Loaded(_, Inline::No { .. }, mod_spans)) = &item.kind
&& let FileName::Real(real) = cx.sess().source_map().span_to_filename(mod_spans.inner_span)
&& let Some(local_path) = real.into_local_path()
&& let Ok(absolute_path) = local_path.canonicalize()
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/empty_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ declare_lint_pass!(EmptyDrop => [EMPTY_DROP]);
impl LateLintPass<'_> for EmptyDrop {
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(trait_ref),
of_trait: Some(of_trait),
items: [child],
..
}) = item.kind
&& trait_ref.trait_def_id() == cx.tcx.lang_items().drop_trait()
&& of_trait.trait_ref.trait_def_id() == cx.tcx.lang_items().drop_trait()
&& let impl_item_hir = child.hir_id()
&& let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir)
&& let ImplItemKind::Fn(_, b) = &impl_item.kind
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/empty_line_after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ impl EmptyLineAfter {
None => span.shrink_to_lo(),
},
mod_items: match kind {
ItemKind::Mod(_, _, ModKind::Loaded(items, _, _, _)) => items
ItemKind::Mod(_, _, ModKind::Loaded(items, _, _)) => items
.iter()
.filter(|i| !matches!(i.span.ctxt().outer_expn_data().kind, ExpnKind::AstPass(_)))
.map(|i| i.id)
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/error_impl_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<'tcx> LateLintPass<'tcx> for ErrorImplError {
);
},
ItemKind::Impl(imp)
if let Some(trait_def_id) = imp.of_trait.and_then(|t| t.trait_def_id())
if let Some(trait_def_id) = imp.of_trait.and_then(|t| t.trait_ref.trait_def_id())
&& let Some(error_def_id) = cx.tcx.get_diagnostic_item(sym::Error)
&& error_def_id == trait_def_id
&& let Some(def_id) = path_res(cx, imp.self_ty).opt_def_id().and_then(DefId::as_local)
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/excessive_nesting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl Visitor<'_> for NestingVisitor<'_, '_> {
}

match &item.kind {
ItemKind::Trait(_) | ItemKind::Impl(_) | ItemKind::Mod(.., ModKind::Loaded(_, Inline::Yes, _, _)) => {
ItemKind::Trait(_) | ItemKind::Impl(_) | ItemKind::Mod(.., ModKind::Loaded(_, Inline::Yes, _)) => {
self.nest_level += 1;

if !self.check_indent(item.span, item.id) {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/format_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ fn is_format_trait_impl(cx: &LateContext<'_>, impl_item: &ImplItem<'_>) -> Optio
if impl_item.ident.name == sym::fmt
&& let ImplItemKind::Fn(_, body_id) = impl_item.kind
&& let Some(Impl {
of_trait: Some(trait_ref),
of_trait: Some(of_trait),
..
}) = get_parent_as_impl(cx.tcx, impl_item.hir_id())
&& let Some(did) = trait_ref.trait_def_id()
&& let Some(did) = of_trait.trait_ref.trait_def_id()
&& let Some(name) = cx.tcx.get_diagnostic_name(did)
&& matches!(name, sym::Debug | sym::Display)
{
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/from_over_into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ impl_lint_pass!(FromOverInto => [FROM_OVER_INTO]);
impl<'tcx> LateLintPass<'tcx> for FromOverInto {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(hir_trait_ref),
of_trait: Some(of_trait),
self_ty,
items: [impl_item_ref],
..
}) = item.kind
&& let Some(into_trait_seg) = hir_trait_ref.path.segments.last()
&& let Some(into_trait_seg) = of_trait.trait_ref.path.segments.last()
// `impl Into<target_ty> for self_ty`
&& let Some(GenericArgs { args: [GenericArg::Type(target_ty)], .. }) = into_trait_seg.args
&& span_is_local(item.span)
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/functions/impl_trait_in_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ pub(super) fn check_impl_item(cx: &LateContext<'_>, impl_item: &ImplItem<'_>) {
if let ImplItemKind::Fn(_, body_id) = impl_item.kind
&& let hir::Node::Item(item) = cx.tcx.parent_hir_node(impl_item.hir_id())
&& let hir::ItemKind::Impl(impl_) = item.kind
&& let hir::Impl { of_trait, .. } = *impl_
&& of_trait.is_none()
&& let hir::Impl { of_trait: None, .. } = impl_
&& let body = cx.tcx.hir_body(body_id)
&& cx.tcx.visibility(cx.tcx.hir_body_owner_def_id(body.id())).is_public()
&& !is_in_test(cx.tcx, impl_item.hir_id())
Expand Down
10 changes: 6 additions & 4 deletions clippy_lints/src/functions/renamed_function_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_then;
use rustc_errors::{Applicability, MultiSpan};
use rustc_hir::def_id::{DefId, DefIdSet};
use rustc_hir::hir_id::OwnerId;
use rustc_hir::{ImplItem, ImplItemKind, ItemKind, Node, TraitRef};
use rustc_hir::{Impl, ImplItem, ImplItemKind, ItemKind, Node, TraitRef};
use rustc_lint::LateContext;
use rustc_span::Span;
use rustc_span::symbol::{Ident, kw};
Expand All @@ -15,10 +15,12 @@ pub(super) fn check_impl_item(cx: &LateContext<'_>, item: &ImplItem<'_>, ignored
&& let ImplItemKind::Fn(_, body_id) = item.kind
&& let parent_node = cx.tcx.parent_hir_node(item.hir_id())
&& let Node::Item(parent_item) = parent_node
&& let ItemKind::Impl(impl_) = &parent_item.kind
&& let Some(trait_ref) = impl_.of_trait
&& let ItemKind::Impl(Impl {
of_trait: Some(of_trait),
..
}) = &parent_item.kind
&& let Some(did) = trait_item_def_id_of_impl(cx, item.owner_id)
&& !is_from_ignored_trait(&trait_ref, ignored_traits)
&& !is_from_ignored_trait(&of_trait.trait_ref, ignored_traits)
{
let mut param_idents_iter = cx.tcx.hir_body_param_idents(body_id);
let mut default_param_idents_iter = cx.tcx.fn_arg_idents(did).iter().copied();
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/impl_hash_with_borrow_str_and_bytes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::ty::implements_trait;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::{Item, ItemKind, Path, TraitRef};
use rustc_hir::{Item, ItemKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::Ty;
use rustc_session::declare_lint_pass;
Expand Down Expand Up @@ -76,10 +76,10 @@ impl LateLintPass<'_> for ImplHashWithBorrowStrBytes {
/// three of `Hash`, `Borrow<str>` and `Borrow<[u8]>`.
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
if let ItemKind::Impl(imp) = item.kind
&& let Some(TraitRef {path: Path {span, res, ..}, ..}) = imp.of_trait
&& let Some(of_trait) = imp.of_trait
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()
&& let Some(hash_id) = cx.tcx.get_diagnostic_item(sym::Hash)
&& Res::Def(DefKind::Trait, hash_id) == *res
&& Res::Def(DefKind::Trait, hash_id) == of_trait.trait_ref.path.res
&& let Some(borrow_id) = cx.tcx.get_diagnostic_item(sym::Borrow)
// since we are in the `Hash` impl, we don't need to check for that.
// we need only to check for `Borrow<str>` and `Borrow<[u8]>`
Expand All @@ -89,7 +89,7 @@ impl LateLintPass<'_> for ImplHashWithBorrowStrBytes {
span_lint_and_then(
cx,
IMPL_HASH_BORROW_WITH_STR_AND_BYTES,
*span,
of_trait.trait_ref.path.span,
"the semantics of `Borrow<T>` around `Hash` can't be satisfied when both `Borrow<str>` and `Borrow<[u8]>` are implemented",
|diag| {
diag.note("the `Borrow` semantics require that `Hash` must behave the same for all implementations of Borrow<T>");
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/infallible_try_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ declare_lint_pass!(InfallibleTryFrom => [INFALLIBLE_TRY_FROM]);
impl<'tcx> LateLintPass<'tcx> for InfallibleTryFrom {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
let ItemKind::Impl(imp) = item.kind else { return };
let Some(r#trait) = imp.of_trait else { return };
let Some(trait_def_id) = r#trait.trait_def_id() else {
let Some(of_trait) = imp.of_trait else { return };
let Some(trait_def_id) = of_trait.trait_ref.trait_def_id() else {
return;
};
if !cx.tcx.is_diagnostic_item(sym::TryFrom, trait_def_id) {
Expand Down
5 changes: 2 additions & 3 deletions clippy_lints/src/item_name_repetitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_hir::{EnumDef, FieldDef, Item, ItemKind, OwnerId, QPath, TyKind, Variant, VariantData};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::impl_lint_pass;
use rustc_span::MacroKind;
use rustc_span::symbol::Symbol;

declare_clippy_lint! {
Expand Down Expand Up @@ -503,8 +502,8 @@ impl LateLintPass<'_> for ItemNameRepetitions {
);
}

let is_macro_rule = matches!(item.kind, ItemKind::Macro(_, _, MacroKind::Bang));
if both_are_public && item_camel.len() > mod_camel.len() && !is_macro_rule {
let is_macro = matches!(item.kind, ItemKind::Macro(_, _, _));
if both_are_public && item_camel.len() > mod_camel.len() && !is_macro {
let matching = count_match_start(mod_camel, &item_camel);
let rmatching = count_match_end(mod_camel, &item_camel);
let nchars = mod_camel.chars().count();
Expand Down
5 changes: 3 additions & 2 deletions clippy_lints/src/iter_without_into_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ impl LateLintPass<'_> for IterWithoutIntoIter {
fn check_item(&mut self, cx: &LateContext<'_>, item: &rustc_hir::Item<'_>) {
if let ItemKind::Impl(imp) = item.kind
&& let TyKind::Ref(_, self_ty_without_ref) = &imp.self_ty.kind
&& let Some(trait_ref) = imp.of_trait
&& trait_ref
&& let Some(of_trait) = imp.of_trait
&& of_trait
.trait_ref
.trait_def_id()
.is_some_and(|did| cx.tcx.is_diagnostic_item(sym::IntoIterator, did))
&& !item.span.in_external_macro(cx.sess().source_map())
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl<'tcx> LateLintPass<'tcx> for Lifetimes {
} = item.kind
{
check_fn_inner(cx, sig, Some(id), None, generics, item.span, true, self.msrv);
} else if let ItemKind::Impl(impl_) = item.kind
} else if let ItemKind::Impl(impl_) = &item.kind
&& !item.span.from_expansion()
{
report_extra_impl_lifetimes(cx, impl_);
Expand Down Expand Up @@ -712,8 +712,8 @@ fn report_extra_impl_lifetimes<'tcx>(cx: &LateContext<'tcx>, impl_: &'tcx Impl<'
let mut checker = LifetimeChecker::<middle_nested_filter::All>::new(cx, impl_.generics);

walk_generics(&mut checker, impl_.generics);
if let Some(ref trait_ref) = impl_.of_trait {
walk_trait_ref(&mut checker, trait_ref);
if let Some(of_trait) = impl_.of_trait {
walk_trait_ref(&mut checker, &of_trait.trait_ref);
}
walk_unambig_ty(&mut checker, impl_.self_ty);
for &item in impl_.items {
Expand Down
12 changes: 6 additions & 6 deletions clippy_lints/src/missing_asserts_for_indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_ast::{BinOpKind, LitKind, RangeLimits};
use rustc_data_structures::packed::Pu128;
use rustc_data_structures::unhash::UnindexMap;
use rustc_errors::{Applicability, Diag};
use rustc_hir::{Block, Body, Expr, ExprKind, UnOp};
use rustc_hir::{Body, Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::declare_lint_pass;
use rustc_span::source_map::Spanned;
Expand Down Expand Up @@ -135,12 +135,12 @@ fn assert_len_expr<'hir>(
cx: &LateContext<'_>,
expr: &'hir Expr<'hir>,
) -> Option<(LengthComparison, usize, &'hir Expr<'hir>)> {
let (cmp, asserted_len, slice_len) = if let Some(higher::If { cond, then, .. }) = higher::If::hir(expr)
&& let ExprKind::Unary(UnOp::Not, condition) = &cond.kind
&& let ExprKind::Binary(bin_op, left, right) = &condition.kind
let (cmp, asserted_len, slice_len) = if let Some(
higher::IfLetOrMatch::Match(cond, [_, then], _)
) = higher::IfLetOrMatch::parse(cx, expr)
&& let ExprKind::Binary(bin_op, left, right) = &cond.kind
// check if `then` block has a never type expression
&& let ExprKind::Block(Block { expr: Some(then_expr), .. }, _) = then.kind
&& cx.typeck_results().expr_ty(then_expr).is_never()
&& cx.typeck_results().expr_ty(then.body).is_never()
{
len_comparison(bin_op.node, left, right)?
} else if let Some((macro_call, bin_op)) = first_node_macro_backtrace(cx, expr).find_map(|macro_call| {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/missing_fields_in_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ fn check_struct<'tcx>(
impl<'tcx> LateLintPass<'tcx> for MissingFieldsInDebug {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
// is this an `impl Debug for X` block?
if let ItemKind::Impl(Impl { of_trait: Some(trait_ref), self_ty, .. }) = item.kind
&& let Res::Def(DefKind::Trait, trait_def_id) = trait_ref.path.res
if let ItemKind::Impl(Impl { of_trait: Some(of_trait), self_ty, .. }) = item.kind
&& let Res::Def(DefKind::Trait, trait_def_id) = of_trait.trait_ref.path.res
&& let TyKind::Path(QPath::Resolved(_, self_path)) = &self_ty.kind
// make sure that the self type is either a struct, an enum or a union
// this prevents ICEs such as when self is a type parameter or a primitive type
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,5 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
/// and a rustc warning would be triggered, see #15301
fn fn_is_externally_exported(cx: &LateContext<'_>, def_id: DefId) -> bool {
let attrs = cx.tcx.codegen_fn_attrs(def_id);
attrs.contains_extern_indicator()
attrs.contains_extern_indicator(cx.tcx, def_id)
}
4 changes: 2 additions & 2 deletions clippy_lints/src/missing_trait_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ impl<'tcx> LateLintPass<'tcx> for MissingTraitMethods {
if !is_lint_allowed(cx, MISSING_TRAIT_METHODS, item.hir_id())
&& span_is_local(item.span)
&& let ItemKind::Impl(Impl {
of_trait: Some(trait_ref),
of_trait: Some(of_trait),
..
}) = item.kind
&& let Some(trait_id) = trait_ref.trait_def_id()
&& let Some(trait_id) = of_trait.trait_ref.trait_def_id()
{
let trait_item_ids: DefIdSet = cx
.tcx
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/non_copy_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst<'tcx> {
if let Node::Item(parent_item) = cx.tcx.parent_hir_node(item.hir_id())
&& let ItemKind::Impl(impl_block) = parent_item.kind
&& let Some(of_trait) = impl_block.of_trait
&& let Some(trait_id) = of_trait.trait_def_id()
&& let Some(trait_id) = of_trait.trait_ref.trait_def_id()
{
// Replace all instances of `<Self as Trait>::AssocType` with the
// unit type and check again. If the result is the same then the
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/non_send_fields_in_send_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ impl<'tcx> LateLintPass<'tcx> for NonSendFieldInSendTy {
if !item.span.in_external_macro(cx.tcx.sess.source_map())
&& let Some(send_trait) = cx.tcx.get_diagnostic_item(sym::Send)
&& let ItemKind::Impl(hir_impl) = &item.kind
&& let Some(trait_ref) = &hir_impl.of_trait
&& let Some(trait_id) = trait_ref.trait_def_id()
&& let Some(of_trait) = &hir_impl.of_trait
&& let Some(trait_id) = of_trait.trait_ref.trait_def_id()
&& send_trait == trait_id
&& hir_impl.polarity == ImplPolarity::Positive
&& of_trait.polarity == ImplPolarity::Positive
&& let Some(ty_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id)
&& let self_ty = ty_trait_ref.instantiate_identity().self_ty()
&& let ty::Adt(adt_def, impl_trait_args) = self_ty.kind()
Expand Down
Loading