rust/tests
bors d9241640e8 Auto merge of #6435 - xFrednet:5552-false-positive-match-single-binding, r=ebroto
Fixing a false positive for the `match_single_binding` lint #5552

This is a fix for a false positive in the `match_single_binding` lint when using `#[cfg()]` on a branch. It is sadly a bit hacky but maybe the best solution as rust removes the other branch from the AST before we can even validate it. This fix looks at the code snippet itself and returns if it includes another thick arrow `=>` besides the one matching arm we found. This can again cause false negatives if someone has the following code:
```rust
match x {
    // => <-- Causes a false negative
    _ => 1,
}
```

I thought about making the code more complex and maybe validating against other things like the `#[cfg()]` macro but I believe that this is the best solution. This has basically switched the issue from a false positive to a false negative in a very specific case.

I'm happy to make some changes if you have any suggestions 🙃.

---
Fixes #5552

changelog: Fixed a false positive in the `match_single_binding` lint with `#[cfg()]` macro
2020-12-13 21:28:38 +00:00
..
auxiliary
cargo
ui Auto merge of #6435 - xFrednet:5552-false-positive-match-single-binding, r=ebroto 2020-12-13 21:28:38 +00:00
ui-cargo Rewrite update-all-references bash scripts in Rust 2020-12-12 15:09:57 +01:00
ui-internal add internal-lints feature to enable clippys internal lints (off by default) 2020-11-29 21:07:43 +01:00
ui-toml Rewrite update-all-references bash scripts in Rust 2020-12-12 15:09:57 +01:00
compile-test.rs add internal-lints feature to enable clippys internal lints (off by default) 2020-11-29 21:07:43 +01:00
dogfood.rs Pass Clippy args also trough RUSTFLAGS 2020-12-13 15:43:20 +01:00
fmt.rs
integration.rs Error in integration test, if required toolchain is not installed 2020-12-10 12:44:27 +01:00
missing-test-files.rs
versioncheck.rs