Skip to content

Remove doc comments for generate_trait_from_impl#20407

Merged
A4-Tacks merged 1 commit intorust-lang:masterfrom
A4-Tacks:remove-doc-for-gen-trait
Mar 20, 2026
Merged

Remove doc comments for generate_trait_from_impl#20407
A4-Tacks merged 1 commit intorust-lang:masterfrom
A4-Tacks:remove-doc-for-gen-trait

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented Aug 8, 2025

Input:

struct Foo(f64);

impl F$0oo {
    /// Add `x`
    ///
    /// # Examples
    fn add(&mut self, x: f64) {
        self.0 += x;
    }
}

This PR:

struct Foo(f64);

trait NewTrait {
    /// Add `x`
    ///
    /// # Examples
    fn add(&mut self, x: f64);
}

impl NewTrait for Foo {
    fn add(&mut self, x: f64) {
        self.0 += x;
    }
}

Old:

struct Foo(f64);

trait NewTrait {
    /// Add `x`
    ///
    /// # Examples
    fn add(&mut self, x: f64);
}

impl NewTrait for Foo {
    /// Add `x`
    ///
    /// # Examples
    fn add(&mut self, x: f64) {
        self.0 += x;
    }
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 8, 2025
@ChayimFriedman2
Copy link
Contributor

I'm not sure this is preferred. r-a does show the doc comment from the trait if there is none on the impl, but sometimes it's nicer to have it on the impl as well.

Although they could go out of sync...

@A4-Tacks
Copy link
Member Author

A4-Tacks commented Aug 8, 2025

Add another assistant to add documents from the trait?

@A4-Tacks
Copy link
Member Author

A4-Tacks commented Aug 9, 2025

Add another assistant to add documents from the trait?

Ok

@rustbot

This comment has been minimized.

Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

I've changed my opinion and I now like this PR. You can rebase and merge.

View changes since this review

@A4-Tacks A4-Tacks force-pushed the remove-doc-for-gen-trait branch from be6dafc to 5caf836 Compare March 20, 2026 10:52
@rustbot
Copy link
Collaborator

rustbot commented Mar 20, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@A4-Tacks A4-Tacks force-pushed the remove-doc-for-gen-trait branch from 5caf836 to 1eeb948 Compare March 20, 2026 10:53
**Input**:

```rust
struct Foo(f64);

impl F$0oo {
    /// Add `x`
    ///
    /// # Examples
    fn add(&mut self, x: f64) {
        self.0 += x;
    }
}
```

**This PR**:

```rust
struct Foo(f64);

trait NewTrait {
    /// Add `x`
    ///
    /// # Examples
    fn add(&mut self, x: f64);
}

impl NewTrait for Foo {
    fn add(&mut self, x: f64) {
        self.0 += x;
    }
}
```

**Old**:

```rust
struct Foo(f64);

trait NewTrait {
    /// Add `x`
    ///
    /// # Examples
    fn add(&mut self, x: f64);
}

impl NewTrait for Foo {
    /// Add `x`
    ///
    /// # Examples
    fn add(&mut self, x: f64) {
        self.0 += x;
    }
}
```
@A4-Tacks A4-Tacks force-pushed the remove-doc-for-gen-trait branch from 1eeb948 to dbe9af6 Compare March 20, 2026 10:57
@A4-Tacks A4-Tacks enabled auto-merge March 20, 2026 11:04
@A4-Tacks A4-Tacks added this pull request to the merge queue Mar 20, 2026
Merged via the queue into rust-lang:master with commit c19bfd2 Mar 20, 2026
17 checks passed
@A4-Tacks A4-Tacks deleted the remove-doc-for-gen-trait branch March 20, 2026 11:16
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 20, 2026
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