-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fixes #10609: Adds lint to detect construction of unit struct using default
#10716
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
e64f1c5
to
e9889a4
Compare
Using `default` to construct a unit struct increases code complexity and adds a function call. This can be avoided by simply removing the call to `default` and simply construct by name.
e9889a4
to
9428138
Compare
Co-authored-by: Ruby Lazuli <[email protected]>
Some of the tests fail. Also, this suggestion from the tests seems incorrect:
|
I updated the span to fix the broken suggestion and updated the uitest output to reflect this as well as the updated diagnostics message (forget about that in the last commit) |
Tests still fail, since a bunch of the other tests use this syntax. You should allow this lint in those tests, or update the test code to not have this problem (if possible) |
@bors r+ Thanks! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Using
default
to construct a unit struct increases code complexity and adds a function call. This can be avoided by simply removing the call todefault
and simply construct by name.changelog: [
default_constructed_unit_structs
]: detects construction of unit structs usingdefault
fixes #10609