-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Check structs and enums for use_self
#15566
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
base: master
Are you sure you want to change the base?
Conversation
Lintcheck changes for 292d7ef
This comment will be updated if you push new changes |
Hello. The implementation of this change turned out to be almost suspiciously easy. I tried to be thorough with testing. Happy to add more cases (lifetimes, etc). I browsed through the new lintcheck added lines. They seem to be fine. There are a few changed lines, but they seem unrelated to this PR? Not sure. Probably need doc changes here or there too. Will do if changes are okay. |
Hi Nick! |
0b641e4
to
cb6a211
Compare
This comment has been minimized.
This comment has been minimized.
Addressed @ada4a 's comments. Updated Clippy sites flagged by lint. Eagerly awaiting feature thaw 🐈 |
cb6a211
to
fb748b4
Compare
This comment has been minimized.
This comment has been minimized.
fb748b4
to
c01764b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c01764b
to
83ebe9a
Compare
This comment has been minimized.
This comment has been minimized.
I'm not sure if we want to actually go forward with this. Like, using They're hosted on our channel on Zulip =^w^= |
Recursive #[derive(Clone, Copy)]
enum NormalizedPat<'a> {
Wild,
Never,
Struct(Option<DefId>, &'a [(Symbol, Self)]), // <--
Tuple(Option<DefId>, &'a [Self]), // <--
Or(&'a [Self]), // <--
Path(Option<DefId>),
LitStr(Symbol),
LitBytes(ByteSymbol),
LitInt(u128),
LitBool(bool),
Range(PatRange),
/// A slice pattern. If the second value is `None`, then this matches an exact size. Otherwise
/// the first value contains everything before the `..` wildcard pattern, and the second value
/// contains everything afterwards. Note that either side, or both sides, may contain zero
/// patterns.
Slice(&'a [Self], Option<&'a [Self]>), // <--
/// A placeholder for a pattern that wasn't well formed in some way.
Err(ErrorGuaranteed),
} Use of If Part of the purpose of a linter like Clippy is to encourage use of language features. "I see you have a recursive |
Hello. I would like to get this merged soon. Sounds like the result of the meeting is to add this new check, but include a config option to disable it. What should be the name / description of the option? |
This comment has been minimized.
This comment has been minimized.
83ebe9a
to
292d7ef
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. |
Recent change #15773 illustrates the benefits of |
Closes #15555
changelog: [
use_self
]: Check structs and enumsSummary Notes
Managed by
@rustbot
—see help for details