I am running clippy on some rust project, its gives me one error i.e. [deny(clippy::cast_ptr_alignment] and stop compiling other modules. Is it possible to convert that error from deny to allow and let the clippy to compiles other modules of my rust project. Please note that i don't want to disable such deny errors, because if i do this, then i could not see whether this deny error is exist in other modules or not. Actually i want to convert all deny error to allow warnings, so that I would be able to see where these kind of errors exist in which modules of my project.
Actually, I need to change the deny errors to allow warnings, so that I could see all deny errors. Because , if there is any one deny error, then that module (which consist of deny error), could not be compiled. So, I have two options (but i am not sure, whether i can do it or not );
- modify the source of clippy , build it again, and then use it without install or
- change my source code (... #![allow(clippy::all)]) and then do (but i don't know how to do !) ..
Anyone here can help me.. Thanks in advance
Configuration
Some lints can be configured in a TOML file named
clippy.toml
or.clippy.toml
. It contains a basicvariable = value
mapping eg.blacklisted-names = ["toto", "tata", "titi"] cognitive-complexity-threshold = 30
See the list of lints for more information about which lints can be configured and the
meaning of the variables.To deactivate the “for further information visit lint-link” message you can
define theCLIPPY_DISABLE_DOCS_LINKS
environment variable.Allowing/denying lints
You can add options to your code to
allow
/warn
/deny
Clippy lints:
the whole set of
Warn
lints using theclippy
lint group (#![deny(clippy::all)]
)all lints using both the
clippy
andclippy::pedantic
lint groups (#![deny(clippy::all)]
,
#![deny(clippy::pedantic)]
). Note thatclippy::pedantic
contains some very aggressive
lints prone to false positives.only some lints (
#![deny(clippy::single_match, clippy::box_vec)]
, etc)
allow
/warn
/deny
can be limited to a single function or module using#[allow(...)]
, etcNote:
deny
produces errors instead of warnings.If you do not want to include your lint levels in your code, you can globally enable/disable lints by passing extra flags to Clippy during the run:
cargo clippy -- -A clippy::lint_name
will run Clippy withlint_name
disabled andcargo clippy -- -W clippy::lint_name
will run it with that enabled. This also works with lint groups. For example you can run Clippy with warnings for all lints enabled:cargo clippy -- -W clippy::pedantic
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.