-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
too_many_arguments
should ignore functions called new
#1576
Comments
Related: nrc/derive-new#13 |
I'd argue that if there are that many fields, it makes sense to use a |
Perhaps we can special-case the lint message? |
The Builder pattern is a way to gradually build data, it is not necessarily useful to increase abstraction when all the data is known and already present. I believe this can be changed in the following match: rust-clippy/clippy_lints/src/functions/too_many_arguments.rs Lines 19 to 37 in 6ae0835
For the FnKind::Method variant we can check the Ident field to see if it is |
4 years down the line, I'd now disagree with myself, and say that constructors are sometimes better than builders. |
I can see how it might be deemed necessary to have a lot of args for a constructor. But it is still a code smell generally speaking, the lint is not "wrong", and so I don't think a special case should be added. You can |
The recommendation provided by that lint is to group the arguments into a new type, and should probably ignore functions that are almost certainly a constructor for a new type.
The text was updated successfully, but these errors were encountered: