Skip to content

feature: add a "Add attribute" assist #12296

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

Merged
merged 1 commit into from
May 17, 2022
Merged

feature: add a "Add attribute" assist #12296

merged 1 commit into from
May 17, 2022

Conversation

jonas-schievink
Copy link
Contributor

This generalizes the "Add #[derive]" assist and supports adding #[must_use] and #[inline].

Removes #[must_use] from the "Generate getter/setter" assist, addressing the last point in #12273. Closes #12273.

@jonas-schievink
Copy link
Contributor Author

@bors r+

@bors
Copy link
Contributor

bors commented May 17, 2022

📌 Commit cb135ae has been approved by jonas-schievink

@bors
Copy link
Contributor

bors commented May 17, 2022

⌛ Testing commit cb135ae with merge 52b69fa...

@bors
Copy link
Contributor

bors commented May 17, 2022

☀️ Test successful - checks-actions
Approved by: jonas-schievink
Pushing 52b69fa to master...

@bors bors merged commit 52b69fa into rust-lang:master May 17, 2022
@jonas-schievink jonas-schievink deleted the add-attribute-assist branch May 17, 2022 18:39
@matklad
Copy link
Member

matklad commented May 20, 2022

Hm, not entirely sure it's a good idea :) "add derive" is something I use very frequently, and this adds an extra step to that. I'd probably leave #[must_use] to the completion

@jonas-schievink
Copy link
Contributor Author

Yeah, this assist doesn't currently work that well. I'll probably revert it.

@jonas-schievink jonas-schievink changed the title feat: add a "Add attribute" assist minor: add a "Add attribute" assist May 20, 2022
@jonas-schievink jonas-schievink changed the title minor: add a "Add attribute" assist feature: add a "Add attribute" assist May 20, 2022
bors added a commit that referenced this pull request May 20, 2022
feat: Revert the "Add attribute" assist

Reverts #12296, as the added indirection and "assist noise" (the assist has to trigger inside the body of an item to match what the "Add `#[derive]`" does) makes this not really pull its weight over just using attribute completions.

Keeps the changes to "Add getter". `#[must_use]` can be applied using the attribute completions.
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.

"Generate getter/setter" is too opinionated
3 participants