Skip to content

fix: improve whitespaces for trait item complete#22240

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:comp-trait-item-ws
May 2, 2026
Merged

fix: improve whitespaces for trait item complete#22240
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:comp-trait-item-ws

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks commented May 1, 2026

Example

trait SomeTrait<T> {}

trait Foo<T> {
    fn function()
    where Self: SomeTrait<T>;
}
impl Foo<u32> for Bar {
    fn f$0
}

Before this PR

impl Foo<u32> for Bar {
    fn function()
        where Self: SomeTrait<u32> {
        $0
    }
}

After this PR

impl Foo<u32> for Bar {
    fn function()
    where Self: SomeTrait<u32>
    {
        $0
    }
}

Example
---
```rust
trait SomeTrait<T> {}

trait Foo<T> {
    fn function()
    where Self: SomeTrait<T>;
}
impl Foo<u32> for Bar {
    fn f$0
}
```

**Before this PR**

```rust
impl Foo<u32> for Bar {
    fn function()
        where Self: SomeTrait<u32> {
        $0
    }
}
```

**After this PR**

```rust
impl Foo<u32> for Bar {
    fn function()
    where Self: SomeTrait<u32>
    {
        $0
    }
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 1, 2026
impl Foo<u32> for Bar {
fn function()
where Self: SomeTrait<u32> {
where Self: SomeTrait<u32>
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 May 2, 2026

Choose a reason for hiding this comment

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

Do you think we should implement in tests the editor functionality that inserts indentation?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This may require adding the concept of 'main edit' for test

I don't think it's necessary

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue May 2, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 2, 2026
@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue May 2, 2026
Merged via the queue into rust-lang:master with commit ddfd9bc May 2, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 2, 2026
@A4-Tacks A4-Tacks deleted the comp-trait-item-ws branch May 3, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants