Configuration

The clippy tool can be very annoying. To tighten or loosen checks, you can configure the tool using the clippy.toml configuration file.

For example, if we activate all lints with the -W clippy::pedantic argument, we can get a warning like this:

warning: you should put `MyCompany` between ticks in the documentation
--> src/main.rs:8:29
|
8 | /// This method connects to MyCompany API.
| ^^^^^^^^^
|
= note: `-W clippy::doc-markdown` implied by `-W clippy::pedantic`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown

This happened because clippy thinks there is the name of a variable that we forget to include in ticks. To avoid this behavior, we can add an extra word to the clippy.toml configuration to ignore markdown comments:

doc-valid-idents = ["MyCompany"]

Now the tool won't interpret MyCompany as the name of a variable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.194.123