Skip to content

Respect #[doc(hidden)] when generating trait impls #14957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
m0rg-dev opened this issue Jun 3, 2023 · 1 comment · Fixed by #15050
Closed

Respect #[doc(hidden)] when generating trait impls #14957

m0rg-dev opened this issue Jun 3, 2023 · 1 comment · Fixed by #15050
Assignees
Labels
A-assists C-feature Category: feature request

Comments

@m0rg-dev
Copy link
Contributor

m0rg-dev commented Jun 3, 2023

Currently, if you write something like

struct Foo;

impl Eq for Foo { /* $0 */ }

and trigger the Implement default members assist, it fills it out like this:

impl Eq for Foo {
    fn assert_receiver_is_total_eq(&self) {}
}

However, assert_receiver_is_total_eq is marked #[doc(hidden)], has a default implementation, and has a comment stating This should never be implemented by hand. I'd assume (admittedly not based on any particular evidence past a gut-feeling) that any trait member function that's both #[doc(hidden)] and has a default implementation shouldn't be implemented by hand, and therefore r-a shouldn't generate templates for them.

@m0rg-dev m0rg-dev added the C-feature Category: feature request label Jun 3, 2023
@lowr lowr added the A-assists label Jun 4, 2023
@alibektas
Copy link
Member

@rustbot claim

alibektas added a commit to alibektas/rust-analyzer that referenced this issue Jun 13, 2023
alibektas added a commit to alibektas/rust-analyzer that referenced this issue Jun 22, 2023
bors added a commit that referenced this issue Aug 1, 2023
bugfix :  skip doc(hidden) default members

fixes  #14957 . I have two questions :

1.  I am definitely looking for a more idiomatic way for the things I added in `crates/ide-assists/src/utils.rs`. See `FIXME` in that file.
2. Would it be actually better to change `DefaultMethods` to something like

```rust
enum DefaultMethods {
     Only( IgnoreHidden ( bool ) ) ,
     None
}
```

instead of adding a boolean to every function that calls `crates/ide-assists/src/utils.rs::filter_assoc_items`
@bors bors closed this as completed in 0df1153 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists C-feature Category: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants