about summary refs log tree commit diff
path: root/src/test/codegen/integer-overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-05-15 21:55:43 +0000
committerbors <bors@rust-lang.org>2020-05-15 21:55:43 +0000
commitcac9ad02cf952f16bd8b00797f5bb1dbc30e692e (patch)
tree3623294adebe49aacc1b12e634784c8c1f85c361 /src/test/codegen/integer-overflow.rs
parente22ccf53322a1a9caeca955802e1f8f07c4c47a0 (diff)
parent95399f8f941b89785c6e9d94e0bc32ff5d43ba06 (diff)
downloadrust-cac9ad02cf952f16bd8b00797f5bb1dbc30e692e.tar.gz
rust-cac9ad02cf952f16bd8b00797f5bb1dbc30e692e.zip
Auto merge of #5599 - dtolnay:letif, r=flip1995
Downgrade useless_let_if_seq to nursery

I feel that this lint has the wrong balance of incorrect suggestions for a default-enabled lint.

The immediate code I faced was something like:

```rust
fn main() {
    let mut good = do1();
    if !do2() {
        good = false;
    }
    if good {
        println!("good");
    }
}

fn do1() -> bool { println!("1"); false }
fn do2() -> bool { println!("2"); false }
```

On this code Clippy calls it unidiomatic and suggests the following diff, which has different behavior in a way that I don't necessarily want.

```diff
- let mut good = do1();
- if !do2() {
-     good = false;
- }
+ let good = if !do2() {
+     false
+ } else {
+     do1()
+ };
```

On exploring issues filed about this lint, I have found that other users have also struggled with inappropriate suggestions (https://github.com/rust-lang/rust-clippy/issues/4124, https://github.com/rust-lang/rust-clippy/issues/3043, https://github.com/rust-lang/rust-clippy/issues/2918, https://github.com/rust-lang/rust-clippy/issues/2176) and suggestions that make the code worse (https://github.com/rust-lang/rust-clippy/issues/3769, https://github.com/rust-lang/rust-clippy/issues/2749). Overall I believe that this lint is still at nursery quality for now and should not be enabled.

---

changelog: Remove useless_let_if_seq from default set of enabled lints
Diffstat (limited to 'src/test/codegen/integer-overflow.rs')
0 files changed, 0 insertions, 0 deletions