Skip to content

Commit 4ef7529

Browse files
authored
Rustup (#15044)
r? @ghost changelog: none
2 parents 6662aed + 19c2f03 commit 4ef7529

Some content is hidden

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

53 files changed

+128
-116
lines changed

clippy_lints/src/arbitrary_source_item_ordering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
272272
return;
273273
}
274274
match &item.kind {
275-
ItemKind::Enum(_, enum_def, _generics) if self.enable_ordering_for_enum => {
275+
ItemKind::Enum(_, _generics, enum_def) if self.enable_ordering_for_enum => {
276276
let mut cur_v: Option<&Variant<'_>> = None;
277277
for variant in enum_def.variants {
278278
if variant.span.in_external_macro(cx.sess().source_map()) {
@@ -288,7 +288,7 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
288288
cur_v = Some(variant);
289289
}
290290
},
291-
ItemKind::Struct(_, VariantData::Struct { fields, .. }, _generics) if self.enable_ordering_for_struct => {
291+
ItemKind::Struct(_, _generics, VariantData::Struct { fields, .. }) if self.enable_ordering_for_struct => {
292292
let mut cur_f: Option<&FieldDef<'_>> = None;
293293
for field in *fields {
294294
if field.span.in_external_macro(cx.sess().source_map()) {

clippy_lints/src/disallowed_types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ impl_lint_pass!(DisallowedTypes => [DISALLOWED_TYPES]);
105105

106106
impl<'tcx> LateLintPass<'tcx> for DisallowedTypes {
107107
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
108-
if let ItemKind::Use(path, UseKind::Single(_)) = &item.kind {
109-
for res in &path.res {
110-
self.check_res_emit(cx, res, item.span);
111-
}
108+
if let ItemKind::Use(path, UseKind::Single(_)) = &item.kind
109+
&& let Some(res) = path.res.type_ns
110+
{
111+
self.check_res_emit(cx, &res, item.span);
112112
}
113113
}
114114

clippy_lints/src/empty_with_brackets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl_lint_pass!(EmptyWithBrackets => [EMPTY_STRUCTS_WITH_BRACKETS, EMPTY_ENUM_VA
9292

9393
impl LateLintPass<'_> for EmptyWithBrackets {
9494
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
95-
if let ItemKind::Struct(ident, var_data, _) = &item.kind
95+
if let ItemKind::Struct(ident, _, var_data) = &item.kind
9696
&& !item.span.from_expansion()
9797
&& has_brackets(var_data)
9898
&& let span_after_ident = item.span.with_lo(ident.span.hi())

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
3838
if cx.tcx.data_layout.pointer_size.bits() != 64 {
3939
return;
4040
}
41-
if let ItemKind::Enum(_, def, _) = &item.kind {
41+
if let ItemKind::Enum(_, _, def) = &item.kind {
4242
for var in def.variants {
4343
if let Some(anon_const) = &var.disr_expr {
4444
let def_id = cx.tcx.hir_body_owner_def_id(anon_const.body);

clippy_lints/src/excessive_bools.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn check_fn_decl(cx: &LateContext<'_>, decl: &FnDecl<'_>, sp: Span, max: u64) {
127127

128128
impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
129129
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
130-
if let ItemKind::Struct(_, variant_data, _) = &item.kind
130+
if let ItemKind::Struct(_, _, variant_data) = &item.kind
131131
&& variant_data.fields().len() as u64 > self.max_struct_bools
132132
&& has_n_bools(
133133
variant_data.fields().iter().map(|field| field.ty),

clippy_lints/src/exhaustive_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl LateLintPass<'_> for ExhaustiveItems {
7676
"exported enums should not be exhaustive",
7777
[].as_slice(),
7878
),
79-
ItemKind::Struct(_, v, ..) => (
79+
ItemKind::Struct(_, _, v) => (
8080
EXHAUSTIVE_STRUCTS,
8181
"exported structs should not be exhaustive",
8282
v.fields(),

clippy_lints/src/functions/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn check_result_large_err<'tcx>(cx: &LateContext<'tcx>, err_ty: Ty<'tcx>, hir_ty
103103
.did()
104104
.as_local()
105105
&& let hir::Node::Item(item) = cx.tcx.hir_node_by_def_id(local_def_id)
106-
&& let hir::ItemKind::Enum(_, ref def, _) = item.kind
106+
&& let hir::ItemKind::Enum(_, _, ref def) = item.kind
107107
{
108108
let variants_size = AdtVariantInfo::new(cx, *adt, subst);
109109
if let Some((first_variant, variants)) = variants_size.split_first()

clippy_lints/src/item_name_repetitions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,10 @@ impl LateLintPass<'_> for ItemNameRepetitions {
535535

536536
if span_is_local(item.span) {
537537
match item.kind {
538-
ItemKind::Enum(_, def, _) => {
538+
ItemKind::Enum(_, _, def) => {
539539
self.check_variants(cx, item, &def);
540540
},
541-
ItemKind::Struct(_, VariantData::Struct { fields, .. }, _) => {
541+
ItemKind::Struct(_, _, VariantData::Struct { fields, .. }) => {
542542
self.check_fields(cx, item, fields);
543543
},
544544
_ => (),

clippy_lints/src/large_const_arrays.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl_lint_pass!(LargeConstArrays => [LARGE_CONST_ARRAYS]);
4848

4949
impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
5050
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
51-
if let ItemKind::Const(ident, _, generics, _) = &item.kind
51+
if let ItemKind::Const(ident, generics, _, _) = &item.kind
5252
// Since static items may not have generics, skip generic const items.
5353
// FIXME(generic_const_items): I don't think checking `generics.hwcp` suffices as it
5454
// doesn't account for empty where-clauses that only consist of keyword `where` IINM.

clippy_lints/src/large_enum_variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl_lint_pass!(LargeEnumVariant => [LARGE_ENUM_VARIANT]);
7373

7474
impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant {
7575
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &Item<'tcx>) {
76-
if let ItemKind::Enum(ident, ref def, _) = item.kind
76+
if let ItemKind::Enum(ident, _, ref def) = item.kind
7777
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()
7878
&& let ty::Adt(adt, subst) = ty.kind()
7979
&& adt.variants().len() > 1

clippy_lints/src/legacy_numeric_constants.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ impl<'tcx> LateLintPass<'tcx> for LegacyNumericConstants {
5151
// so lint on the `use` statement directly.
5252
if let ItemKind::Use(path, kind @ (UseKind::Single(_) | UseKind::Glob)) = item.kind
5353
&& !item.span.in_external_macro(cx.sess().source_map())
54-
&& let Some(def_id) = path.res[0].opt_def_id()
54+
// use `present_items` because it could be in either type_ns or value_ns
55+
&& let Some(res) = path.res.present_items().next()
56+
&& let Some(def_id) = res.opt_def_id()
5557
&& self.msrv.meets(cx, msrvs::NUMERIC_ASSOCIATED_CONSTANTS)
5658
{
5759
let module = if is_integer_module(cx, def_id) {

clippy_lints/src/macro_use.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ impl LateLintPass<'_> for MacroUseImports {
100100
&& let hir_id = item.hir_id()
101101
&& let attrs = cx.tcx.hir_attrs(hir_id)
102102
&& let Some(mac_attr) = attrs.iter().find(|attr| attr.has_name(sym::macro_use))
103-
&& let Some(id) = path.res.iter().find_map(|res| match res {
104-
Res::Def(DefKind::Mod, id) => Some(id),
105-
_ => None,
106-
})
103+
&& let Some(Res::Def(DefKind::Mod, id)) = path.res.type_ns
107104
&& !id.is_local()
108105
{
109106
for kid in cx.tcx.module_children(id) {

clippy_lints/src/manual_non_exhaustive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustive {
8787
}
8888

8989
match item.kind {
90-
ItemKind::Enum(_, def, _) if def.variants.len() > 1 => {
90+
ItemKind::Enum(_, _, def) if def.variants.len() > 1 => {
9191
let iter = def.variants.iter().filter_map(|v| {
9292
(matches!(v.data, VariantData::Unit(_, _)) && is_doc_hidden(cx.tcx.hir_attrs(v.hir_id)))
9393
.then_some((v.def_id, v.span))
@@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustive {
9898
self.potential_enums.push((item.owner_id.def_id, id, item.span, span));
9999
}
100100
},
101-
ItemKind::Struct(_, variant_data, _) => {
101+
ItemKind::Struct(_, _, variant_data) => {
102102
let fields = variant_data.fields();
103103
let private_fields = fields
104104
.iter()

clippy_lints/src/min_ident_chars.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ impl Visitor<'_> for IdentVisitor<'_, '_> {
131131
// If however the identifier is different, this means it is an alias (`use foo::bar as baz`). In
132132
// this case, we need to emit the warning for `baz`.
133133
if let Some(imported_item_path) = usenode
134-
&& let Some(Res::Def(_, imported_item_defid)) = imported_item_path.res.first()
135-
&& cx.tcx.item_name(*imported_item_defid).as_str() == str
134+
// use `present_items` because it could be in any of type_ns, value_ns, macro_ns
135+
&& let Some(Res::Def(_, imported_item_defid)) = imported_item_path.res.value_ns
136+
&& cx.tcx.item_name(imported_item_defid).as_str() == str
136137
{
137138
return;
138139
}

clippy_lints/src/missing_enforced_import_rename.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ impl_lint_pass!(ImportRename => [MISSING_ENFORCED_IMPORT_RENAMES]);
7272
impl LateLintPass<'_> for ImportRename {
7373
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
7474
if let ItemKind::Use(path, UseKind::Single(_)) = &item.kind {
75-
for &res in &path.res {
75+
// use `present_items` because it could be in any of type_ns, value_ns, macro_ns
76+
for res in path.res.present_items() {
7677
if let Res::Def(_, id) = res
7778
&& let Some(name) = self.renames.get(&id)
7879
// Remove semicolon since it is not present for nested imports

clippy_lints/src/missing_fields_in_debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingFieldsInDebug {
225225
&& let typeck_results = cx.tcx.typeck_body(*body_id)
226226
&& should_lint(cx, typeck_results, block)
227227
// we intentionally only lint structs, see lint description
228-
&& let ItemKind::Struct(_, data, _) = &self_item.kind
228+
&& let ItemKind::Struct(_, _, data) = &self_item.kind
229229
{
230230
check_struct(cx, typeck_results, block, self_ty, item, data);
231231
}

clippy_lints/src/non_std_lazy_statics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ struct LazyInfo {
187187
impl LazyInfo {
188188
fn from_item(cx: &LateContext<'_>, item: &Item<'_>) -> Option<Self> {
189189
// Check if item is a `once_cell:sync::Lazy` static.
190-
if let ItemKind::Static(_, ty, _, body_id) = item.kind
190+
if let ItemKind::Static(_, _, ty, body_id) = item.kind
191191
&& let Some(path_def_id) = path_def_id(cx, ty)
192192
&& let hir::TyKind::Path(hir::QPath::Resolved(_, path)) = ty.kind
193193
&& paths::ONCE_CELL_SYNC_LAZY.matches(cx, path_def_id)

clippy_lints/src/pub_underscore_fields.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl PubUnderscoreFields {
5858
impl<'tcx> LateLintPass<'tcx> for PubUnderscoreFields {
5959
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
6060
// This lint only pertains to structs.
61-
let ItemKind::Struct(_, variant_data, _) = &item.kind else {
61+
let ItemKind::Struct(_, _, variant_data) = &item.kind else {
6262
return;
6363
};
6464

clippy_lints/src/redundant_pub_crate.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::source::HasSession;
33
use rustc_errors::Applicability;
44
use rustc_hir::def::{DefKind, Res};
5-
use rustc_hir::{Item, ItemKind};
5+
use rustc_hir::{Item, ItemKind, UseKind};
66
use rustc_lint::{LateContext, LateLintPass};
77
use rustc_middle::ty;
88
use rustc_session::impl_lint_pass;
@@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantPubCrate {
4949
if cx.tcx.visibility(item.owner_id.def_id) == ty::Visibility::Restricted(CRATE_DEF_ID.to_def_id())
5050
&& !cx.effective_visibilities.is_exported(item.owner_id.def_id)
5151
&& self.is_exported.last() == Some(&false)
52-
&& is_not_macro_export(item)
52+
&& !is_ignorable_export(item)
5353
&& !item.span.in_external_macro(cx.sess().source_map())
5454
{
5555
let span = item
@@ -86,18 +86,17 @@ impl<'tcx> LateLintPass<'tcx> for RedundantPubCrate {
8686
}
8787
}
8888

89-
fn is_not_macro_export<'tcx>(item: &'tcx Item<'tcx>) -> bool {
90-
if let ItemKind::Use(path, _) = item.kind {
91-
if path
92-
.res
93-
.iter()
94-
.all(|res| matches!(res, Res::Def(DefKind::Macro(MacroKind::Bang), _)))
95-
{
96-
return false;
89+
// We ignore macro exports. And `ListStem` uses, which aren't interesting.
90+
fn is_ignorable_export<'tcx>(item: &'tcx Item<'tcx>) -> bool {
91+
if let ItemKind::Use(path, kind) = item.kind {
92+
let ignore = matches!(path.res.macro_ns, Some(Res::Def(DefKind::Macro(MacroKind::Bang), _)))
93+
|| kind == UseKind::ListStem;
94+
if ignore {
95+
return true;
9796
}
9897
} else if let ItemKind::Macro(..) = item.kind {
99-
return false;
98+
return true;
10099
}
101100

102-
true
101+
false
103102
}

clippy_lints/src/trailing_empty_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'tcx> LateLintPass<'tcx> for TrailingEmptyArray {
5757
}
5858

5959
fn is_struct_with_trailing_zero_sized_array<'tcx>(cx: &LateContext<'tcx>, item: &Item<'tcx>) -> bool {
60-
if let ItemKind::Struct(_, data, _) = &item.kind
60+
if let ItemKind::Struct(_, _, data) = &item.kind
6161
&& let Some(last_field) = data.fields().last()
6262
&& let field_ty = cx.tcx.normalize_erasing_regions(
6363
cx.typing_env(),

clippy_lints/src/types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
447447
let is_exported = cx.effective_visibilities.is_exported(item.owner_id.def_id);
448448

449449
match item.kind {
450-
ItemKind::Static(_, ty, _, _) | ItemKind::Const(_, ty, _, _) => self.check_ty(
450+
ItemKind::Static(_, _, ty, _) | ItemKind::Const(_, _, ty, _) => self.check_ty(
451451
cx,
452452
ty,
453453
CheckTyContext {

clippy_lints/src/unnested_or_patterns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn drain_matching(
426426
// Check if we should extract, but only if `idx >= start`.
427427
if idx > start && predicate(&alternatives[i].kind) {
428428
let pat = alternatives.remove(i);
429-
tail_or.push(extract(pat.into_inner().kind));
429+
tail_or.push(extract(pat.kind));
430430
} else {
431431
i += 1;
432432
}

clippy_lints/src/unused_trait_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedTraitNames {
6464
// Ignore imports that already use Underscore
6565
&& ident.name != kw::Underscore
6666
// Only check traits
67-
&& let Some(Res::Def(DefKind::Trait, _)) = path.res.first()
67+
&& let Some(Res::Def(DefKind::Trait, _)) = path.res.type_ns
6868
&& cx.tcx.maybe_unused_trait_imports(()).contains(&item.owner_id.def_id)
6969
// Only check this import if it is visible to its module only (no pub, pub(crate), ...)
7070
&& let module = cx.tcx.parent_module_from_def_id(item.owner_id.def_id)

clippy_lints/src/upper_case_acronyms.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl LateLintPass<'_> for UpperCaseAcronyms {
134134
ItemKind::TyAlias(ident, ..) | ItemKind::Struct(ident, ..) | ItemKind::Trait(_, _, ident, ..) => {
135135
check_ident(cx, &ident, it.hir_id(), self.upper_case_acronyms_aggressive);
136136
},
137-
ItemKind::Enum(ident, ref enumdef, _) => {
137+
ItemKind::Enum(ident, _, ref enumdef) => {
138138
check_ident(cx, &ident, it.hir_id(), self.upper_case_acronyms_aggressive);
139139
// check enum variants separately because again we only want to lint on private enums and
140140
// the fn check_variant does not know about the vis of the enum of its variants

clippy_lints/src/wildcard_imports.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ impl LateLintPass<'_> for WildcardImports {
169169
format!("{import_source_snippet}::{imports_string}")
170170
};
171171

172-
// Glob imports always have a single resolution.
173-
let (lint, message) = if let Res::Def(DefKind::Enum, _) = use_path.res[0] {
172+
// Glob imports always have a single resolution. Enums are in the value namespace.
173+
let (lint, message) = if let Some(Res::Def(DefKind::Enum, _)) = use_path.res.value_ns {
174174
(ENUM_GLOB_USE, "usage of wildcard import for enum variants")
175175
} else {
176176
(WILDCARD_IMPORTS, "usage of wildcard import")

clippy_lints_internal/src/almost_standard_lint_formulation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl AlmostStandardFormulation {
4545
impl<'tcx> LateLintPass<'tcx> for AlmostStandardFormulation {
4646
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
4747
let mut check_next = false;
48-
if let ItemKind::Static(_, ty, Mutability::Not, _) = item.kind {
48+
if let ItemKind::Static(Mutability::Not, _, ty, _) = item.kind {
4949
let lines = cx
5050
.tcx
5151
.hir_attrs(item.hir_id())

clippy_lints_internal/src/lint_without_lint_pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl_lint_pass!(LintWithoutLintPass => [
105105

106106
impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
107107
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
108-
if let hir::ItemKind::Static(ident, ty, Mutability::Not, body_id) = item.kind {
108+
if let hir::ItemKind::Static(Mutability::Not, ident, ty, body_id) = item.kind {
109109
if is_lint_ref_type(cx, ty) {
110110
check_invalid_clippy_version_attribute(cx, item);
111111

clippy_utils/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This crate is only guaranteed to build with this `nightly` toolchain:
88

99
<!-- begin autogenerated nightly -->
1010
```
11-
nightly-2025-05-31
11+
nightly-2025-06-12
1212
```
1313
<!-- end autogenerated nightly -->
1414

clippy_utils/src/ast_utils/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,5 +960,7 @@ pub fn eq_attr_args(l: &AttrArgs, r: &AttrArgs) -> bool {
960960
}
961961

962962
pub fn eq_delim_args(l: &DelimArgs, r: &DelimArgs) -> bool {
963-
l.delim == r.delim && l.tokens.eq_unspanned(&r.tokens)
963+
l.delim == r.delim
964+
&& l.tokens.len() == r.tokens.len()
965+
&& l.tokens.iter().zip(r.tokens.iter()).all(|(a, b)| a.eq_unspanned(b))
964966
}

clippy_utils/src/check_proc_macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ fn item_search_pat(item: &Item<'_>) -> (Pat, Pat) {
249249
ItemKind::ForeignMod { .. } => (Pat::Str("extern"), Pat::Str("}")),
250250
ItemKind::TyAlias(..) => (Pat::Str("type"), Pat::Str(";")),
251251
ItemKind::Enum(..) => (Pat::Str("enum"), Pat::Str("}")),
252-
ItemKind::Struct(_, VariantData::Struct { .. }, _) => (Pat::Str("struct"), Pat::Str("}")),
252+
ItemKind::Struct(_, _, VariantData::Struct { .. }) => (Pat::Str("struct"), Pat::Str("}")),
253253
ItemKind::Struct(..) => (Pat::Str("struct"), Pat::Str(";")),
254254
ItemKind::Union(..) => (Pat::Str("union"), Pat::Str("}")),
255255
ItemKind::Trait(_, Safety::Unsafe, ..)

clippy_utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,7 @@ fn with_test_item_names(tcx: TyCtxt<'_>, module: LocalModDefId, f: impl FnOnce(&
23632363
for id in tcx.hir_module_free_items(module) {
23642364
if matches!(tcx.def_kind(id.owner_id), DefKind::Const)
23652365
&& let item = tcx.hir_item(id)
2366-
&& let ItemKind::Const(ident, ty, _generics, _body) = item.kind
2366+
&& let ItemKind::Const(ident, _generics, ty, _body) = item.kind
23672367
&& let TyKind::Path(QPath::Resolved(_, path)) = ty.kind
23682368
// We could also check for the type name `test::TestDescAndFn`
23692369
&& let Res::Def(DefKind::Struct, _) = path.res

clippy_utils/src/paths.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,13 @@ fn local_item_child_by_name(tcx: TyCtxt<'_>, local_id: LocalDefId, ns: PathNS, n
306306
let item = tcx.hir_item(item_id);
307307
if let ItemKind::Use(path, UseKind::Single(ident)) = item.kind {
308308
if ident.name == name {
309-
path.res
310-
.iter()
311-
.find(|res| ns.matches(res.ns()))
312-
.and_then(Res::opt_def_id)
309+
let opt_def_id = |ns: Option<Res>| ns.and_then(|res| res.opt_def_id());
310+
match ns {
311+
PathNS::Type => opt_def_id(path.res.type_ns),
312+
PathNS::Value => opt_def_id(path.res.value_ns),
313+
PathNS::Macro => opt_def_id(path.res.macro_ns),
314+
PathNS::Arbitrary => unreachable!(),
315+
}
313316
} else {
314317
None
315318
}

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>
447447
tcx,
448448
ObligationCause::dummy_with_span(body.span),
449449
param_env,
450-
TraitRef::new(tcx, tcx.require_lang_item(LangItem::Destruct, Some(body.span)), [ty]),
450+
TraitRef::new(tcx, tcx.require_lang_item(LangItem::Destruct, body.span), [ty]),
451451
);
452452

453453
let mut selcx = SelectionContext::new(&infcx);

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[toolchain]
22
# begin autogenerated nightly
3-
channel = "nightly-2025-05-31"
3+
channel = "nightly-2025-06-12"
44
# end autogenerated nightly
55
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
66
profile = "minimal"

0 commit comments

Comments
 (0)