mem_replace: clean-up#17190
Conversation
|
rustbot has assigned @samueltardieu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
@samueltardieu I could alternatively just include the attribute clean-up in this PR -- that would have the benefit of making this PR more standalone, but would require you to rebase your PR on top of this one later. Which option would you prefer? |
|
Lintcheck changes for 2ae2877
This comment will be updated if you push new changes |
No preference. If you make this PR standalone, just ping me and I'll review it and rebase the other once merged. |
47cb899 to
99f6d5c
Compare
|
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. |
99f6d5c to
a12f9cf
Compare
Okay, did that. Ping-ping! |
|
huh, what is this |
a12f9cf to
09a9e13
Compare
- unify wording - `mem_replace_with_default`: split off the suggestion message from the main message - mention the method to use in the suggestion message as well -- the suggestion message should be understandable on its own, without the diff
abfe3f2 to
b44613c
Compare
|
Reminder, once the PR becomes ready for a review, use |
- remove unused attributes - add `warn`s for _all_ the lints tested - remove `fn main` from the no-std test, so that it's considered a lib and thus doesn't need the no-std boilerplate - use shorthand error patterns
- Turns out to be a test for `mem_replace_with_uninit` - Extract the one unfixable case into a separate file - Clean-up attributes, now with comments!
b44613c to
d9433e7
Compare
Note that this doesn't migrate the no-std test for issue9824. The motivation is that the no-std file is usually supposed to just test that the basic functionality of the lint works in no-std, which boils down to `std` being properly replaced with `core`. Bringing a reproducer for a separate issue thus doesn't add much value.
d9433e7 to
2ae2877
Compare
|
Sorry for the second force-push, here's the complete diff: https://github.com/rust-lang/rust-clippy/compare/b44613c3e583e9fcfb1a8def8f38e2082dc16413..2ae28777f3ecde1311f3b39e72d5332bad430e1c |
This ended up being bigger than I expected...
This PR mainly does the following:
mem_replace.rsused to testmem_replace_{option_with_none,option_with_some,default}, which resulted in a rather big and messy file. Commits 4-6 split it into three.mem_replace_with_uninitwas tested in a completely separate file, calledrepl_uninit(?!). Commit 3 renames it and cleans it up.As always, see the individual commits for more details.
changelog: [
mem_replace_option_with_some]: clean-up the lint messagechangelog: [
mem_replace_option_with_none]: clean-up the lint messagechangelog: [
mem_replace_with_uninit]: clean-up the lint messagechangelog: [
mem_replace_with_default]: split off the suggestion from the main message