rust/tests
bors e2753f9a7b Auto merge of #6662 - Y-Nak:default-numeric-fallback, r=flip1995
New lint: default_numeric_fallback

fixes #6064
r? `@flip1995`

As we discussed in [here](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20.236064/near/224647188) and [here](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20clippy.236064/near/224746333),   I start implementing this lint from the strictest version.
In this PR, I'll allow the below two cases to pass the lint to reduce FPs.

1. Appearances of unsuffixed numeric literals in `Local` if `Local` has a type annotation, for example:
```rust
// Good.
let x: i32 = 1;

// Also good.
let x: (i32, i32) = if cond {
   (1, 2)
} else {
   (2, 3)
};
```

2. Appearances of unsuffixed numeric literals in args of `Call` or `MethodCall`  if corresponding arguments of their signature have concrete types, for example:
```rust
fn foo_mono(x: i32) -> i32 {
    x
}

fn foo_poly<T>(t: T) -> t {
    t
}

// Good.
let x = foo_mono(13);

// Still bad.
let x: i32 = foo_poly(13);
```

changelog: Added restriction lint: `default_numeric_fallback`
2021-02-16 09:58:49 +00:00
..
auxiliary
cargo
ui Auto merge of #6662 - Y-Nak:default-numeric-fallback, r=flip1995 2021-02-16 09:58:49 +00:00
ui-cargo Add back publish = false to the old test. 2021-02-06 17:52:41 +01:00
ui-internal
ui-toml Auto merge of #6650 - daxpedda:cargo-common-metadata-publish, r=flip1995 2021-02-11 09:34:44 +00:00
compile-test.rs Upgrade compiletest-rs to 0.6 and tester to 0.9 2021-02-15 20:13:44 +01:00
dogfood.rs
fmt.rs
integration.rs
missing-test-files.rs Fix/allow non_fmt_panic in clippy tests. 2021-02-03 23:15:51 +01:00
versioncheck.rs tests: ignore check_that_clippy_has_the_same_major_version_as_rustc() inside the rustc repo. 2021-02-06 00:56:54 +01:00