How to convert some Clippy lints from Deny to allow Globally

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 );

  1. modify the source of clippy , build it again, and then use it without install or
  2. 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 basic variable = 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 the CLIPPY_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 the clippy lint group (#![deny(clippy::all)])

  • all lints using both the clippy and clippy::pedantic lint groups (#![deny(clippy::all)],
    #![deny(clippy::pedantic)]). Note that clippy::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(...)], etc

Note: 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 with lint_name disabled and cargo 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.