Skip to content

Commit f7a97cc

Browse files
authored
Rollup merge of #141675 - nnethercote:ItemKind-field-order, r=fee1-dead
Reorder `ast::ItemKind::{Struct,Enum,Union}` fields. So they match the order of the parts in the source code, e.g.: ``` struct Foo<T, U> { t: T, u: U } <-><----> <------------> / | \ ident generics variant_data ``` r? `@fee1-dead`
2 parents eeb4fa4 + cb27c8a commit f7a97cc

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

clippy_lints/src/field_scoped_visibility_modifiers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ declare_lint_pass!(FieldScopedVisibilityModifiers => [FIELD_SCOPED_VISIBILITY_MO
5151

5252
impl EarlyLintPass for FieldScopedVisibilityModifiers {
5353
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
54-
let ItemKind::Struct(_, ref st, _) = item.kind else {
54+
let ItemKind::Struct(_, _, ref st) = item.kind else {
5555
return;
5656
};
5757
for field in st.fields() {

clippy_lints/src/partial_pub_fields.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ declare_lint_pass!(PartialPubFields => [PARTIAL_PUB_FIELDS]);
4141

4242
impl EarlyLintPass for PartialPubFields {
4343
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
44-
let ItemKind::Struct(_, ref st, _) = item.kind else {
44+
let ItemKind::Struct(_, _, ref st) = item.kind else {
4545
return;
4646
};
4747

clippy_utils/src/ast_utils/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,11 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
436436
&& over(lb, rb, eq_generic_bound)
437437
&& both(lt.as_ref(), rt.as_ref(), |l, r| eq_ty(l, r))
438438
},
439-
(Enum(li, le, lg), Enum(ri, re, rg)) => {
440-
eq_id(*li, *ri) && over(&le.variants, &re.variants, eq_variant) && eq_generics(lg, rg)
439+
(Enum(li, lg, le), Enum(ri, rg, re)) => {
440+
eq_id(*li, *ri) && eq_generics(lg, rg) && over(&le.variants, &re.variants, eq_variant)
441441
},
442-
(Struct(li, lv, lg), Struct(ri, rv, rg)) | (Union(li, lv, lg), Union(ri, rv, rg)) => {
443-
eq_id(*li, *ri) && eq_variant_data(lv, rv) && eq_generics(lg, rg)
442+
(Struct(li, lg, lv), Struct(ri, rg, rv)) | (Union(li, lg, lv), Union(ri, rg, rv)) => {
443+
eq_id(*li, *ri) && eq_generics(lg, rg) && eq_variant_data(lv, rv)
444444
},
445445
(
446446
Trait(box ast::Trait {

0 commit comments

Comments
 (0)