-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
add empty_structs_with_brackets
#8594
Conversation
r? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
18864d4
to
65fe1b3
Compare
☔ The latest upstream changes (presumably #8576) made this pull request unmergeable. Please resolve the merge conflicts. |
Co-authored-by: giraffate <f.seasons017@gmail.com>
5b8e1f9
to
0434b85
Compare
I'm going through it last one time and review this, but it's going to be next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good.
!rustc_lexer::tokenize(braces_span_str).any(|t| t.kind == TokenKind::Ident) | ||
} | ||
|
||
fn is_unit_like_struct(var_data: &VariantData) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits
fn is_unit_like_struct(var_data: &VariantData) -> bool { | |
fn is_empty_struct(var_data: &VariantData) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_unit_like_struct
checks if the struct at hand already has no brackets (i.e. struct Cookie;
). is_empty_struct
sounds like we would check whether the struct is empty or not. struct Cookie {}
is an empty struct, but is_unit_like_struct
/is_empty_struct
will return false on it.
If we want to go way from the "unit-like" term maybe has_no_brackets
is a better function name.
@bors r+ Thanks! |
📌 Commit 58833e5 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Closes #8591
I'm already sorry for the massive diff 😅
changelog: New lint [
empty_structs_with_brackets
]