Skip to content

fix: Improve inserted order for trait_impl_redundant_assoc_item#21695

Open
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:redundant-item-order
Open

fix: Improve inserted order for trait_impl_redundant_assoc_item#21695
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:redundant-item-order

Conversation

@A4-Tacks
Copy link
Member

Example

trait Marker {
    fn foo();
    fn baz();
}
impl Marker for Foo {
    fn foo() {}
    fn missing() {}$0
    fn baz() {}
}

Before this PR

trait Marker {
    fn missing();
    fn foo();
    fn baz();
}
impl Marker for Foo {
    fn foo() {}
    fn missing() {}
    fn baz() {}
}

After this PR

trait Marker {
    fn foo();
    fn missing();
    fn baz();
}
impl Marker for Foo {
    fn foo() {}
    fn missing() {}
    fn baz() {}
}

Example
---
```rust
trait Marker {
    fn foo();
    fn baz();
}
impl Marker for Foo {
    fn foo() {}
    fn missing() {}$0
    fn baz() {}
}
```

**Before this PR**

```rust
trait Marker {
    fn missing();
    fn foo();
    fn baz();
}
impl Marker for Foo {
    fn foo() {}
    fn missing() {}
    fn baz() {}
}
```

**After this PR**

```rust
trait Marker {
    fn foo();
    fn missing();
    fn baz();
}
impl Marker for Foo {
    fn foo() {}
    fn missing() {}
    fn baz() {}
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 23, 2026
@ChayimFriedman2
Copy link
Contributor

I'm not sure we want this complexity. This is a small thing and if the items aren't in the same order as the trait it's not helpful anyway.

@rust-lang/rust-analyzer thoughts?

@flodiebold
Copy link
Member

IMO it's worth it, and the complexity is pretty well-contained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants