Configuration

Even if we will check individual lints in the next section, we will now see how we can configure the whole Clippy execution. Clippy will read the clippy.toml file at the same level as the Cargo.toml file and act accordingly.

Some lints have configuration parameters. For instance, the cyclomatic complexity lint will alert you whenever a function has more than 25 branches. As we saw in Chapter 1Common Performance Pitfalls, this is bad practice, since it will make the optimizations of the code much harder for the compiler, creating less performant code.

However, you can change the threshold that creates the warning. 25 is a fair amount of branches, but depending on your product, you would prefer not to have more than 20 branches ...

Get Rust High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.