-
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
Option to disable trivially_copy_pass_by_ref in public functions #4504
Comments
This comment has been minimized.
This comment has been minimized.
If this doesn't exist already, a function |
Just realized, that there is a function |
Hi @flip1995 new to Rust and I wanted to take a crack at this. I saw your comment explaining what needs to be done but its marked outdated anad collapsed, any reason for that? Is that approach not to be followed anymore? |
Hey @palash25 See the comment (#4504 (comment)) above yours. This isn't necessary, since the rust compiler already provides a function for that. |
Oh my bad 😅 got confused. Just to be sure I understand your comments correctly, the desired approach is to use the |
Yes correct.
Yes, I'd suggest to enable/disable the visibility check: if allow_public_flag && is_public() {
return;
} |
@palash25 I just realized, that this is even easier: You can just use the function |
thanks for your help @flip1995 will try to take a stab at this in a day or two |
@flip1995 need a little help with this part
Do I have to somehow reuse allow flag (because it seems lint specific so doesn't make much sense to me) for public functions or implement a new flag for it? |
Actually the clippy help text isn't very helpful I am not able to find out what could be the possible values for |
@palash25 it's explained in the readme: https://github.com/rust-lang/rust-clippy#allowingdenying-lints |
Also this is not the place to look for this kind of configuration. See for example this lint, for how to use a configuration: rust-clippy/clippy_lints/src/functions.rs Lines 88 to 97 in edd9047
rust-clippy/clippy_lints/src/lib.rs Line 538 in 0583181
And this for how to add a configuration option: rust-clippy/clippy_lints/src/utils/conf.rs Lines 133 to 134 in db233b0
To test it, you have to create a |
Running Clippy over Rust repo yields about 100 unique warnings from
trivially_copy_pass_by_ref
, almost all of them were tripped by public functions which are not going to change.Having option to disable it for public functions would help if this and probably other cases.
EDIT:
ptr_arg
have similar issue (but there are only 13 occurrences). Maybe something more generic should be developed?The text was updated successfully, but these errors were encountered: