3

Add configuration options to `--explain` by blyxyas · Pull Request #10751 · rust...

 1 year ago
source link: https://github.com/rust-lang/rust-clippy/pull/10751
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Contributor

@blyxyas blyxyas

commented

May 5, 2023

edited by xFrednet

This PR rearranges some modules, taking metadata_collector out of internal_lints and making public just the necessary functions for explain() to use.

The output looks something like this:

$ cargo run --bin cargo-clippy --manifest-path ../rust-clippy/Cargo.toml -- --explain cognitive_complexity
### What it does
Checks for methods with high cognitive complexity.

### Why is this bad?
Methods of high cognitive complexity tend to be hard to
both read and maintain. Also LLVM will tend to optimize small methods better.

### Known problems
Sometimes it's hard to find a way to reduce the
complexity.

### Example
You'll see it when you get the warning.

========================================
Configuration for clippy::cognitive_complexity:
- cognitive-complexity-threshold: The maximum cognitive complexity a function can have (default: 25)

Fixes #9990
r? @xFrednet


changelog: Docs: cargo clippy --explain LINT now shows possible configuration options for the explained lint
#10751


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK