mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
Merge pull request #1766 from Manishearth/testing_refactor
Make most tests an `example` so we can run them one by one
This commit is contained in:
commit
9ceb01bc73
285 changed files with 3987 additions and 3857 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -15,6 +15,7 @@ out
|
|||
# Generated by Cargo
|
||||
/target/
|
||||
/clippy_lints/target/
|
||||
/clippy_tests/target/
|
||||
|
||||
# We don't pin yet
|
||||
Cargo.lock
|
||||
|
@ -32,4 +33,4 @@ helper.txt
|
|||
|
||||
*.stdout
|
||||
|
||||
.vscode
|
||||
.vscode
|
||||
|
|
|
@ -11,7 +11,7 @@ sudo: false
|
|||
cache:
|
||||
cargo: true
|
||||
directories:
|
||||
- clippy_lints/target
|
||||
- clippy_tests/target
|
||||
|
||||
env:
|
||||
global:
|
||||
|
@ -31,7 +31,7 @@ script:
|
|||
- cargo build --features debugging
|
||||
- cargo test --features debugging
|
||||
- mkdir -p ~/rust/cargo/bin
|
||||
- cp target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy
|
||||
- cp clippy_tests/target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy
|
||||
- PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy
|
||||
- cd clippy_lints && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ..
|
||||
- set +e
|
||||
|
|
|
@ -39,10 +39,15 @@ Compiling clippy can take almost a minute or more depending on your machine.
|
|||
You can set the environment flag `CARGO_INCREMENTAL=1` to cut down that time to
|
||||
almost a third on average, depending on the influence your change has.
|
||||
|
||||
Clippy uses UI tests. UI tests check that the output of the compiler is exactly as expected.
|
||||
Of course there's little sense in writing the output yourself or copying it around.
|
||||
Therefore you can simply run `tests/ui/update-all-references.sh` and check whether
|
||||
the output looks as you expect with `git diff`. Commit all `*.stderr` files, too.
|
||||
Clippy uses its own version of UI tests. Run `cargo test examples` to run only the ui tests.
|
||||
This will update all the `*.stderr` files in `clippy_tests/examples`. You need to check
|
||||
the stderr files whether they look as you expected them and commit them together with your
|
||||
changes.
|
||||
When you want to test a new lint, just create a new file in `clippy_tests/examples` and
|
||||
rerun `cargo test examples`.
|
||||
|
||||
You can check just one example by running `cargo run --example example_name` inside the
|
||||
`clippy_tests` directory.
|
||||
|
||||
Also please document your lint with a doc comment akin to the following:
|
||||
```rust
|
||||
|
|
|
@ -14,6 +14,7 @@ readme = "README.md"
|
|||
license = "MPL-2.0"
|
||||
keywords = ["clippy", "lint", "plugin"]
|
||||
categories = ["development-tools", "development-tools::cargo-plugins"]
|
||||
workspace = "clippy_tests"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "Manishearth/rust-clippy" }
|
||||
|
@ -36,6 +37,7 @@ cargo_metadata = "0.2"
|
|||
|
||||
[dev-dependencies]
|
||||
compiletest_rs = "0.2.6"
|
||||
duct = "0.8.2"
|
||||
lazy_static = "0.2"
|
||||
regex = "0.2"
|
||||
serde_derive = "1.0"
|
||||
|
|
|
@ -26,7 +26,7 @@ test_script:
|
|||
- set RUST_BACKTRACE=1
|
||||
- cargo build --features debugging
|
||||
- cargo test --features debugging
|
||||
- copy target\debug\cargo-clippy.exe C:\Users\appveyor\.cargo\bin\
|
||||
- copy clippy_tests\target\debug\cargo-clippy.exe C:\Users\appveyor\.cargo\bin\
|
||||
- cargo clippy -- -D clippy
|
||||
- cd clippy_lints && cargo clippy -- -D clippy && cd ..
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ repository = "https://github.com/Manishearth/rust-clippy"
|
|||
readme = "README.md"
|
||||
license = "MPL-2.0"
|
||||
keywords = ["clippy", "lint", "plugin"]
|
||||
workspace = "../clippy_tests"
|
||||
|
||||
[dependencies]
|
||||
matches = "0.1.2"
|
||||
|
|
9
clippy_tests/Cargo.toml
Normal file
9
clippy_tests/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "clippy_tests"
|
||||
version = "0.1.0"
|
||||
authors = ["Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>"]
|
||||
|
||||
[dependencies]
|
||||
clippy = { path = ".." }
|
||||
|
||||
[workspace]
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(absurd_extreme_comparisons)]
|
||||
#![warn(absurd_extreme_comparisons)]
|
||||
#![allow(unused, eq_op, no_effect, unnecessary_operation, needless_pass_by_value)]
|
||||
|
||||
fn main() {
|
|
@ -1,151 +1,166 @@
|
|||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:10:5
|
||||
--> absurd-extreme-comparisons.rs:10:5
|
||||
|
|
||||
10 | u <= 0;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/absurd-extreme-comparisons.rs:4:9
|
||||
|
|
||||
4 | #![deny(absurd_extreme_comparisons)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because 0 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 0 instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:11:5
|
||||
--> absurd-extreme-comparisons.rs:11:5
|
||||
|
|
||||
11 | u <= Z;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == Z instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:12:5
|
||||
--> absurd-extreme-comparisons.rs:12:5
|
||||
|
|
||||
12 | u < Z;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because Z is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:13:5
|
||||
--> absurd-extreme-comparisons.rs:13:5
|
||||
|
|
||||
13 | Z >= u;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using Z == u instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:14:5
|
||||
--> absurd-extreme-comparisons.rs:14:5
|
||||
|
|
||||
14 | Z > u;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because Z is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:15:5
|
||||
--> absurd-extreme-comparisons.rs:15:5
|
||||
|
|
||||
15 | u > std::u32::MAX;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:16:5
|
||||
--> absurd-extreme-comparisons.rs:16:5
|
||||
|
|
||||
16 | u >= std::u32::MAX;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == std::u32::MAX instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:17:5
|
||||
--> absurd-extreme-comparisons.rs:17:5
|
||||
|
|
||||
17 | std::u32::MAX < u;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:18:5
|
||||
--> absurd-extreme-comparisons.rs:18:5
|
||||
|
|
||||
18 | std::u32::MAX <= u;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using std::u32::MAX == u instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:19:5
|
||||
--> absurd-extreme-comparisons.rs:19:5
|
||||
|
|
||||
19 | 1-1 > u;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because 1-1 is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:20:5
|
||||
--> absurd-extreme-comparisons.rs:20:5
|
||||
|
|
||||
20 | u >= !0;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because !0 is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == !0 instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:21:5
|
||||
--> absurd-extreme-comparisons.rs:21:5
|
||||
|
|
||||
21 | u <= 12 - 2*6;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because 12 - 2*6 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 12 - 2*6 instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:23:5
|
||||
--> absurd-extreme-comparisons.rs:23:5
|
||||
|
|
||||
23 | i < -127 - 1;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because -127 - 1 is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:24:5
|
||||
--> absurd-extreme-comparisons.rs:24:5
|
||||
|
|
||||
24 | std::i8::MAX >= i;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because std::i8::MAX is the maximum value for this type, this comparison is always true
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:25:5
|
||||
--> absurd-extreme-comparisons.rs:25:5
|
||||
|
|
||||
25 | 3-7 < std::i32::MIN;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because std::i32::MIN is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:27:5
|
||||
--> absurd-extreme-comparisons.rs:27:5
|
||||
|
|
||||
27 | b >= true;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because true is the maximum value for this type, the case where the two sides are not equal never occurs, consider using b == true instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:28:5
|
||||
--> absurd-extreme-comparisons.rs:28:5
|
||||
|
|
||||
28 | false > b;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because false is the minimum value for this type, this comparison is always false
|
||||
|
||||
warning: <-comparison of unit values detected. This will always be false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:31:5
|
||||
error: <-comparison of unit values detected. This will always be false
|
||||
--> absurd-extreme-comparisons.rs:31:5
|
||||
|
|
||||
31 | () < {};
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: #[warn(unit_cmp)] on by default
|
||||
= note: `-D unit-cmp` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
error: aborting due to 18 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(approx_constant)]
|
||||
#[warn(approx_constant)]
|
||||
#[allow(unused, shadow_unrelated, similar_names)]
|
||||
fn main() {
|
||||
let my_e = 2.7182;
|
|
@ -1,122 +1,157 @@
|
|||
error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:7:16
|
||||
--> approx_const.rs:7:16
|
||||
|
|
||||
7 | let my_e = 2.7182;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/approx_const.rs:4:8
|
||||
|
|
||||
4 | #[deny(approx_constant)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:8:20
|
||||
--> approx_const.rs:8:20
|
||||
|
|
||||
8 | let almost_e = 2.718;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_1_PI` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:11:24
|
||||
--> approx_const.rs:11:24
|
||||
|
|
||||
11 | let my_1_frac_pi = 0.3183;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:14:28
|
||||
--> approx_const.rs:14:28
|
||||
|
|
||||
14 | let my_frac_1_sqrt_2 = 0.70710678;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:15:32
|
||||
--> approx_const.rs:15:32
|
||||
|
|
||||
15 | let almost_frac_1_sqrt_2 = 0.70711;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_2_PI` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:18:24
|
||||
--> approx_const.rs:18:24
|
||||
|
|
||||
18 | let my_frac_2_pi = 0.63661977;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_2_SQRT_PI` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:21:27
|
||||
--> approx_const.rs:21:27
|
||||
|
|
||||
21 | let my_frac_2_sq_pi = 1.128379;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_PI_2` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:24:24
|
||||
--> approx_const.rs:24:24
|
||||
|
|
||||
24 | let my_frac_pi_2 = 1.57079632679;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_PI_3` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:27:24
|
||||
--> approx_const.rs:27:24
|
||||
|
|
||||
27 | let my_frac_pi_3 = 1.04719755119;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_PI_4` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:30:24
|
||||
--> approx_const.rs:30:24
|
||||
|
|
||||
30 | let my_frac_pi_4 = 0.785398163397;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_PI_6` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:33:24
|
||||
--> approx_const.rs:33:24
|
||||
|
|
||||
33 | let my_frac_pi_6 = 0.523598775598;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::FRAC_PI_8` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:36:24
|
||||
--> approx_const.rs:36:24
|
||||
|
|
||||
36 | let my_frac_pi_8 = 0.3926990816987;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::LN_10` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:39:20
|
||||
--> approx_const.rs:39:20
|
||||
|
|
||||
39 | let my_ln_10 = 2.302585092994046;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::LN_2` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:42:19
|
||||
--> approx_const.rs:42:19
|
||||
|
|
||||
42 | let my_ln_2 = 0.6931471805599453;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::LOG10_E` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:45:22
|
||||
--> approx_const.rs:45:22
|
||||
|
|
||||
45 | let my_log10_e = 0.43429448190325182;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::LOG2_E` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:48:21
|
||||
--> approx_const.rs:48:21
|
||||
|
|
||||
48 | let my_log2_e = 1.4426950408889634;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:51:17
|
||||
--> approx_const.rs:51:17
|
||||
|
|
||||
51 | let my_pi = 3.1415;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:52:21
|
||||
--> approx_const.rs:52:21
|
||||
|
|
||||
52 | let almost_pi = 3.14;
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::SQRT_2` found. Consider using it directly
|
||||
--> $DIR/approx_const.rs:55:18
|
||||
--> approx_const.rs:55:18
|
||||
|
|
||||
55 | let my_sq2 = 1.4142;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D approx-constant` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 19 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(integer_arithmetic, float_arithmetic)]
|
||||
#![warn(integer_arithmetic, float_arithmetic)]
|
||||
#![allow(unused, shadow_reuse, shadow_unrelated, no_effect, unnecessary_operation)]
|
||||
fn main() {
|
||||
let i = 1i32;
|
94
clippy_tests/examples/arithmetic.stderr
Normal file
94
clippy_tests/examples/arithmetic.stderr
Normal file
|
@ -0,0 +1,94 @@
|
|||
error: integer arithmetic detected
|
||||
--> arithmetic.rs:8:5
|
||||
|
|
||||
8 | 1 + i;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D integer-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: integer arithmetic detected
|
||||
--> arithmetic.rs:9:5
|
||||
|
|
||||
9 | i * 2;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D integer-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: integer arithmetic detected
|
||||
--> arithmetic.rs:10:5
|
||||
|
|
||||
10 | / 1 %
|
||||
11 | | i / 2; // no error, this is part of the expression in the preceding line
|
||||
| |_________^
|
||||
|
|
||||
= note: `-D integer-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: integer arithmetic detected
|
||||
--> arithmetic.rs:12:5
|
||||
|
|
||||
12 | i - 2 + 2 - i;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D integer-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: integer arithmetic detected
|
||||
--> arithmetic.rs:13:5
|
||||
|
|
||||
13 | -i;
|
||||
| ^^
|
||||
|
|
||||
= note: `-D integer-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: floating-point arithmetic detected
|
||||
--> arithmetic.rs:23:5
|
||||
|
|
||||
23 | f * 2.0;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D float-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: floating-point arithmetic detected
|
||||
--> arithmetic.rs:25:5
|
||||
|
|
||||
25 | 1.0 + f;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D float-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: floating-point arithmetic detected
|
||||
--> arithmetic.rs:26:5
|
||||
|
|
||||
26 | f * 2.0;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D float-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: floating-point arithmetic detected
|
||||
--> arithmetic.rs:27:5
|
||||
|
|
||||
27 | f / 2.0;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D float-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: floating-point arithmetic detected
|
||||
--> arithmetic.rs:28:5
|
||||
|
|
||||
28 | f - 2.0 * 4.2;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D float-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: floating-point arithmetic detected
|
||||
--> arithmetic.rs:29:5
|
||||
|
|
||||
29 | -f;
|
||||
| ^^
|
||||
|
|
||||
= note: `-D float-arithmetic` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(inclusive_range_syntax, plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(indexing_slicing)]
|
||||
#![deny(out_of_bounds_indexing)]
|
||||
#![warn(indexing_slicing)]
|
||||
#![warn(out_of_bounds_indexing)]
|
||||
#![allow(no_effect, unnecessary_operation)]
|
||||
|
||||
fn main() {
|
157
clippy_tests/examples/array_indexing.stderr
Normal file
157
clippy_tests/examples/array_indexing.stderr
Normal file
|
@ -0,0 +1,157 @@
|
|||
error: const index is out of bounds
|
||||
--> array_indexing.rs:12:5
|
||||
|
|
||||
12 | x[4];
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: const index is out of bounds
|
||||
--> array_indexing.rs:13:5
|
||||
|
|
||||
13 | x[1 << 3];
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:14:6
|
||||
|
|
||||
14 | &x[1..5];
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:16:6
|
||||
|
|
||||
16 | &x[0...4];
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:17:6
|
||||
|
|
||||
17 | &x[...4];
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:21:6
|
||||
|
|
||||
21 | &x[5..];
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:23:6
|
||||
|
|
||||
23 | &x[..5];
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: indexing may panic
|
||||
--> array_indexing.rs:26:5
|
||||
|
|
||||
26 | y[0];
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D indexing-slicing` implied by `-D warnings`
|
||||
|
||||
error: slicing may panic
|
||||
--> array_indexing.rs:27:6
|
||||
|
|
||||
27 | &y[1..2];
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D indexing-slicing` implied by `-D warnings`
|
||||
|
||||
error: slicing may panic
|
||||
--> array_indexing.rs:29:6
|
||||
|
|
||||
29 | &y[0...4];
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D indexing-slicing` implied by `-D warnings`
|
||||
|
||||
error: slicing may panic
|
||||
--> array_indexing.rs:30:6
|
||||
|
|
||||
30 | &y[...4];
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D indexing-slicing` implied by `-D warnings`
|
||||
|
||||
error: const index is out of bounds
|
||||
--> array_indexing.rs:33:5
|
||||
|
|
||||
33 | empty[0];
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:34:6
|
||||
|
|
||||
34 | &empty[1..5];
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:35:6
|
||||
|
|
||||
35 | &empty[0...4];
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:36:6
|
||||
|
|
||||
36 | &empty[...4];
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:40:6
|
||||
|
|
||||
40 | &empty[0...0];
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:41:6
|
||||
|
|
||||
41 | &empty[...0];
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:43:6
|
||||
|
|
||||
43 | &empty[1..];
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: range is out of bounds
|
||||
--> array_indexing.rs:44:6
|
||||
|
|
||||
44 | &empty[..4];
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 19 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(assign_ops)]
|
||||
#[warn(assign_ops)]
|
||||
#[allow(unused_assignments)]
|
||||
fn main() {
|
||||
let mut i = 1i32;
|
||||
|
@ -21,7 +21,7 @@ fn main() {
|
|||
}
|
||||
|
||||
#[allow(dead_code, unused_assignments)]
|
||||
#[deny(assign_op_pattern)]
|
||||
#[warn(assign_op_pattern)]
|
||||
fn bla() {
|
||||
let mut a = 5;
|
||||
a = a + 1;
|
|
@ -1,140 +1,173 @@
|
|||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:8:5
|
||||
--> assign_ops.rs:8:5
|
||||
|
|
||||
8 | i += 2;
|
||||
| ^^^^^^ help: replace it with `i = i + 2`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/assign_ops.rs:4:8
|
||||
|
|
||||
4 | #[deny(assign_ops)]
|
||||
| ^^^^^^^^^^
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:9:5
|
||||
--> assign_ops.rs:9:5
|
||||
|
|
||||
9 | i += 2 + 17;
|
||||
| ^^^^^^^^^^^ help: replace it with `i = i + 2 + 17`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:10:5
|
||||
--> assign_ops.rs:10:5
|
||||
|
|
||||
10 | i -= 6;
|
||||
| ^^^^^^ help: replace it with `i = i - 6`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:11:5
|
||||
--> assign_ops.rs:11:5
|
||||
|
|
||||
11 | i -= 2 - 1;
|
||||
| ^^^^^^^^^^ help: replace it with `i = i - (2 - 1)`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:12:5
|
||||
--> assign_ops.rs:12:5
|
||||
|
|
||||
12 | i *= 5;
|
||||
| ^^^^^^ help: replace it with `i = i * 5`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:13:5
|
||||
--> assign_ops.rs:13:5
|
||||
|
|
||||
13 | i *= 1+5;
|
||||
| ^^^^^^^^ help: replace it with `i = i * (1+5)`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:14:5
|
||||
--> assign_ops.rs:14:5
|
||||
|
|
||||
14 | i /= 32;
|
||||
| ^^^^^^^ help: replace it with `i = i / 32`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:15:5
|
||||
--> assign_ops.rs:15:5
|
||||
|
|
||||
15 | i /= 32 | 5;
|
||||
| ^^^^^^^^^^^ help: replace it with `i = i / (32 | 5)`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:16:5
|
||||
--> assign_ops.rs:16:5
|
||||
|
|
||||
16 | i /= 32 / 5;
|
||||
| ^^^^^^^^^^^ help: replace it with `i = i / (32 / 5)`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:17:5
|
||||
--> assign_ops.rs:17:5
|
||||
|
|
||||
17 | i %= 42;
|
||||
| ^^^^^^^ help: replace it with `i = i % 42`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:18:5
|
||||
--> assign_ops.rs:18:5
|
||||
|
|
||||
18 | i >>= i;
|
||||
| ^^^^^^^ help: replace it with `i = i >> i`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:19:5
|
||||
--> assign_ops.rs:19:5
|
||||
|
|
||||
19 | i <<= 9 + 6 - 7;
|
||||
| ^^^^^^^^^^^^^^^ help: replace it with `i = i << (9 + 6 - 7)`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: assign operation detected
|
||||
--> $DIR/assign_ops.rs:20:5
|
||||
--> assign_ops.rs:20:5
|
||||
|
|
||||
20 | i += 1 << 5;
|
||||
| ^^^^^^^^^^^ help: replace it with `i = i + (1 << 5)`
|
||||
|
|
||||
= note: `-D assign-ops` implied by `-D warnings`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:27:5
|
||||
--> assign_ops.rs:27:5
|
||||
|
|
||||
27 | a = a + 1;
|
||||
| ^^^^^^^^^ help: replace it with `a += 1`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/assign_ops.rs:24:8
|
||||
|
|
||||
24 | #[deny(assign_op_pattern)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= note: `-D assign-op-pattern` implied by `-D warnings`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:28:5
|
||||
--> assign_ops.rs:28:5
|
||||
|
|
||||
28 | a = 1 + a;
|
||||
| ^^^^^^^^^ help: replace it with `a += 1`
|
||||
|
|
||||
= note: `-D assign-op-pattern` implied by `-D warnings`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:29:5
|
||||
--> assign_ops.rs:29:5
|
||||
|
|
||||
29 | a = a - 1;
|
||||
| ^^^^^^^^^ help: replace it with `a -= 1`
|
||||
|
|
||||
= note: `-D assign-op-pattern` implied by `-D warnings`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:30:5
|
||||
--> assign_ops.rs:30:5
|
||||
|
|
||||
30 | a = a * 99;
|
||||
| ^^^^^^^^^^ help: replace it with `a *= 99`
|
||||
|
|
||||
= note: `-D assign-op-pattern` implied by `-D warnings`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:31:5
|
||||
--> assign_ops.rs:31:5
|
||||
|
|
||||
31 | a = 42 * a;
|
||||
| ^^^^^^^^^^ help: replace it with `a *= 42`
|
||||
|
|
||||
= note: `-D assign-op-pattern` implied by `-D warnings`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:32:5
|
||||
--> assign_ops.rs:32:5
|
||||
|
|
||||
32 | a = a / 2;
|
||||
| ^^^^^^^^^ help: replace it with `a /= 2`
|
||||
|
|
||||
= note: `-D assign-op-pattern` implied by `-D warnings`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:33:5
|
||||
--> assign_ops.rs:33:5
|
||||
|
|
||||
33 | a = a % 5;
|
||||
| ^^^^^^^^^ help: replace it with `a %= 5`
|
||||
|
|
||||
= note: `-D assign-op-pattern` implied by `-D warnings`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:34:5
|
||||
--> assign_ops.rs:34:5
|
||||
|
|
||||
34 | a = a & 1;
|
||||
| ^^^^^^^^^ help: replace it with `a &= 1`
|
||||
|
|
||||
= note: `-D assign-op-pattern` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 21 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -2,7 +2,7 @@
|
|||
#![plugin(clippy)]
|
||||
|
||||
#[allow(unused_assignments)]
|
||||
#[deny(misrefactored_assign_op)]
|
||||
#[warn(misrefactored_assign_op)]
|
||||
fn main() {
|
||||
let mut a = 5;
|
||||
a += a + 1;
|
|
@ -1,56 +1,69 @@
|
|||
error: variable appears on both sides of an assignment operation
|
||||
--> $DIR/assign_ops2.rs:8:5
|
||||
--> assign_ops2.rs:8:5
|
||||
|
|
||||
8 | a += a + 1;
|
||||
| ^^^^^^^^^^ help: replace it with `a += 1`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/assign_ops2.rs:5:8
|
||||
|
|
||||
5 | #[deny(misrefactored_assign_op)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D misrefactored-assign-op` implied by `-D warnings`
|
||||
|
||||
error: variable appears on both sides of an assignment operation
|
||||
--> $DIR/assign_ops2.rs:9:5
|
||||
--> assign_ops2.rs:9:5
|
||||
|
|
||||
9 | a += 1 + a;
|
||||
| ^^^^^^^^^^ help: replace it with `a += 1`
|
||||
|
|
||||
= note: `-D misrefactored-assign-op` implied by `-D warnings`
|
||||
|
||||
error: variable appears on both sides of an assignment operation
|
||||
--> $DIR/assign_ops2.rs:10:5
|
||||
--> assign_ops2.rs:10:5
|
||||
|
|
||||
10 | a -= a - 1;
|
||||
| ^^^^^^^^^^ help: replace it with `a -= 1`
|
||||
|
|
||||
= note: `-D misrefactored-assign-op` implied by `-D warnings`
|
||||
|
||||
error: variable appears on both sides of an assignment operation
|
||||
--> $DIR/assign_ops2.rs:11:5
|
||||
--> assign_ops2.rs:11:5
|
||||
|
|
||||
11 | a *= a * 99;
|
||||
| ^^^^^^^^^^^ help: replace it with `a *= 99`
|
||||
|
|
||||
= note: `-D misrefactored-assign-op` implied by `-D warnings`
|
||||
|
||||
error: variable appears on both sides of an assignment operation
|
||||
--> $DIR/assign_ops2.rs:12:5
|
||||
--> assign_ops2.rs:12:5
|
||||
|
|
||||
12 | a *= 42 * a;
|
||||
| ^^^^^^^^^^^ help: replace it with `a *= 42`
|
||||
|
|
||||
= note: `-D misrefactored-assign-op` implied by `-D warnings`
|
||||
|
||||
error: variable appears on both sides of an assignment operation
|
||||
--> $DIR/assign_ops2.rs:13:5
|
||||
--> assign_ops2.rs:13:5
|
||||
|
|
||||
13 | a /= a / 2;
|
||||
| ^^^^^^^^^^ help: replace it with `a /= 2`
|
||||
|
|
||||
= note: `-D misrefactored-assign-op` implied by `-D warnings`
|
||||
|
||||
error: variable appears on both sides of an assignment operation
|
||||
--> $DIR/assign_ops2.rs:14:5
|
||||
--> assign_ops2.rs:14:5
|
||||
|
|
||||
14 | a %= a % 5;
|
||||
| ^^^^^^^^^^ help: replace it with `a %= 5`
|
||||
|
|
||||
= note: `-D misrefactored-assign-op` implied by `-D warnings`
|
||||
|
||||
error: variable appears on both sides of an assignment operation
|
||||
--> $DIR/assign_ops2.rs:15:5
|
||||
--> assign_ops2.rs:15:5
|
||||
|
|
||||
15 | a &= a & 1;
|
||||
| ^^^^^^^^^^ help: replace it with `a &= 1`
|
||||
|
|
||||
= note: `-D misrefactored-assign-op` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(inline_always, deprecated_semver)]
|
||||
#![warn(inline_always, deprecated_semver)]
|
||||
|
||||
#[inline(always)]
|
||||
fn test_attr_lint() {
|
|
@ -1,32 +1,29 @@
|
|||
error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea
|
||||
--> $DIR/attrs.rs:6:1
|
||||
--> attrs.rs:6:1
|
||||
|
|
||||
6 | #[inline(always)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/attrs.rs:4:9
|
||||
|
|
||||
4 | #![deny(inline_always, deprecated_semver)]
|
||||
| ^^^^^^^^^^^^^
|
||||
= note: `-D inline-always` implied by `-D warnings`
|
||||
|
||||
error: the since field must contain a semver-compliant version
|
||||
--> $DIR/attrs.rs:27:14
|
||||
--> attrs.rs:27:14
|
||||
|
|
||||
27 | #[deprecated(since = "forever")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/attrs.rs:4:24
|
||||
|
|
||||
4 | #![deny(inline_always, deprecated_semver)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= note: `-D deprecated-semver` implied by `-D warnings`
|
||||
|
||||
error: the since field must contain a semver-compliant version
|
||||
--> $DIR/attrs.rs:30:14
|
||||
--> attrs.rs:30:14
|
||||
|
|
||||
30 | #[deprecated(since = "1")]
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D deprecated-semver` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -4,7 +4,7 @@
|
|||
const THREE_BITS : i64 = 7;
|
||||
const EVEN_MORE_REDIRECTION : i64 = THREE_BITS;
|
||||
|
||||
#[deny(bad_bit_mask)]
|
||||
#[warn(bad_bit_mask)]
|
||||
#[allow(ineffective_bit_mask, identity_op, no_effect, unnecessary_operation)]
|
||||
fn main() {
|
||||
let x = 5;
|
||||
|
@ -44,7 +44,7 @@ fn main() {
|
|||
ineffective();
|
||||
}
|
||||
|
||||
#[deny(ineffective_bit_mask)]
|
||||
#[warn(ineffective_bit_mask)]
|
||||
#[allow(bad_bit_mask, no_effect, unnecessary_operation)]
|
||||
fn ineffective() {
|
||||
let x = 5;
|
|
@ -1,104 +1,125 @@
|
|||
error: &-masking with zero
|
||||
--> $DIR/bit_masks.rs:12:5
|
||||
--> bit_masks.rs:12:5
|
||||
|
|
||||
12 | x & 0 == 0;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/bit_masks.rs:7:8
|
||||
|
|
||||
7 | #[deny(bad_bit_mask)]
|
||||
| ^^^^^^^^^^^^
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ & 2` can never be equal to `1`
|
||||
--> $DIR/bit_masks.rs:15:5
|
||||
--> bit_masks.rs:15:5
|
||||
|
|
||||
15 | x & 2 == 1;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ | 3` can never be equal to `2`
|
||||
--> $DIR/bit_masks.rs:19:5
|
||||
--> bit_masks.rs:19:5
|
||||
|
|
||||
19 | x | 3 == 2;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ & 1` will never be higher than `1`
|
||||
--> $DIR/bit_masks.rs:21:5
|
||||
--> bit_masks.rs:21:5
|
||||
|
|
||||
21 | x & 1 > 1;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ | 2` will always be higher than `1`
|
||||
--> $DIR/bit_masks.rs:25:5
|
||||
--> bit_masks.rs:25:5
|
||||
|
|
||||
25 | x | 2 > 1;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ & 7` can never be equal to `8`
|
||||
--> $DIR/bit_masks.rs:32:5
|
||||
--> bit_masks.rs:32:5
|
||||
|
|
||||
32 | x & THREE_BITS == 8;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ | 7` will never be lower than `7`
|
||||
--> $DIR/bit_masks.rs:33:5
|
||||
--> bit_masks.rs:33:5
|
||||
|
|
||||
33 | x | EVEN_MORE_REDIRECTION < 7;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: &-masking with zero
|
||||
--> $DIR/bit_masks.rs:35:5
|
||||
--> bit_masks.rs:35:5
|
||||
|
|
||||
35 | 0 & x == 0;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ | 2` will always be higher than `1`
|
||||
--> $DIR/bit_masks.rs:39:5
|
||||
--> bit_masks.rs:39:5
|
||||
|
|
||||
39 | 1 < 2 | x;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ | 3` can never be equal to `2`
|
||||
--> $DIR/bit_masks.rs:40:5
|
||||
--> bit_masks.rs:40:5
|
||||
|
|
||||
40 | 2 == 3 | x;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: incompatible bit mask: `_ & 2` can never be equal to `1`
|
||||
--> $DIR/bit_masks.rs:41:5
|
||||
--> bit_masks.rs:41:5
|
||||
|
|
||||
41 | 1 == x & 2;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D bad-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly
|
||||
--> $DIR/bit_masks.rs:52:5
|
||||
--> bit_masks.rs:52:5
|
||||
|
|
||||
52 | x | 1 > 3;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/bit_masks.rs:47:8
|
||||
|
|
||||
47 | #[deny(ineffective_bit_mask)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D ineffective-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared directly
|
||||
--> $DIR/bit_masks.rs:53:5
|
||||
--> bit_masks.rs:53:5
|
||||
|
|
||||
53 | x | 1 < 4;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D ineffective-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly
|
||||
--> $DIR/bit_masks.rs:54:5
|
||||
--> bit_masks.rs:54:5
|
||||
|
|
||||
54 | x | 1 <= 3;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D ineffective-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: ineffective bit mask: `x | 1` compared to `8`, is the same as x compared directly
|
||||
--> $DIR/bit_masks.rs:55:5
|
||||
--> bit_masks.rs:55:5
|
||||
|
|
||||
55 | x | 1 >= 8;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D ineffective-bit-mask` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -2,7 +2,7 @@
|
|||
#![plugin(clippy)]
|
||||
|
||||
#![allow(dead_code, similar_names, single_match, toplevel_ref_arg, unused_mut, unused_variables)]
|
||||
#![deny(blacklisted_name)]
|
||||
#![warn(blacklisted_name)]
|
||||
|
||||
fn test(foo: ()) {}
|
||||
|
|
@ -1,92 +1,117 @@
|
|||
error: use of a blacklisted/placeholder name `foo`
|
||||
--> $DIR/blacklisted_name.rs:7:9
|
||||
--> blacklisted_name.rs:7:9
|
||||
|
|
||||
7 | fn test(foo: ()) {}
|
||||
| ^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/blacklisted_name.rs:5:9
|
||||
|
|
||||
5 | #![deny(blacklisted_name)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `foo`
|
||||
--> $DIR/blacklisted_name.rs:10:9
|
||||
--> blacklisted_name.rs:10:9
|
||||
|
|
||||
10 | let foo = 42;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `bar`
|
||||
--> $DIR/blacklisted_name.rs:11:9
|
||||
--> blacklisted_name.rs:11:9
|
||||
|
|
||||
11 | let bar = 42;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `baz`
|
||||
--> $DIR/blacklisted_name.rs:12:9
|
||||
--> blacklisted_name.rs:12:9
|
||||
|
|
||||
12 | let baz = 42;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `foo`
|
||||
--> $DIR/blacklisted_name.rs:18:10
|
||||
--> blacklisted_name.rs:18:10
|
||||
|
|
||||
18 | (foo, Some(bar), baz @ Some(_)) => (),
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `bar`
|
||||
--> $DIR/blacklisted_name.rs:18:20
|
||||
--> blacklisted_name.rs:18:20
|
||||
|
|
||||
18 | (foo, Some(bar), baz @ Some(_)) => (),
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `baz`
|
||||
--> $DIR/blacklisted_name.rs:18:26
|
||||
--> blacklisted_name.rs:18:26
|
||||
|
|
||||
18 | (foo, Some(bar), baz @ Some(_)) => (),
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `foo`
|
||||
--> $DIR/blacklisted_name.rs:23:19
|
||||
--> blacklisted_name.rs:23:19
|
||||
|
|
||||
23 | fn issue_1647(mut foo: u8) {
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `bar`
|
||||
--> $DIR/blacklisted_name.rs:24:13
|
||||
--> blacklisted_name.rs:24:13
|
||||
|
|
||||
24 | let mut bar = 0;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `baz`
|
||||
--> $DIR/blacklisted_name.rs:25:21
|
||||
--> blacklisted_name.rs:25:21
|
||||
|
|
||||
25 | if let Some(mut baz) = Some(42) {}
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `bar`
|
||||
--> $DIR/blacklisted_name.rs:29:13
|
||||
--> blacklisted_name.rs:29:13
|
||||
|
|
||||
29 | let ref bar = 0;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `baz`
|
||||
--> $DIR/blacklisted_name.rs:30:21
|
||||
--> blacklisted_name.rs:30:21
|
||||
|
|
||||
30 | if let Some(ref baz) = Some(42) {}
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `bar`
|
||||
--> $DIR/blacklisted_name.rs:34:17
|
||||
--> blacklisted_name.rs:34:17
|
||||
|
|
||||
34 | let ref mut bar = 0;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: use of a blacklisted/placeholder name `baz`
|
||||
--> $DIR/blacklisted_name.rs:35:25
|
||||
--> blacklisted_name.rs:35:25
|
||||
|
|
||||
35 | if let Some(ref mut baz) = Some(42) {}
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(block_in_if_condition_expr)]
|
||||
#![deny(block_in_if_condition_stmt)]
|
||||
#![warn(block_in_if_condition_expr)]
|
||||
#![warn(block_in_if_condition_stmt)]
|
||||
#![allow(unused, let_and_return)]
|
||||
#![warn(nonminimal_bool)]
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
|
||||
--> $DIR/block_in_if_condition.rs:30:8
|
||||
--> block_in_if_condition.rs:30:8
|
||||
|
|
||||
30 | if {
|
||||
| ________^
|
||||
|
@ -8,11 +8,7 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste
|
|||
33 | | } {
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/block_in_if_condition.rs:5:9
|
||||
|
|
||||
5 | #![deny(block_in_if_condition_stmt)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D block-in-if-condition-stmt` implied by `-D warnings`
|
||||
= help: try
|
||||
let res = {
|
||||
let x = 3;
|
||||
|
@ -23,44 +19,43 @@ note: lint level defined here
|
|||
} ...
|
||||
|
||||
error: omit braces around single expression condition
|
||||
--> $DIR/block_in_if_condition.rs:41:8
|
||||
--> block_in_if_condition.rs:41:8
|
||||
|
|
||||
41 | if { true } {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/block_in_if_condition.rs:4:9
|
||||
|
|
||||
4 | #![deny(block_in_if_condition_expr)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D block-in-if-condition-expr` implied by `-D warnings`
|
||||
= help: try
|
||||
if true {
|
||||
6
|
||||
} ...
|
||||
|
||||
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
|
||||
--> $DIR/block_in_if_condition.rs:58:49
|
||||
--> block_in_if_condition.rs:58:49
|
||||
|
|
||||
58 | if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D block-in-if-condition-stmt` implied by `-D warnings`
|
||||
|
||||
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
|
||||
--> $DIR/block_in_if_condition.rs:61:22
|
||||
--> block_in_if_condition.rs:61:22
|
||||
|
|
||||
61 | if predicate(|x| { let target = 3; x == target }, v) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D block-in-if-condition-stmt` implied by `-D warnings`
|
||||
|
||||
warning: this boolean expression can be simplified
|
||||
--> $DIR/block_in_if_condition.rs:67:8
|
||||
error: this boolean expression can be simplified
|
||||
--> block_in_if_condition.rs:67:8
|
||||
|
|
||||
67 | if true && x == 3 {
|
||||
| ^^^^^^^^^^^^^^ help: try `x == 3`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/block_in_if_condition.rs:7:9
|
||||
|
|
||||
7 | #![warn(nonminimal_bool)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(bool_comparison)]
|
||||
#[warn(bool_comparison)]
|
||||
fn main() {
|
||||
let x = true;
|
||||
if x == true { "yes" } else { "no" };
|
|
@ -1,32 +1,37 @@
|
|||
error: equality checks against true are unnecessary
|
||||
--> $DIR/bool_comparison.rs:7:8
|
||||
--> bool_comparison.rs:7:8
|
||||
|
|
||||
7 | if x == true { "yes" } else { "no" };
|
||||
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/bool_comparison.rs:4:8
|
||||
|
|
||||
4 | #[deny(bool_comparison)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: `-D bool-comparison` implied by `-D warnings`
|
||||
|
||||
error: equality checks against false can be replaced by a negation
|
||||
--> $DIR/bool_comparison.rs:8:8
|
||||
--> bool_comparison.rs:8:8
|
||||
|
|
||||
8 | if x == false { "yes" } else { "no" };
|
||||
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
||||
|
|
||||
= note: `-D bool-comparison` implied by `-D warnings`
|
||||
|
||||
error: equality checks against true are unnecessary
|
||||
--> $DIR/bool_comparison.rs:9:8
|
||||
--> bool_comparison.rs:9:8
|
||||
|
|
||||
9 | if true == x { "yes" } else { "no" };
|
||||
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
||||
|
|
||||
= note: `-D bool-comparison` implied by `-D warnings`
|
||||
|
||||
error: equality checks against false can be replaced by a negation
|
||||
--> $DIR/bool_comparison.rs:10:8
|
||||
--> bool_comparison.rs:10:8
|
||||
|
|
||||
10 | if false == x { "yes" } else { "no" };
|
||||
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
||||
|
|
||||
= note: `-D bool-comparison` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(nonminimal_bool, logic_bug)]
|
||||
#![warn(nonminimal_bool, logic_bug)]
|
||||
|
||||
#[allow(unused, many_single_char_names)]
|
||||
fn main() {
|
|
@ -1,133 +1,143 @@
|
|||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:12:13
|
||||
--> booleans.rs:12:13
|
||||
|
|
||||
12 | let _ = a && b || a;
|
||||
| ^^^^^^^^^^^ help: it would look like the following `a`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/booleans.rs:3:26
|
||||
|
|
||||
3 | #![deny(nonminimal_bool, logic_bug)]
|
||||
| ^^^^^^^^^
|
||||
= note: `-D logic-bug` implied by `-D warnings`
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:12:18
|
||||
--> booleans.rs:12:18
|
||||
|
|
||||
12 | let _ = a && b || a;
|
||||
| ^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:14:13
|
||||
--> booleans.rs:14:13
|
||||
|
|
||||
14 | let _ = !true;
|
||||
| ^^^^^ help: try `false`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/booleans.rs:3:9
|
||||
|
|
||||
3 | #![deny(nonminimal_bool, logic_bug)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:15:13
|
||||
--> booleans.rs:15:13
|
||||
|
|
||||
15 | let _ = !false;
|
||||
| ^^^^^^ help: try `true`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:16:13
|
||||
--> booleans.rs:16:13
|
||||
|
|
||||
16 | let _ = !!a;
|
||||
| ^^^ help: try `a`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:17:13
|
||||
--> booleans.rs:17:13
|
||||
|
|
||||
17 | let _ = false && a;
|
||||
| ^^^^^^^^^^ help: it would look like the following `false`
|
||||
|
|
||||
= note: `-D logic-bug` implied by `-D warnings`
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:17:22
|
||||
--> booleans.rs:17:22
|
||||
|
|
||||
17 | let _ = false && a;
|
||||
| ^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:18:13
|
||||
--> booleans.rs:18:13
|
||||
|
|
||||
18 | let _ = false || a;
|
||||
| ^^^^^^^^^^ help: try `a`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:23:13
|
||||
--> booleans.rs:23:13
|
||||
|
|
||||
23 | let _ = !(!a && b);
|
||||
| ^^^^^^^^^^ help: try `!b || a`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:33:13
|
||||
--> booleans.rs:33:13
|
||||
|
|
||||
33 | let _ = a == b && a != b;
|
||||
| ^^^^^^^^^^^^^^^^ help: it would look like the following `false`
|
||||
|
|
||||
= note: `-D logic-bug` implied by `-D warnings`
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:33:13
|
||||
--> booleans.rs:33:13
|
||||
|
|
||||
33 | let _ = a == b && a != b;
|
||||
| ^^^^^^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:34:13
|
||||
--> booleans.rs:34:13
|
||||
|
|
||||
34 | let _ = a == b && c == 5 && a == b;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
help: try
|
||||
| let _ = a == b && c == 5;
|
||||
| let _ = !(c != 5 || a != b);
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:35:13
|
||||
--> booleans.rs:35:13
|
||||
|
|
||||
35 | let _ = a == b && c == 5 && b == a;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
help: try
|
||||
| let _ = a == b && c == 5;
|
||||
| let _ = !(c != 5 || a != b);
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:36:13
|
||||
--> booleans.rs:36:13
|
||||
|
|
||||
36 | let _ = a < b && a >= b;
|
||||
| ^^^^^^^^^^^^^^^ help: it would look like the following `false`
|
||||
|
|
||||
= note: `-D logic-bug` implied by `-D warnings`
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:36:13
|
||||
--> booleans.rs:36:13
|
||||
|
|
||||
36 | let _ = a < b && a >= b;
|
||||
| ^^^^^
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:37:13
|
||||
--> booleans.rs:37:13
|
||||
|
|
||||
37 | let _ = a > b && a <= b;
|
||||
| ^^^^^^^^^^^^^^^ help: it would look like the following `false`
|
||||
|
|
||||
= note: `-D logic-bug` implied by `-D warnings`
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:37:13
|
||||
--> booleans.rs:37:13
|
||||
|
|
||||
37 | let _ = a > b && a <= b;
|
||||
| ^^^^^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:39:13
|
||||
--> booleans.rs:39:13
|
||||
|
|
||||
39 | let _ = a != b || !(a != b || c == d);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
help: try
|
||||
| let _ = c != d || a != b;
|
||||
| let _ = !(a == b && c == d);
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(clippy)]
|
||||
#![warn(clippy)]
|
||||
#![allow(boxed_local, needless_pass_by_value)]
|
||||
#![allow(blacklisted_name)]
|
||||
|
|
@ -1,16 +1,14 @@
|
|||
error: you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>`
|
||||
--> $DIR/box_vec.rs:17:18
|
||||
--> box_vec.rs:17:18
|
||||
|
|
||||
17 | pub fn test(foo: Box<Vec<bool>>) {
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(box_vec)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/box_vec.rs:4:9
|
||||
|
|
||||
4 | #![deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D box-vec` implied by `-D warnings`
|
||||
= help: `Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation.
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap)]
|
||||
#[warn(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap)]
|
||||
#[allow(no_effect, unnecessary_operation)]
|
||||
fn main() {
|
||||
// Test cast_precision_loss
|
|
@ -1,302 +1,365 @@
|
|||
error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f32's mantissa is only 23 bits wide)
|
||||
--> $DIR/cast.rs:8:5
|
||||
--> cast.rs:8:5
|
||||
|
|
||||
8 | 1i32 as f32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cast.rs:4:8
|
||||
|
|
||||
4 | #[deny(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting i64 to f32 causes a loss of precision (i64 is 64 bits wide, but f32's mantissa is only 23 bits wide)
|
||||
--> $DIR/cast.rs:9:5
|
||||
--> cast.rs:9:5
|
||||
|
|
||||
9 | 1i64 as f32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting i64 to f64 causes a loss of precision (i64 is 64 bits wide, but f64's mantissa is only 52 bits wide)
|
||||
--> $DIR/cast.rs:10:5
|
||||
--> cast.rs:10:5
|
||||
|
|
||||
10 | 1i64 as f64;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting u32 to f32 causes a loss of precision (u32 is 32 bits wide, but f32's mantissa is only 23 bits wide)
|
||||
--> $DIR/cast.rs:11:5
|
||||
--> cast.rs:11:5
|
||||
|
|
||||
11 | 1u32 as f32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting u64 to f32 causes a loss of precision (u64 is 64 bits wide, but f32's mantissa is only 23 bits wide)
|
||||
--> $DIR/cast.rs:12:5
|
||||
--> cast.rs:12:5
|
||||
|
|
||||
12 | 1u64 as f32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f64's mantissa is only 52 bits wide)
|
||||
--> $DIR/cast.rs:13:5
|
||||
--> cast.rs:13:5
|
||||
|
|
||||
13 | 1u64 as f64;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting f32 to i32 may truncate the value
|
||||
--> $DIR/cast.rs:17:5
|
||||
--> cast.rs:17:5
|
||||
|
|
||||
17 | 1f32 as i32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cast.rs:4:29
|
||||
|
|
||||
4 | #[deny(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting f32 to u32 may truncate the value
|
||||
--> $DIR/cast.rs:18:5
|
||||
--> cast.rs:18:5
|
||||
|
|
||||
18 | 1f32 as u32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting f32 to u32 may lose the sign of the value
|
||||
--> $DIR/cast.rs:18:5
|
||||
--> cast.rs:18:5
|
||||
|
|
||||
18 | 1f32 as u32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cast.rs:4:55
|
||||
|
|
||||
4 | #[deny(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: `-D cast-sign-loss` implied by `-D warnings`
|
||||
|
||||
error: casting f64 to f32 may truncate the value
|
||||
--> $DIR/cast.rs:19:5
|
||||
--> cast.rs:19:5
|
||||
|
|
||||
19 | 1f64 as f32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting i32 to i8 may truncate the value
|
||||
--> $DIR/cast.rs:20:5
|
||||
--> cast.rs:20:5
|
||||
|
|
||||
20 | 1i32 as i8;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting i32 to u8 may lose the sign of the value
|
||||
--> $DIR/cast.rs:21:5
|
||||
--> cast.rs:21:5
|
||||
|
|
||||
21 | 1i32 as u8;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-sign-loss` implied by `-D warnings`
|
||||
|
||||
error: casting i32 to u8 may truncate the value
|
||||
--> $DIR/cast.rs:21:5
|
||||
--> cast.rs:21:5
|
||||
|
|
||||
21 | 1i32 as u8;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting f64 to isize may truncate the value
|
||||
--> $DIR/cast.rs:22:5
|
||||
--> cast.rs:22:5
|
||||
|
|
||||
22 | 1f64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting f64 to usize may truncate the value
|
||||
--> $DIR/cast.rs:23:5
|
||||
--> cast.rs:23:5
|
||||
|
|
||||
23 | 1f64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting f64 to usize may lose the sign of the value
|
||||
--> $DIR/cast.rs:23:5
|
||||
--> cast.rs:23:5
|
||||
|
|
||||
23 | 1f64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-sign-loss` implied by `-D warnings`
|
||||
|
||||
error: casting u8 to i8 may wrap around the value
|
||||
--> $DIR/cast.rs:25:5
|
||||
--> cast.rs:25:5
|
||||
|
|
||||
25 | 1u8 as i8;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cast.rs:4:71
|
||||
|
|
||||
4 | #[deny(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
||||
|
||||
error: casting u16 to i16 may wrap around the value
|
||||
--> $DIR/cast.rs:26:5
|
||||
--> cast.rs:26:5
|
||||
|
|
||||
26 | 1u16 as i16;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
||||
|
||||
error: casting u32 to i32 may wrap around the value
|
||||
--> $DIR/cast.rs:27:5
|
||||
--> cast.rs:27:5
|
||||
|
|
||||
27 | 1u32 as i32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
||||
|
||||
error: casting u64 to i64 may wrap around the value
|
||||
--> $DIR/cast.rs:28:5
|
||||
--> cast.rs:28:5
|
||||
|
|
||||
28 | 1u64 as i64;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
||||
|
||||
error: casting usize to isize may wrap around the value
|
||||
--> $DIR/cast.rs:29:5
|
||||
--> cast.rs:29:5
|
||||
|
|
||||
29 | 1usize as isize;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
||||
|
||||
error: casting i32 to u32 may lose the sign of the value
|
||||
--> $DIR/cast.rs:31:5
|
||||
--> cast.rs:31:5
|
||||
|
|
||||
31 | 1i32 as u32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-sign-loss` implied by `-D warnings`
|
||||
|
||||
error: casting isize to usize may lose the sign of the value
|
||||
--> $DIR/cast.rs:32:5
|
||||
--> cast.rs:32:5
|
||||
|
|
||||
32 | 1isize as usize;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-sign-loss` implied by `-D warnings`
|
||||
|
||||
error: casting isize to i8 may truncate the value
|
||||
--> $DIR/cast.rs:35:5
|
||||
--> cast.rs:35:5
|
||||
|
|
||||
35 | 1isize as i8;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting isize to f64 causes a loss of precision on targets with 64-bit wide pointers (isize is 64 bits wide, but f64's mantissa is only 52 bits wide)
|
||||
--> $DIR/cast.rs:36:5
|
||||
--> cast.rs:36:5
|
||||
|
|
||||
36 | 1isize as f64;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting usize to f64 causes a loss of precision on targets with 64-bit wide pointers (usize is 64 bits wide, but f64's mantissa is only 52 bits wide)
|
||||
--> $DIR/cast.rs:37:5
|
||||
--> cast.rs:37:5
|
||||
|
|
||||
37 | 1usize as f64;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting isize to f32 causes a loss of precision (isize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide)
|
||||
--> $DIR/cast.rs:38:5
|
||||
--> cast.rs:38:5
|
||||
|
|
||||
38 | 1isize as f32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide)
|
||||
--> $DIR/cast.rs:39:5
|
||||
--> cast.rs:39:5
|
||||
|
|
||||
39 | 1usize as f32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-precision-loss` implied by `-D warnings`
|
||||
|
||||
error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers
|
||||
--> $DIR/cast.rs:40:5
|
||||
--> cast.rs:40:5
|
||||
|
|
||||
40 | 1isize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting isize to u32 may lose the sign of the value
|
||||
--> $DIR/cast.rs:41:5
|
||||
--> cast.rs:41:5
|
||||
|
|
||||
41 | 1isize as u32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-sign-loss` implied by `-D warnings`
|
||||
|
||||
error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers
|
||||
--> $DIR/cast.rs:41:5
|
||||
--> cast.rs:41:5
|
||||
|
|
||||
41 | 1isize as u32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers
|
||||
--> $DIR/cast.rs:42:5
|
||||
--> cast.rs:42:5
|
||||
|
|
||||
42 | 1usize as u32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers
|
||||
--> $DIR/cast.rs:43:5
|
||||
--> cast.rs:43:5
|
||||
|
|
||||
43 | 1usize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers
|
||||
--> $DIR/cast.rs:43:5
|
||||
--> cast.rs:43:5
|
||||
|
|
||||
43 | 1usize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
||||
|
||||
error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers
|
||||
--> $DIR/cast.rs:45:5
|
||||
--> cast.rs:45:5
|
||||
|
|
||||
45 | 1i64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting i64 to usize may lose the sign of the value
|
||||
--> $DIR/cast.rs:46:5
|
||||
--> cast.rs:46:5
|
||||
|
|
||||
46 | 1i64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-sign-loss` implied by `-D warnings`
|
||||
|
||||
error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers
|
||||
--> $DIR/cast.rs:46:5
|
||||
--> cast.rs:46:5
|
||||
|
|
||||
46 | 1i64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers
|
||||
--> $DIR/cast.rs:47:5
|
||||
--> cast.rs:47:5
|
||||
|
|
||||
47 | 1u64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers
|
||||
--> $DIR/cast.rs:47:5
|
||||
--> cast.rs:47:5
|
||||
|
|
||||
47 | 1u64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
||||
|
||||
error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers
|
||||
--> $DIR/cast.rs:48:5
|
||||
--> cast.rs:48:5
|
||||
|
|
||||
48 | 1u64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
||||
|
||||
error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers
|
||||
--> $DIR/cast.rs:49:5
|
||||
--> cast.rs:49:5
|
||||
|
|
||||
49 | 1u32 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
||||
|
||||
error: casting i32 to usize may lose the sign of the value
|
||||
--> $DIR/cast.rs:52:5
|
||||
--> cast.rs:52:5
|
||||
|
|
||||
52 | 1i32 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cast-sign-loss` implied by `-D warnings`
|
||||
|
||||
warning: casting to the same type is unnecessary (`i32` -> `i32`)
|
||||
--> $DIR/cast.rs:54:5
|
||||
error: casting to the same type is unnecessary (`i32` -> `i32`)
|
||||
--> cast.rs:54:5
|
||||
|
|
||||
54 | 1i32 as i32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unnecessary_cast)] on by default
|
||||
= note: `-D unnecessary-cast` implied by `-D warnings`
|
||||
|
||||
warning: casting to the same type is unnecessary (`f32` -> `f32`)
|
||||
--> $DIR/cast.rs:55:5
|
||||
error: casting to the same type is unnecessary (`f32` -> `f32`)
|
||||
--> cast.rs:55:5
|
||||
|
|
||||
55 | 1f32 as f32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unnecessary_cast)] on by default
|
||||
= note: `-D unnecessary-cast` implied by `-D warnings`
|
||||
|
||||
warning: casting to the same type is unnecessary (`bool` -> `bool`)
|
||||
--> $DIR/cast.rs:56:5
|
||||
error: casting to the same type is unnecessary (`bool` -> `bool`)
|
||||
--> cast.rs:56:5
|
||||
|
|
||||
56 | false as bool;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unnecessary_cast)] on by default
|
||||
= note: `-D unnecessary-cast` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 42 previous errors
|
||||
error: aborting due to 45 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(char_lit_as_u8)]
|
||||
#![warn(char_lit_as_u8)]
|
||||
#![allow(unused_variables)]
|
||||
fn main() {
|
||||
let c = 'a' as u8;
|
|
@ -1,16 +1,15 @@
|
|||
error: casting character literal to u8. `char`s are 4 bytes wide in rust, so casting to u8 truncates them
|
||||
--> $DIR/char_lit_as_u8.rs:7:13
|
||||
--> char_lit_as_u8.rs:7:13
|
||||
|
|
||||
7 | let c = 'a' as u8;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/char_lit_as_u8.rs:4:9
|
||||
|
|
||||
4 | #![deny(char_lit_as_u8)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: `-D char-lit-as-u8` implied by `-D warnings`
|
||||
= help: Consider using a byte literal instead:
|
||||
b'a'
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(cmp_nan)]
|
||||
#[warn(cmp_nan)]
|
||||
#[allow(float_cmp, no_effect, unnecessary_operation)]
|
||||
fn main() {
|
||||
let x = 5f32;
|
|
@ -1,98 +1,101 @@
|
|||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:8:5
|
||||
--> cmp_nan.rs:8:5
|
||||
|
|
||||
8 | x == std::f32::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:9:5
|
||||
--> cmp_nan.rs:9:5
|
||||
|
|
||||
9 | x != std::f32::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:10:5
|
||||
--> cmp_nan.rs:10:5
|
||||
|
|
||||
10 | x < std::f32::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:11:5
|
||||
--> cmp_nan.rs:11:5
|
||||
|
|
||||
11 | x > std::f32::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:12:5
|
||||
--> cmp_nan.rs:12:5
|
||||
|
|
||||
12 | x <= std::f32::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:13:5
|
||||
--> cmp_nan.rs:13:5
|
||||
|
|
||||
13 | x >= std::f32::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:16:5
|
||||
--> cmp_nan.rs:16:5
|
||||
|
|
||||
16 | y == std::f64::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:17:5
|
||||
--> cmp_nan.rs:17:5
|
||||
|
|
||||
17 | y != std::f64::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:18:5
|
||||
--> cmp_nan.rs:18:5
|
||||
|
|
||||
18 | y < std::f64::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:19:5
|
||||
--> cmp_nan.rs:19:5
|
||||
|
|
||||
19 | y > std::f64::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:20:5
|
||||
--> cmp_nan.rs:20:5
|
||||
|
|
||||
20 | y <= std::f64::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
|
||||
--> $DIR/cmp_nan.rs:21:5
|
||||
--> cmp_nan.rs:21:5
|
||||
|
|
||||
21 | y >= std::f64::NAN;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(cmp_nan)] on by default
|
||||
= note: `-D cmp-nan` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(cmp_null)]
|
||||
#![warn(cmp_null)]
|
||||
#![allow(unused_mut)]
|
||||
|
||||
use std::ptr;
|
|
@ -1,20 +1,21 @@
|
|||
error: Comparing with null is better expressed by the .is_null() method
|
||||
--> $DIR/cmp_null.rs:11:8
|
||||
--> cmp_null.rs:11:8
|
||||
|
|
||||
11 | if p == ptr::null() {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cmp_null.rs:3:9
|
||||
|
|
||||
3 | #![deny(cmp_null)]
|
||||
| ^^^^^^^^
|
||||
= note: `-D cmp-null` implied by `-D warnings`
|
||||
|
||||
error: Comparing with null is better expressed by the .is_null() method
|
||||
--> $DIR/cmp_null.rs:16:8
|
||||
--> cmp_null.rs:16:8
|
||||
|
|
||||
16 | if m == ptr::null_mut() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D cmp-null` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(cmp_owned)]
|
||||
#[warn(cmp_owned)]
|
||||
#[allow(unnecessary_operation)]
|
||||
fn main() {
|
||||
fn with_to_string(x : &str) {
|
|
@ -1,46 +1,53 @@
|
|||
error: this creates an owned instance just for comparison
|
||||
--> $DIR/cmp_owned.rs:8:14
|
||||
--> cmp_owned.rs:8:14
|
||||
|
|
||||
8 | x != "foo".to_string();
|
||||
| ^^^^^^^^^^^^^^^^^ help: try `"foo"`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cmp_owned.rs:4:8
|
||||
|
|
||||
4 | #[deny(cmp_owned)]
|
||||
| ^^^^^^^^^
|
||||
= note: `-D cmp-owned` implied by `-D warnings`
|
||||
|
||||
error: this creates an owned instance just for comparison
|
||||
--> $DIR/cmp_owned.rs:10:9
|
||||
--> cmp_owned.rs:10:9
|
||||
|
|
||||
10 | "foo".to_string() != x;
|
||||
| ^^^^^^^^^^^^^^^^^ help: try `"foo"`
|
||||
|
|
||||
= note: `-D cmp-owned` implied by `-D warnings`
|
||||
|
||||
error: this creates an owned instance just for comparison
|
||||
--> $DIR/cmp_owned.rs:17:10
|
||||
--> cmp_owned.rs:17:10
|
||||
|
|
||||
17 | x != "foo".to_owned();
|
||||
| ^^^^^^^^^^^^^^^^ help: try `"foo"`
|
||||
|
|
||||
= note: `-D cmp-owned` implied by `-D warnings`
|
||||
|
||||
error: this creates an owned instance just for comparison
|
||||
--> $DIR/cmp_owned.rs:19:10
|
||||
--> cmp_owned.rs:19:10
|
||||
|
|
||||
19 | x != String::from("foo");
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: try `"foo"`
|
||||
|
|
||||
= note: `-D cmp-owned` implied by `-D warnings`
|
||||
|
||||
error: this creates an owned instance just for comparison
|
||||
--> $DIR/cmp_owned.rs:23:5
|
||||
--> cmp_owned.rs:23:5
|
||||
|
|
||||
23 | Foo.to_owned() == Foo;
|
||||
| ^^^^^^^^^^^^^^ help: try `Foo`
|
||||
|
|
||||
= note: `-D cmp-owned` implied by `-D warnings`
|
||||
|
||||
warning: this creates an owned instance just for comparison
|
||||
--> $DIR/cmp_owned.rs:30:9
|
||||
error: this creates an owned instance just for comparison
|
||||
--> cmp_owned.rs:30:9
|
||||
|
|
||||
30 | self.to_owned() == *other
|
||||
| ^^^^^^^^^^^^^^^ try calling implementing the comparison without allocating
|
||||
|
|
||||
= note: #[warn(cmp_owned)] on by default
|
||||
= note: `-D cmp-owned` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(collapsible_if)]
|
||||
#[warn(collapsible_if)]
|
||||
fn main() {
|
||||
let x = "hello";
|
||||
let y = "world";
|
|
@ -1,5 +1,5 @@
|
|||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:8:5
|
||||
--> collapsible_if.rs:8:5
|
||||
|
|
||||
8 | / if x == "hello" {
|
||||
9 | | if y == "world" {
|
||||
|
@ -8,18 +8,14 @@ error: this if statement can be collapsed
|
|||
12 | | }
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/collapsible_if.rs:4:8
|
||||
|
|
||||
4 | #[deny(collapsible_if)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| if x == "hello" && y == "world" {
|
||||
| println!("Hello world!");
|
||||
| }
|
||||
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:14:5
|
||||
--> collapsible_if.rs:14:5
|
||||
|
|
||||
14 | / if x == "hello" || x == "world" {
|
||||
15 | | if y == "world" || y == "hello" {
|
||||
|
@ -28,13 +24,14 @@ error: this if statement can be collapsed
|
|||
18 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
|
||||
| println!("Hello world!");
|
||||
| }
|
||||
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:20:5
|
||||
--> collapsible_if.rs:20:5
|
||||
|
|
||||
20 | / if x == "hello" && x == "world" {
|
||||
21 | | if y == "world" || y == "hello" {
|
||||
|
@ -43,13 +40,14 @@ error: this if statement can be collapsed
|
|||
24 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| if x == "hello" && x == "world" && (y == "world" || y == "hello") {
|
||||
| println!("Hello world!");
|
||||
| }
|
||||
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:26:5
|
||||
--> collapsible_if.rs:26:5
|
||||
|
|
||||
26 | / if x == "hello" || x == "world" {
|
||||
27 | | if y == "world" && y == "hello" {
|
||||
|
@ -58,13 +56,14 @@ error: this if statement can be collapsed
|
|||
30 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| if (x == "hello" || x == "world") && y == "world" && y == "hello" {
|
||||
| println!("Hello world!");
|
||||
| }
|
||||
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:32:5
|
||||
--> collapsible_if.rs:32:5
|
||||
|
|
||||
32 | / if x == "hello" && x == "world" {
|
||||
33 | | if y == "world" && y == "hello" {
|
||||
|
@ -73,13 +72,14 @@ error: this if statement can be collapsed
|
|||
36 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| if x == "hello" && x == "world" && y == "world" && y == "hello" {
|
||||
| println!("Hello world!");
|
||||
| }
|
||||
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:38:5
|
||||
--> collapsible_if.rs:38:5
|
||||
|
|
||||
38 | / if 42 == 1337 {
|
||||
39 | | if 'a' != 'A' {
|
||||
|
@ -88,13 +88,14 @@ error: this if statement can be collapsed
|
|||
42 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| if 42 == 1337 && 'a' != 'A' {
|
||||
| println!("world!")
|
||||
| }
|
||||
|
||||
error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:47:12
|
||||
--> collapsible_if.rs:47:12
|
||||
|
|
||||
47 | } else {
|
||||
| ____________^
|
||||
|
@ -104,13 +105,14 @@ error: this `else { if .. }` block can be collapsed
|
|||
51 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| } else if y == "world" {
|
||||
| println!("world!")
|
||||
| }
|
||||
|
||||
error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:55:12
|
||||
--> collapsible_if.rs:55:12
|
||||
|
|
||||
55 | } else {
|
||||
| ____________^
|
||||
|
@ -120,13 +122,14 @@ error: this `else { if .. }` block can be collapsed
|
|||
59 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| } else if let Some(42) = Some(42) {
|
||||
| println!("world!")
|
||||
| }
|
||||
|
||||
error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:63:12
|
||||
--> collapsible_if.rs:63:12
|
||||
|
|
||||
63 | } else {
|
||||
| ____________^
|
||||
|
@ -138,6 +141,7 @@ error: this `else { if .. }` block can be collapsed
|
|||
70 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| } else if y == "world" {
|
||||
| println!("world")
|
||||
|
@ -147,7 +151,7 @@ help: try
|
|||
| }
|
||||
|
||||
error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:74:12
|
||||
--> collapsible_if.rs:74:12
|
||||
|
|
||||
74 | } else {
|
||||
| ____________^
|
||||
|
@ -159,6 +163,7 @@ error: this `else { if .. }` block can be collapsed
|
|||
81 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| } else if let Some(42) = Some(42) {
|
||||
| println!("world")
|
||||
|
@ -168,7 +173,7 @@ help: try
|
|||
| }
|
||||
|
||||
error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:85:12
|
||||
--> collapsible_if.rs:85:12
|
||||
|
|
||||
85 | } else {
|
||||
| ____________^
|
||||
|
@ -180,6 +185,7 @@ error: this `else { if .. }` block can be collapsed
|
|||
92 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| } else if let Some(42) = Some(42) {
|
||||
| println!("world")
|
||||
|
@ -189,7 +195,7 @@ help: try
|
|||
| }
|
||||
|
||||
error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:96:12
|
||||
--> collapsible_if.rs:96:12
|
||||
|
|
||||
96 | } else {
|
||||
| ____________^
|
||||
|
@ -201,6 +207,7 @@ error: this `else { if .. }` block can be collapsed
|
|||
103 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| } else if x == "hello" {
|
||||
| println!("world")
|
||||
|
@ -210,7 +217,7 @@ help: try
|
|||
| }
|
||||
|
||||
error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:107:12
|
||||
--> collapsible_if.rs:107:12
|
||||
|
|
||||
107 | } else {
|
||||
| ____________^
|
||||
|
@ -222,6 +229,7 @@ error: this `else { if .. }` block can be collapsed
|
|||
114 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D collapsible-if` implied by `-D warnings`
|
||||
help: try
|
||||
| } else if let Some(42) = Some(42) {
|
||||
| println!("world")
|
||||
|
@ -232,3 +240,6 @@ help: try
|
|||
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(clippy)]
|
||||
#![warn(clippy)]
|
||||
#![allow(unused, needless_pass_by_value)]
|
||||
#![feature(associated_consts, associated_type_defaults)]
|
||||
|
|
@ -1,127 +1,125 @@
|
|||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:9:12
|
||||
--> complex_types.rs:9:12
|
||||
|
|
||||
9 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/complex_types.rs:3:9
|
||||
|
|
||||
3 | #![deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:10:12
|
||||
--> complex_types.rs:10:12
|
||||
|
|
||||
10 | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:13:8
|
||||
--> complex_types.rs:13:8
|
||||
|
|
||||
13 | f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:16:11
|
||||
--> complex_types.rs:16:11
|
||||
|
|
||||
16 | struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:19:11
|
||||
--> complex_types.rs:19:11
|
||||
|
|
||||
19 | Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:20:17
|
||||
--> complex_types.rs:20:17
|
||||
|
|
||||
20 | Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:24:14
|
||||
--> complex_types.rs:24:14
|
||||
|
|
||||
24 | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:25:30
|
||||
--> complex_types.rs:25:30
|
||||
|
|
||||
25 | fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:29:14
|
||||
--> complex_types.rs:29:14
|
||||
|
|
||||
29 | const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:30:14
|
||||
--> complex_types.rs:30:14
|
||||
|
|
||||
30 | type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:31:25
|
||||
--> complex_types.rs:31:25
|
||||
|
|
||||
31 | fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:32:29
|
||||
--> complex_types.rs:32:29
|
||||
|
|
||||
32 | fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:35:15
|
||||
--> complex_types.rs:35:15
|
||||
|
|
||||
35 | fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> { vec![] }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:37:14
|
||||
--> complex_types.rs:37:14
|
||||
|
|
||||
37 | fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: very complex type used. Consider factoring parts into `type` definitions
|
||||
--> $DIR/complex_types.rs:40:13
|
||||
--> complex_types.rs:40:13
|
||||
|
|
||||
40 | let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(type_complexity)] implied by #[deny(clippy)]
|
||||
= note: `-D type-complexity` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -24,8 +24,8 @@ pub enum Abc {
|
|||
C,
|
||||
}
|
||||
|
||||
#[deny(if_same_then_else)]
|
||||
#[deny(match_same_arms)]
|
||||
#[warn(if_same_then_else)]
|
||||
#[warn(match_same_arms)]
|
||||
fn if_same_then_else() -> Result<&'static str, ()> {
|
||||
if true {
|
||||
Foo { bar: 42 };
|
||||
|
@ -350,7 +350,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deny(ifs_same_cond)]
|
||||
#[warn(ifs_same_cond)]
|
||||
#[allow(if_same_then_else)] // all empty blocks
|
||||
fn ifs_same_cond() {
|
||||
let a = 0;
|
41
clippy_tests/examples/copies.stderr
Normal file
41
clippy_tests/examples/copies.stderr
Normal file
|
@ -0,0 +1,41 @@
|
|||
error: This else block is redundant.
|
||||
|
||||
--> copies.rs:121:20
|
||||
|
|
||||
121 | } else {
|
||||
| ____________________^
|
||||
122 | | continue;
|
||||
123 | | }
|
||||
| |_____________^
|
||||
|
|
||||
= note: `-D needless-continue` implied by `-D warnings`
|
||||
= help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so:
|
||||
if true {
|
||||
break;
|
||||
// Merged code follows...
|
||||
}
|
||||
|
||||
|
||||
error: This else block is redundant.
|
||||
|
||||
--> copies.rs:131:20
|
||||
|
|
||||
131 | } else {
|
||||
| ____________________^
|
||||
132 | | continue;
|
||||
133 | | }
|
||||
| |_____________^
|
||||
|
|
||||
= note: `-D needless-continue` implied by `-D warnings`
|
||||
= help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so:
|
||||
if true {
|
||||
break;
|
||||
// Merged code follows...
|
||||
}
|
||||
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin, custom_attribute)]
|
||||
#![plugin(clippy)]
|
||||
#![allow(clippy)]
|
||||
#![deny(cyclomatic_complexity)]
|
||||
#![warn(cyclomatic_complexity)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn main() {
|
|
@ -1,5 +1,5 @@
|
|||
error: the function has a cyclomatic complexity of 28
|
||||
--> $DIR/cyclomatic_complexity.rs:7:1
|
||||
--> cyclomatic_complexity.rs:7:1
|
||||
|
|
||||
7 | / fn main() {
|
||||
8 | | if true {
|
||||
|
@ -10,15 +10,11 @@ error: the function has a cyclomatic complexity of 28
|
|||
89 | | }
|
||||
| |_^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cyclomatic_complexity.rs:4:9
|
||||
|
|
||||
4 | #![deny(cyclomatic_complexity)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 7
|
||||
--> $DIR/cyclomatic_complexity.rs:92:1
|
||||
--> cyclomatic_complexity.rs:92:1
|
||||
|
|
||||
92 | / fn kaboom() {
|
||||
93 | | let n = 0;
|
||||
|
@ -29,30 +25,33 @@ error: the function has a cyclomatic complexity of 7
|
|||
111 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:138:1
|
||||
--> cyclomatic_complexity.rs:138:1
|
||||
|
|
||||
138 | / fn lots_of_short_circuits() -> bool {
|
||||
139 | | true && false && true && false && true && false && true
|
||||
140 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:143:1
|
||||
--> cyclomatic_complexity.rs:143:1
|
||||
|
|
||||
143 | / fn lots_of_short_circuits2() -> bool {
|
||||
144 | | true || false || true || false || true || false || true
|
||||
145 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:148:1
|
||||
--> cyclomatic_complexity.rs:148:1
|
||||
|
|
||||
148 | / fn baa() {
|
||||
149 | | let x = || match 99 {
|
||||
|
@ -63,10 +62,11 @@ error: the function has a cyclomatic complexity of 2
|
|||
163 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:149:13
|
||||
--> cyclomatic_complexity.rs:149:13
|
||||
|
|
||||
149 | let x = || match 99 {
|
||||
| _____________^
|
||||
|
@ -78,10 +78,11 @@ error: the function has a cyclomatic complexity of 2
|
|||
157 | | };
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:166:1
|
||||
--> cyclomatic_complexity.rs:166:1
|
||||
|
|
||||
166 | / fn bar() {
|
||||
167 | | match 99 {
|
||||
|
@ -91,10 +92,11 @@ error: the function has a cyclomatic complexity of 2
|
|||
171 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:185:1
|
||||
--> cyclomatic_complexity.rs:185:1
|
||||
|
|
||||
185 | / fn barr() {
|
||||
186 | | match 99 {
|
||||
|
@ -105,10 +107,11 @@ error: the function has a cyclomatic complexity of 2
|
|||
192 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 3
|
||||
--> $DIR/cyclomatic_complexity.rs:195:1
|
||||
--> cyclomatic_complexity.rs:195:1
|
||||
|
|
||||
195 | / fn barr2() {
|
||||
196 | | match 99 {
|
||||
|
@ -119,10 +122,11 @@ error: the function has a cyclomatic complexity of 3
|
|||
208 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:211:1
|
||||
--> cyclomatic_complexity.rs:211:1
|
||||
|
|
||||
211 | / fn barrr() {
|
||||
212 | | match 99 {
|
||||
|
@ -133,10 +137,11 @@ error: the function has a cyclomatic complexity of 2
|
|||
218 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 3
|
||||
--> $DIR/cyclomatic_complexity.rs:221:1
|
||||
--> cyclomatic_complexity.rs:221:1
|
||||
|
|
||||
221 | / fn barrr2() {
|
||||
222 | | match 99 {
|
||||
|
@ -147,10 +152,11 @@ error: the function has a cyclomatic complexity of 3
|
|||
234 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:237:1
|
||||
--> cyclomatic_complexity.rs:237:1
|
||||
|
|
||||
237 | / fn barrrr() {
|
||||
238 | | match 99 {
|
||||
|
@ -161,10 +167,11 @@ error: the function has a cyclomatic complexity of 2
|
|||
244 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 3
|
||||
--> $DIR/cyclomatic_complexity.rs:247:1
|
||||
--> cyclomatic_complexity.rs:247:1
|
||||
|
|
||||
247 | / fn barrrr2() {
|
||||
248 | | match 99 {
|
||||
|
@ -175,10 +182,11 @@ error: the function has a cyclomatic complexity of 3
|
|||
260 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:263:1
|
||||
--> cyclomatic_complexity.rs:263:1
|
||||
|
|
||||
263 | / fn cake() {
|
||||
264 | | if 4 == 5 {
|
||||
|
@ -189,10 +197,11 @@ error: the function has a cyclomatic complexity of 2
|
|||
270 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 4
|
||||
--> $DIR/cyclomatic_complexity.rs:274:1
|
||||
--> cyclomatic_complexity.rs:274:1
|
||||
|
|
||||
274 | / pub fn read_file(input_path: &str) -> String {
|
||||
275 | | use std::fs::File;
|
||||
|
@ -203,10 +212,11 @@ error: the function has a cyclomatic complexity of 4
|
|||
300 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:305:1
|
||||
--> cyclomatic_complexity.rs:305:1
|
||||
|
|
||||
305 | / fn void(void: Void) {
|
||||
306 | | if true {
|
||||
|
@ -216,10 +226,11 @@ error: the function has a cyclomatic complexity of 1
|
|||
310 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:319:1
|
||||
--> cyclomatic_complexity.rs:319:1
|
||||
|
|
||||
319 | / fn try() -> Result<i32, &'static str> {
|
||||
320 | | match 5 {
|
||||
|
@ -229,10 +240,11 @@ error: the function has a cyclomatic complexity of 1
|
|||
324 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:327:1
|
||||
--> cyclomatic_complexity.rs:327:1
|
||||
|
|
||||
327 | / fn try_again() -> Result<i32, &'static str> {
|
||||
328 | | let _ = try!(Ok(42));
|
||||
|
@ -243,10 +255,11 @@ error: the function has a cyclomatic complexity of 1
|
|||
340 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:343:1
|
||||
--> cyclomatic_complexity.rs:343:1
|
||||
|
|
||||
343 | / fn early() -> Result<i32, &'static str> {
|
||||
344 | | return Ok(5);
|
||||
|
@ -257,10 +270,11 @@ error: the function has a cyclomatic complexity of 1
|
|||
353 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 8
|
||||
--> $DIR/cyclomatic_complexity.rs:356:1
|
||||
--> cyclomatic_complexity.rs:356:1
|
||||
|
|
||||
356 | / fn early_ret() -> i32 {
|
||||
357 | | let a = if true { 42 } else { return 0; };
|
||||
|
@ -271,7 +285,11 @@ error: the function has a cyclomatic complexity of 8
|
|||
373 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: aborting due to 20 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin, custom_attribute)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(cyclomatic_complexity)]
|
||||
#![deny(unused)]
|
||||
#![warn(cyclomatic_complexity)]
|
||||
#![warn(unused)]
|
||||
|
||||
fn main() {
|
||||
kaboom();
|
|
@ -1,5 +1,5 @@
|
|||
error: the function has a cyclomatic complexity of 3
|
||||
--> $DIR/cyclomatic_complexity_attr_used.rs:11:1
|
||||
--> cyclomatic_complexity_attr_used.rs:11:1
|
||||
|
|
||||
11 | / fn kaboom() {
|
||||
12 | | if 42 == 43 {
|
||||
|
@ -10,12 +10,11 @@ error: the function has a cyclomatic complexity of 3
|
|||
17 | | }
|
||||
| |_^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cyclomatic_complexity_attr_used.rs:3:9
|
||||
|
|
||||
3 | #![deny(cyclomatic_complexity)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D cyclomatic-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#![feature(untagged_unions)]
|
||||
|
||||
#![deny(warnings)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::hash::{Hash, Hasher};
|
84
clippy_tests/examples/derive.stderr
Normal file
84
clippy_tests/examples/derive.stderr
Normal file
|
@ -0,0 +1,84 @@
|
|||
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
|
||||
--> derive.rs:17:10
|
||||
|
|
||||
17 | #[derive(Hash)]
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D derive-hash-xor-eq` implied by `-D warnings`
|
||||
note: `PartialEq` implemented here
|
||||
--> derive.rs:20:1
|
||||
|
|
||||
20 | / impl PartialEq for Bar {
|
||||
21 | | fn eq(&self, _: &Bar) -> bool { true }
|
||||
22 | | }
|
||||
| |_^
|
||||
|
||||
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
|
||||
--> derive.rs:24:10
|
||||
|
|
||||
24 | #[derive(Hash)]
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D derive-hash-xor-eq` implied by `-D warnings`
|
||||
note: `PartialEq` implemented here
|
||||
--> derive.rs:27:1
|
||||
|
|
||||
27 | / impl PartialEq<Baz> for Baz {
|
||||
28 | | fn eq(&self, _: &Baz) -> bool { true }
|
||||
29 | | }
|
||||
| |_^
|
||||
|
||||
error: you are implementing `Hash` explicitly but have derived `PartialEq`
|
||||
--> derive.rs:34:1
|
||||
|
|
||||
34 | / impl Hash for Bah {
|
||||
35 | | fn hash<H: Hasher>(&self, _: &mut H) {}
|
||||
36 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D derive-hash-xor-eq` implied by `-D warnings`
|
||||
note: `PartialEq` implemented here
|
||||
--> derive.rs:31:10
|
||||
|
|
||||
31 | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: you are implementing `Clone` explicitly on a `Copy` type
|
||||
--> derive.rs:41:1
|
||||
|
|
||||
41 | / impl Clone for Qux {
|
||||
42 | | fn clone(&self) -> Self { Qux }
|
||||
43 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D expl-impl-clone-on-copy` implied by `-D warnings`
|
||||
note: consider deriving `Clone` or removing `Copy`
|
||||
--> derive.rs:41:1
|
||||
|
|
||||
41 | / impl Clone for Qux {
|
||||
42 | | fn clone(&self) -> Self { Qux }
|
||||
43 | | }
|
||||
| |_^
|
||||
|
||||
error: you are implementing `Clone` explicitly on a `Copy` type
|
||||
--> derive.rs:65:1
|
||||
|
|
||||
65 | / impl<'a> Clone for Lt<'a> {
|
||||
66 | | fn clone(&self) -> Self { unimplemented!() }
|
||||
67 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D expl-impl-clone-on-copy` implied by `-D warnings`
|
||||
note: consider deriving `Clone` or removing `Copy`
|
||||
--> derive.rs:65:1
|
||||
|
|
||||
65 | / impl<'a> Clone for Lt<'a> {
|
||||
66 | | fn clone(&self) -> Self { unimplemented!() }
|
||||
67 | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(plugin, never_type)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(diverging_sub_expression)]
|
||||
#![warn(diverging_sub_expression)]
|
||||
#![allow(match_same_arms, logic_bug)]
|
||||
|
||||
#[allow(empty_loop)]
|
53
clippy_tests/examples/diverging_sub_expression.stderr
Normal file
53
clippy_tests/examples/diverging_sub_expression.stderr
Normal file
|
@ -0,0 +1,53 @@
|
|||
error: sub-expression diverges
|
||||
--> diverging_sub_expression.rs:18:10
|
||||
|
|
||||
18 | b || diverge();
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D diverging-sub-expression` implied by `-D warnings`
|
||||
|
||||
error: sub-expression diverges
|
||||
--> diverging_sub_expression.rs:19:10
|
||||
|
|
||||
19 | b || A.foo();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D diverging-sub-expression` implied by `-D warnings`
|
||||
|
||||
error: sub-expression diverges
|
||||
--> diverging_sub_expression.rs:28:26
|
||||
|
|
||||
28 | 6 => true || return,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D diverging-sub-expression` implied by `-D warnings`
|
||||
|
||||
error: sub-expression diverges
|
||||
--> diverging_sub_expression.rs:29:26
|
||||
|
|
||||
29 | 7 => true || continue,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D diverging-sub-expression` implied by `-D warnings`
|
||||
|
||||
error: sub-expression diverges
|
||||
--> diverging_sub_expression.rs:32:26
|
||||
|
|
||||
32 | 3 => true || diverge(),
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D diverging-sub-expression` implied by `-D warnings`
|
||||
|
||||
error: sub-expression diverges
|
||||
--> diverging_sub_expression.rs:37:26
|
||||
|
|
||||
37 | _ => true || break,
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D diverging-sub-expression` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -3,7 +3,7 @@
|
|||
#![feature(associated_consts)]
|
||||
|
||||
#![plugin(clippy)]
|
||||
#![deny(clippy)]
|
||||
#![warn(clippy)]
|
||||
#![allow(dead_code, needless_pass_by_value)]
|
||||
|
||||
extern crate collections;
|
|
@ -1,61 +1,59 @@
|
|||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:13:16
|
||||
--> dlist.rs:13:16
|
||||
|
|
||||
13 | type Baz = LinkedList<u8>;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(linkedlist)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/dlist.rs:6:9
|
||||
|
|
||||
6 | #![deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D linkedlist` implied by `-D warnings`
|
||||
= help: a VecDeque might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:14:12
|
||||
--> dlist.rs:14:12
|
||||
|
|
||||
14 | fn foo(LinkedList<u8>);
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(linkedlist)] implied by #[deny(clippy)]
|
||||
= note: `-D linkedlist` implied by `-D warnings`
|
||||
= help: a VecDeque might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:15:24
|
||||
--> dlist.rs:15:24
|
||||
|
|
||||
15 | const BAR : Option<LinkedList<u8>>;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(linkedlist)] implied by #[deny(clippy)]
|
||||
= note: `-D linkedlist` implied by `-D warnings`
|
||||
= help: a VecDeque might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:26:15
|
||||
--> dlist.rs:26:15
|
||||
|
|
||||
26 | fn foo(_: LinkedList<u8>) {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(linkedlist)] implied by #[deny(clippy)]
|
||||
= note: `-D linkedlist` implied by `-D warnings`
|
||||
= help: a VecDeque might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:29:39
|
||||
--> dlist.rs:29:39
|
||||
|
|
||||
29 | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(linkedlist)] implied by #[deny(clippy)]
|
||||
= note: `-D linkedlist` implied by `-D warnings`
|
||||
= help: a VecDeque might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:33:29
|
||||
--> dlist.rs:33:29
|
||||
|
|
||||
33 | pub fn test_ret() -> Option<LinkedList<u8>> {
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(linkedlist)] implied by #[deny(clippy)]
|
||||
= note: `-D linkedlist` implied by `-D warnings`
|
||||
= help: a VecDeque might work
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -3,7 +3,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(doc_markdown)]
|
||||
#![warn(doc_markdown)]
|
||||
|
||||
/// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
||||
/// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
|
|
@ -1,182 +1,237 @@
|
|||
error: you should put `DOC_MARKDOWN` between ticks in the documentation
|
||||
--> $DIR/doc.rs:1:29
|
||||
--> doc.rs:1:29
|
||||
|
|
||||
1 | //! This file tests for the DOC_MARKDOWN lint
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/doc.rs:6:9
|
||||
|
|
||||
6 | #![deny(doc_markdown)]
|
||||
| ^^^^^^^^^^^^
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `foo_bar` between ticks in the documentation
|
||||
--> $DIR/doc.rs:8:9
|
||||
--> doc.rs:8:9
|
||||
|
|
||||
8 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `foo::bar` between ticks in the documentation
|
||||
--> $DIR/doc.rs:8:51
|
||||
--> doc.rs:8:51
|
||||
|
|
||||
8 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `Foo::some_fun` between ticks in the documentation
|
||||
--> $DIR/doc.rs:9:84
|
||||
--> doc.rs:9:84
|
||||
|
|
||||
9 | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun
|
||||
9 | /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `is::a::global:path` between ticks in the documentation
|
||||
--> $DIR/doc.rs:11:13
|
||||
--> doc.rs:11:13
|
||||
|
|
||||
11 | /// Here be ::is::a::global:path.
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `NotInCodeBlock` between ticks in the documentation
|
||||
--> $DIR/doc.rs:12:21
|
||||
--> doc.rs:12:21
|
||||
|
|
||||
12 | /// That's not code ~NotInCodeBlock~.
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:13:5
|
||||
--> doc.rs:13:5
|
||||
|
|
||||
13 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:27:5
|
||||
--> doc.rs:27:5
|
||||
|
|
||||
27 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:34:5
|
||||
--> doc.rs:34:5
|
||||
|
|
||||
34 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:48:5
|
||||
--> doc.rs:48:5
|
||||
|
|
||||
48 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `ß_foo` between ticks in the documentation
|
||||
--> $DIR/doc.rs:57:5
|
||||
--> doc.rs:57:5
|
||||
|
|
||||
57 | /// ß_foo
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `ℝ_foo` between ticks in the documentation
|
||||
--> $DIR/doc.rs:58:5
|
||||
--> doc.rs:58:5
|
||||
|
|
||||
58 | /// ℝ_foo
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `foo_ß` between ticks in the documentation
|
||||
--> $DIR/doc.rs:61:5
|
||||
--> doc.rs:61:5
|
||||
|
|
||||
61 | /// foo_ß
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `foo_ℝ` between ticks in the documentation
|
||||
--> $DIR/doc.rs:62:5
|
||||
--> doc.rs:62:5
|
||||
|
|
||||
62 | /// foo_ℝ
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:77:5
|
||||
--> doc.rs:77:5
|
||||
|
|
||||
77 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `link_with_underscores` between ticks in the documentation
|
||||
--> $DIR/doc.rs:81:22
|
||||
--> doc.rs:81:22
|
||||
|
|
||||
81 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `inline_link2` between ticks in the documentation
|
||||
--> $DIR/doc.rs:84:21
|
||||
--> doc.rs:84:21
|
||||
|
|
||||
84 | /// It can also be [inline_link2].
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:94:5
|
||||
--> doc.rs:94:5
|
||||
|
|
||||
94 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `CamelCaseThing` between ticks in the documentation
|
||||
--> $DIR/doc.rs:107:22
|
||||
--> doc.rs:107:22
|
||||
|
|
||||
107 | /// Not a title #897 CamelCaseThing
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:108:5
|
||||
--> doc.rs:108:5
|
||||
|
|
||||
108 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:115:5
|
||||
--> doc.rs:115:5
|
||||
|
|
||||
115 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:128:5
|
||||
--> doc.rs:128:5
|
||||
|
|
||||
128 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `FooBar` between ticks in the documentation
|
||||
--> $DIR/doc.rs:139:42
|
||||
--> doc.rs:139:42
|
||||
|
|
||||
139 | /** E.g. serialization of an empty list: FooBar
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `BarQuz` between ticks in the documentation
|
||||
--> $DIR/doc.rs:144:5
|
||||
--> doc.rs:144:5
|
||||
|
|
||||
144 | And BarQuz too.
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:145:1
|
||||
--> doc.rs:145:1
|
||||
|
|
||||
145 | be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `FooBar` between ticks in the documentation
|
||||
--> $DIR/doc.rs:150:42
|
||||
--> doc.rs:150:42
|
||||
|
|
||||
150 | /** E.g. serialization of an empty list: FooBar
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `BarQuz` between ticks in the documentation
|
||||
--> $DIR/doc.rs:155:5
|
||||
--> doc.rs:155:5
|
||||
|
|
||||
155 | And BarQuz too.
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:156:1
|
||||
--> doc.rs:156:1
|
||||
|
|
||||
156 | be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
||||
--> $DIR/doc.rs:167:5
|
||||
--> doc.rs:167:5
|
||||
|
|
||||
167 | /// be_sure_we_got_to_the_end_of_it
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 29 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(double_neg)]
|
||||
#[warn(double_neg)]
|
||||
fn main() {
|
||||
let x = 1;
|
||||
-x;
|
13
clippy_tests/examples/double_neg.stderr
Normal file
13
clippy_tests/examples/double_neg.stderr
Normal file
|
@ -0,0 +1,13 @@
|
|||
error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op
|
||||
--> double_neg.rs:9:5
|
||||
|
|
||||
9 | --x;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D double-neg` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(double_parens)]
|
||||
#![warn(double_parens)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
fn dummy_fn<T>(_: T) {}
|
|
@ -1,38 +1,45 @@
|
|||
error: Consider removing unnecessary double parentheses
|
||||
--> $DIR/double_parens.rs:16:5
|
||||
--> double_parens.rs:16:5
|
||||
|
|
||||
16 | ((0))
|
||||
| ^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/double_parens.rs:4:9
|
||||
|
|
||||
4 | #![deny(double_parens)]
|
||||
| ^^^^^^^^^^^^^
|
||||
= note: `-D double-parens` implied by `-D warnings`
|
||||
|
||||
error: Consider removing unnecessary double parentheses
|
||||
--> $DIR/double_parens.rs:20:14
|
||||
--> double_parens.rs:20:14
|
||||
|
|
||||
20 | dummy_fn((0));
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D double-parens` implied by `-D warnings`
|
||||
|
||||
error: Consider removing unnecessary double parentheses
|
||||
--> $DIR/double_parens.rs:24:20
|
||||
--> double_parens.rs:24:20
|
||||
|
|
||||
24 | x.dummy_method((0));
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D double-parens` implied by `-D warnings`
|
||||
|
||||
error: Consider removing unnecessary double parentheses
|
||||
--> $DIR/double_parens.rs:28:5
|
||||
--> double_parens.rs:28:5
|
||||
|
|
||||
28 | ((1, 2))
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D double-parens` implied by `-D warnings`
|
||||
|
||||
error: Consider removing unnecessary double parentheses
|
||||
--> $DIR/double_parens.rs:32:5
|
||||
--> double_parens.rs:32:5
|
||||
|
|
||||
32 | (())
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D double-parens` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(drop_copy, forget_copy)]
|
||||
#![warn(drop_copy, forget_copy)]
|
||||
#![allow(toplevel_ref_arg, drop_ref, forget_ref, unused_mut)]
|
||||
|
||||
use std::mem::{drop, forget};
|
|
@ -1,84 +1,83 @@
|
|||
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
|
||||
--> $DIR/drop_forget_copy.rs:33:5
|
||||
--> drop_forget_copy.rs:33:5
|
||||
|
|
||||
33 | drop(s1);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/drop_forget_copy.rs:4:9
|
||||
|
|
||||
4 | #![deny(drop_copy, forget_copy)]
|
||||
| ^^^^^^^^^
|
||||
= note: `-D drop-copy` implied by `-D warnings`
|
||||
note: argument has type SomeStruct
|
||||
--> $DIR/drop_forget_copy.rs:33:10
|
||||
--> drop_forget_copy.rs:33:10
|
||||
|
|
||||
33 | drop(s1);
|
||||
| ^^
|
||||
|
||||
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
|
||||
--> $DIR/drop_forget_copy.rs:34:5
|
||||
--> drop_forget_copy.rs:34:5
|
||||
|
|
||||
34 | drop(s2);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-copy` implied by `-D warnings`
|
||||
note: argument has type SomeStruct
|
||||
--> $DIR/drop_forget_copy.rs:34:10
|
||||
--> drop_forget_copy.rs:34:10
|
||||
|
|
||||
34 | drop(s2);
|
||||
| ^^
|
||||
|
||||
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
|
||||
--> $DIR/drop_forget_copy.rs:36:5
|
||||
--> drop_forget_copy.rs:36:5
|
||||
|
|
||||
36 | drop(s4);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-copy` implied by `-D warnings`
|
||||
note: argument has type SomeStruct
|
||||
--> $DIR/drop_forget_copy.rs:36:10
|
||||
--> drop_forget_copy.rs:36:10
|
||||
|
|
||||
36 | drop(s4);
|
||||
| ^^
|
||||
|
||||
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
|
||||
--> $DIR/drop_forget_copy.rs:39:5
|
||||
--> drop_forget_copy.rs:39:5
|
||||
|
|
||||
39 | forget(s1);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/drop_forget_copy.rs:4:20
|
||||
|
|
||||
4 | #![deny(drop_copy, forget_copy)]
|
||||
| ^^^^^^^^^^^
|
||||
= note: `-D forget-copy` implied by `-D warnings`
|
||||
note: argument has type SomeStruct
|
||||
--> $DIR/drop_forget_copy.rs:39:12
|
||||
--> drop_forget_copy.rs:39:12
|
||||
|
|
||||
39 | forget(s1);
|
||||
| ^^
|
||||
|
||||
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
|
||||
--> $DIR/drop_forget_copy.rs:40:5
|
||||
--> drop_forget_copy.rs:40:5
|
||||
|
|
||||
40 | forget(s2);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-copy` implied by `-D warnings`
|
||||
note: argument has type SomeStruct
|
||||
--> $DIR/drop_forget_copy.rs:40:12
|
||||
--> drop_forget_copy.rs:40:12
|
||||
|
|
||||
40 | forget(s2);
|
||||
| ^^
|
||||
|
||||
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
|
||||
--> $DIR/drop_forget_copy.rs:42:5
|
||||
--> drop_forget_copy.rs:42:5
|
||||
|
|
||||
42 | forget(s4);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-copy` implied by `-D warnings`
|
||||
note: argument has type SomeStruct
|
||||
--> $DIR/drop_forget_copy.rs:42:12
|
||||
--> drop_forget_copy.rs:42:12
|
||||
|
|
||||
42 | forget(s4);
|
||||
| ^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(drop_ref, forget_ref)]
|
||||
#![warn(drop_ref, forget_ref)]
|
||||
#![allow(toplevel_ref_arg, similar_names, needless_pass_by_value)]
|
||||
|
||||
use std::mem::{drop, forget};
|
|
@ -1,228 +1,239 @@
|
|||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:12:5
|
||||
--> drop_forget_ref.rs:12:5
|
||||
|
|
||||
12 | drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/drop_forget_ref.rs:4:9
|
||||
|
|
||||
4 | #![deny(drop_ref, forget_ref)]
|
||||
| ^^^^^^^^
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:12:10
|
||||
--> drop_forget_ref.rs:12:10
|
||||
|
|
||||
12 | drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:13:5
|
||||
--> drop_forget_ref.rs:13:5
|
||||
|
|
||||
13 | forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/drop_forget_ref.rs:4:19
|
||||
|
|
||||
4 | #![deny(drop_ref, forget_ref)]
|
||||
| ^^^^^^^^^^
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:13:12
|
||||
--> drop_forget_ref.rs:13:12
|
||||
|
|
||||
13 | forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:16:5
|
||||
--> drop_forget_ref.rs:16:5
|
||||
|
|
||||
16 | drop(&owned1);
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:16:10
|
||||
--> drop_forget_ref.rs:16:10
|
||||
|
|
||||
16 | drop(&owned1);
|
||||
| ^^^^^^^
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:17:5
|
||||
--> drop_forget_ref.rs:17:5
|
||||
|
|
||||
17 | drop(&&owned1);
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &&SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:17:10
|
||||
--> drop_forget_ref.rs:17:10
|
||||
|
|
||||
17 | drop(&&owned1);
|
||||
| ^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:18:5
|
||||
--> drop_forget_ref.rs:18:5
|
||||
|
|
||||
18 | drop(&mut owned1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &mut SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:18:10
|
||||
--> drop_forget_ref.rs:18:10
|
||||
|
|
||||
18 | drop(&mut owned1);
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:21:5
|
||||
--> drop_forget_ref.rs:21:5
|
||||
|
|
||||
21 | forget(&owned2);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:21:12
|
||||
--> drop_forget_ref.rs:21:12
|
||||
|
|
||||
21 | forget(&owned2);
|
||||
| ^^^^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:22:5
|
||||
--> drop_forget_ref.rs:22:5
|
||||
|
|
||||
22 | forget(&&owned2);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &&SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:22:12
|
||||
--> drop_forget_ref.rs:22:12
|
||||
|
|
||||
22 | forget(&&owned2);
|
||||
| ^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:23:5
|
||||
--> drop_forget_ref.rs:23:5
|
||||
|
|
||||
23 | forget(&mut owned2);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &mut SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:23:12
|
||||
--> drop_forget_ref.rs:23:12
|
||||
|
|
||||
23 | forget(&mut owned2);
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:27:5
|
||||
--> drop_forget_ref.rs:27:5
|
||||
|
|
||||
27 | drop(reference1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:27:10
|
||||
--> drop_forget_ref.rs:27:10
|
||||
|
|
||||
27 | drop(reference1);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:28:5
|
||||
--> drop_forget_ref.rs:28:5
|
||||
|
|
||||
28 | forget(&*reference1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:28:12
|
||||
--> drop_forget_ref.rs:28:12
|
||||
|
|
||||
28 | forget(&*reference1);
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:31:5
|
||||
--> drop_forget_ref.rs:31:5
|
||||
|
|
||||
31 | drop(reference2);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &mut SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:31:10
|
||||
--> drop_forget_ref.rs:31:10
|
||||
|
|
||||
31 | drop(reference2);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:33:5
|
||||
--> drop_forget_ref.rs:33:5
|
||||
|
|
||||
33 | forget(reference3);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &mut SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:33:12
|
||||
--> drop_forget_ref.rs:33:12
|
||||
|
|
||||
33 | forget(reference3);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:36:5
|
||||
--> drop_forget_ref.rs:36:5
|
||||
|
|
||||
36 | drop(reference4);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:36:10
|
||||
--> drop_forget_ref.rs:36:10
|
||||
|
|
||||
36 | drop(reference4);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:37:5
|
||||
--> drop_forget_ref.rs:37:5
|
||||
|
|
||||
37 | forget(reference4);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:37:12
|
||||
--> drop_forget_ref.rs:37:12
|
||||
|
|
||||
37 | forget(reference4);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:42:5
|
||||
--> drop_forget_ref.rs:42:5
|
||||
|
|
||||
42 | drop(&val);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &T
|
||||
--> $DIR/drop_forget_ref.rs:42:10
|
||||
--> drop_forget_ref.rs:42:10
|
||||
|
|
||||
42 | drop(&val);
|
||||
| ^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:48:5
|
||||
--> drop_forget_ref.rs:48:5
|
||||
|
|
||||
48 | forget(&val);
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &T
|
||||
--> $DIR/drop_forget_ref.rs:48:12
|
||||
--> drop_forget_ref.rs:48:12
|
||||
|
|
||||
48 | forget(&val);
|
||||
| ^^^^
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:56:5
|
||||
--> drop_forget_ref.rs:56:5
|
||||
|
|
||||
56 | std::mem::drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D drop-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:56:20
|
||||
--> drop_forget_ref.rs:56:20
|
||||
|
|
||||
56 | std::mem::drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
|
||||
--> $DIR/drop_forget_ref.rs:59:5
|
||||
--> drop_forget_ref.rs:59:5
|
||||
|
|
||||
59 | std::mem::forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D forget-ref` implied by `-D warnings`
|
||||
note: argument has type &SomeStruct
|
||||
--> $DIR/drop_forget_ref.rs:59:22
|
||||
--> drop_forget_ref.rs:59:22
|
||||
|
|
||||
59 | std::mem::forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 18 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(duplicate_underscore_argument)]
|
||||
#![warn(duplicate_underscore_argument)]
|
||||
#[allow(dead_code, unused)]
|
||||
|
||||
fn join_the_dark_side(darth: i32, _darth: i32) {}
|
|
@ -1,14 +1,13 @@
|
|||
error: `darth` already exists, having another argument having almost the same name makes code comprehension and documentation more difficult
|
||||
--> $DIR/duplicate_underscore_argument.rs:7:23
|
||||
--> duplicate_underscore_argument.rs:7:23
|
||||
|
|
||||
7 | fn join_the_dark_side(darth: i32, _darth: i32) {}
|
||||
| ^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/duplicate_underscore_argument.rs:4:9
|
||||
|
|
||||
4 | #![deny(duplicate_underscore_argument)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D duplicate-underscore-argument` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -2,7 +2,7 @@
|
|||
#![plugin(clippy)]
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![deny(empty_enum)]
|
||||
#![warn(empty_enum)]
|
||||
|
||||
enum Empty {}
|
||||
|
|
@ -1,19 +1,18 @@
|
|||
error: enum with no variants
|
||||
--> $DIR/empty_enum.rs:7:1
|
||||
--> empty_enum.rs:7:1
|
||||
|
|
||||
7 | enum Empty {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/empty_enum.rs:5:9
|
||||
|
|
||||
5 | #![deny(empty_enum)]
|
||||
| ^^^^^^^^^^
|
||||
= note: `-D empty-enum` implied by `-D warnings`
|
||||
help: consider using the uninhabited type `!` or a wrapper around it
|
||||
--> $DIR/empty_enum.rs:7:1
|
||||
--> empty_enum.rs:7:1
|
||||
|
|
||||
7 | enum Empty {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -2,7 +2,7 @@
|
|||
#![plugin(clippy)]
|
||||
#![allow(unused, needless_pass_by_value)]
|
||||
|
||||
#![deny(map_entry)]
|
||||
#![warn(map_entry)]
|
||||
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::hash::Hash;
|
|
@ -1,50 +1,61 @@
|
|||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||
--> $DIR/entry.rs:13:5
|
||||
--> entry.rs:13:5
|
||||
|
|
||||
13 | if !m.contains_key(&k) { m.insert(k, v); }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k).or_insert(v)`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/entry.rs:5:9
|
||||
|
|
||||
5 | #![deny(map_entry)]
|
||||
| ^^^^^^^^^
|
||||
= note: `-D map-entry` implied by `-D warnings`
|
||||
|
||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||
--> $DIR/entry.rs:17:5
|
||||
--> entry.rs:17:5
|
||||
|
|
||||
17 | if !m.contains_key(&k) { foo(); m.insert(k, v); }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)`
|
||||
|
|
||||
= note: `-D map-entry` implied by `-D warnings`
|
||||
|
||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||
--> $DIR/entry.rs:21:5
|
||||
--> entry.rs:21:5
|
||||
|
|
||||
21 | if !m.contains_key(&k) { m.insert(k, v) } else { None };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)`
|
||||
|
|
||||
= note: `-D map-entry` implied by `-D warnings`
|
||||
|
||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||
--> $DIR/entry.rs:25:5
|
||||
--> entry.rs:25:5
|
||||
|
|
||||
25 | if m.contains_key(&k) { None } else { m.insert(k, v) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)`
|
||||
|
|
||||
= note: `-D map-entry` implied by `-D warnings`
|
||||
|
||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||
--> $DIR/entry.rs:29:5
|
||||
--> entry.rs:29:5
|
||||
|
|
||||
29 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)`
|
||||
|
|
||||
= note: `-D map-entry` implied by `-D warnings`
|
||||
|
||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||
--> $DIR/entry.rs:33:5
|
||||
--> entry.rs:33:5
|
||||
|
|
||||
33 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)`
|
||||
|
|
||||
= note: `-D map-entry` implied by `-D warnings`
|
||||
|
||||
error: usage of `contains_key` followed by `insert` on a `BTreeMap`
|
||||
--> $DIR/entry.rs:37:5
|
||||
--> entry.rs:37:5
|
||||
|
|
||||
37 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)`
|
||||
|
|
||||
= note: `-D map-entry` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(clippy, clippy_pedantic)]
|
||||
#![warn(clippy, clippy_pedantic)]
|
||||
#![allow(unused_imports, dead_code, missing_docs_in_private_items)]
|
||||
|
||||
use std::cmp::Ordering::*;
|
21
clippy_tests/examples/enum_glob_use.stderr
Normal file
21
clippy_tests/examples/enum_glob_use.stderr
Normal file
|
@ -0,0 +1,21 @@
|
|||
error: don't use glob imports for enum variants
|
||||
--> enum_glob_use.rs:6:1
|
||||
|
|
||||
6 | use std::cmp::Ordering::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D enum-glob-use` implied by `-D warnings`
|
||||
|
||||
error: don't use glob imports for enum variants
|
||||
--> enum_glob_use.rs:12:1
|
||||
|
|
||||
12 | use self::Enum::*;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D enum-glob-use` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(plugin, non_ascii_idents)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(clippy, pub_enum_variant_names)]
|
||||
#![warn(clippy, pub_enum_variant_names)]
|
||||
|
||||
enum FakeCallType {
|
||||
CALL, CREATE
|
|
@ -1,42 +1,37 @@
|
|||
error: Variant name ends with the enum's name
|
||||
--> $DIR/enum_variants.rs:14:5
|
||||
--> enum_variants.rs:14:5
|
||||
|
|
||||
14 | cFoo,
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/enum_variants.rs:3:9
|
||||
|
|
||||
3 | #![deny(clippy, pub_enum_variant_names)]
|
||||
| ^^^^^^
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
|
||||
error: Variant name starts with the enum's name
|
||||
--> $DIR/enum_variants.rs:25:5
|
||||
--> enum_variants.rs:25:5
|
||||
|
|
||||
25 | FoodGood,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
|
||||
error: Variant name starts with the enum's name
|
||||
--> $DIR/enum_variants.rs:26:5
|
||||
--> enum_variants.rs:26:5
|
||||
|
|
||||
26 | FoodMiddle,
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
|
||||
error: Variant name starts with the enum's name
|
||||
--> $DIR/enum_variants.rs:27:5
|
||||
--> enum_variants.rs:27:5
|
||||
|
|
||||
27 | FoodBad,
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
|
||||
error: All variants have the same prefix: `Food`
|
||||
--> $DIR/enum_variants.rs:24:1
|
||||
--> enum_variants.rs:24:1
|
||||
|
|
||||
24 | / enum Food {
|
||||
25 | | FoodGood,
|
||||
|
@ -45,11 +40,11 @@ error: All variants have the same prefix: `Food`
|
|||
28 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `CallType`
|
||||
--> $DIR/enum_variants.rs:34:1
|
||||
--> enum_variants.rs:34:1
|
||||
|
|
||||
34 | / enum BadCallType {
|
||||
35 | | CallTypeCall,
|
||||
|
@ -58,11 +53,11 @@ error: All variants have the same prefix: `CallType`
|
|||
38 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `Constant`
|
||||
--> $DIR/enum_variants.rs:45:1
|
||||
--> enum_variants.rs:45:1
|
||||
|
|
||||
45 | / enum Consts {
|
||||
46 | | ConstantInt,
|
||||
|
@ -71,11 +66,11 @@ error: All variants have the same prefix: `Constant`
|
|||
49 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `With`
|
||||
--> $DIR/enum_variants.rs:78:1
|
||||
--> enum_variants.rs:78:1
|
||||
|
|
||||
78 | / enum Seallll {
|
||||
79 | | WithOutCake,
|
||||
|
@ -84,11 +79,11 @@ error: All variants have the same prefix: `With`
|
|||
82 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `Prefix`
|
||||
--> $DIR/enum_variants.rs:84:1
|
||||
--> enum_variants.rs:84:1
|
||||
|
|
||||
84 | / enum NonCaps {
|
||||
85 | | Prefix的,
|
||||
|
@ -97,11 +92,11 @@ error: All variants have the same prefix: `Prefix`
|
|||
88 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-variant-names` implied by `-D warnings`
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `With`
|
||||
--> $DIR/enum_variants.rs:90:1
|
||||
--> enum_variants.rs:90:1
|
||||
|
|
||||
90 | / pub enum PubSeall {
|
||||
91 | | WithOutCake,
|
||||
|
@ -110,12 +105,11 @@ error: All variants have the same prefix: `With`
|
|||
94 | | }
|
||||
| |_^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/enum_variants.rs:3:17
|
||||
|
|
||||
3 | #![deny(clippy, pub_enum_variant_names)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D pub-enum-variant-names` implied by `-D warnings`
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
// ignore-x86
|
||||
#![feature(plugin, associated_consts)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(clippy)]
|
||||
#![warn(clippy)]
|
||||
|
||||
#![allow(unused)]
|
||||
|
|
@ -1,71 +1,69 @@
|
|||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enums_clike.rs:10:5
|
||||
--> enums_clike.rs:10:5
|
||||
|
|
||||
10 | X = 0x1_0000_0000,
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_clike_unportable_variant)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/enums_clike.rs:4:9
|
||||
|
|
||||
4 | #![deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enums_clike.rs:17:5
|
||||
--> enums_clike.rs:17:5
|
||||
|
|
||||
17 | X = 0x1_0000_0000,
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_clike_unportable_variant)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enums_clike.rs:20:5
|
||||
--> enums_clike.rs:20:5
|
||||
|
|
||||
20 | A = 0xFFFF_FFFF,
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_clike_unportable_variant)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enums_clike.rs:27:5
|
||||
--> enums_clike.rs:27:5
|
||||
|
|
||||
27 | Z = 0xFFFF_FFFF,
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_clike_unportable_variant)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enums_clike.rs:28:5
|
||||
--> enums_clike.rs:28:5
|
||||
|
|
||||
28 | A = 0x1_0000_0000,
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_clike_unportable_variant)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enums_clike.rs:30:5
|
||||
--> enums_clike.rs:30:5
|
||||
|
|
||||
30 | C = (std::i32::MIN as isize) - 1,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_clike_unportable_variant)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enums_clike.rs:36:5
|
||||
--> enums_clike.rs:36:5
|
||||
|
|
||||
36 | Z = 0xFFFF_FFFF,
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_clike_unportable_variant)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enums_clike.rs:37:5
|
||||
--> enums_clike.rs:37:5
|
||||
|
|
||||
37 | A = 0x1_0000_0000,
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(enum_clike_unportable_variant)] implied by #[deny(clippy)]
|
||||
= note: `-D enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,10 +1,10 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(eq_op)]
|
||||
#[warn(eq_op)]
|
||||
#[allow(identity_op, double_parens, many_single_char_names)]
|
||||
#[allow(no_effect, unused_variables, unnecessary_operation, short_circuit_statement)]
|
||||
#[deny(nonminimal_bool)]
|
||||
#[warn(nonminimal_bool)]
|
||||
fn main() {
|
||||
// simple values and comparisons
|
||||
1 == 1;
|
|
@ -1,216 +1,271 @@
|
|||
error: this boolean expression can be simplified
|
||||
--> $DIR/eq_op.rs:37:5
|
||||
--> eq_op.rs:37:5
|
||||
|
|
||||
37 | true && true;
|
||||
| ^^^^^^^^^^^^ help: try `true`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/eq_op.rs:7:8
|
||||
|
|
||||
7 | #[deny(nonminimal_bool)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/eq_op.rs:39:5
|
||||
--> eq_op.rs:39:5
|
||||
|
|
||||
39 | true || true;
|
||||
| ^^^^^^^^^^^^ help: try `true`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/eq_op.rs:45:5
|
||||
--> eq_op.rs:45:5
|
||||
|
|
||||
45 | a == b && b == a;
|
||||
| ^^^^^^^^^^^^^^^^ help: try `a == b`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/eq_op.rs:46:5
|
||||
--> eq_op.rs:46:5
|
||||
|
|
||||
46 | a != b && b != a;
|
||||
| ^^^^^^^^^^^^^^^^ help: try `a != b`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/eq_op.rs:47:5
|
||||
--> eq_op.rs:47:5
|
||||
|
|
||||
47 | a < b && b > a;
|
||||
| ^^^^^^^^^^^^^^ help: try `a < b`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/eq_op.rs:48:5
|
||||
--> eq_op.rs:48:5
|
||||
|
|
||||
48 | a <= b && b >= a;
|
||||
| ^^^^^^^^^^^^^^^^ help: try `a <= b`
|
||||
|
|
||||
= note: `-D nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `==`
|
||||
--> $DIR/eq_op.rs:10:5
|
||||
--> eq_op.rs:10:5
|
||||
|
|
||||
10 | 1 == 1;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/eq_op.rs:4:8
|
||||
|
|
||||
4 | #[deny(eq_op)]
|
||||
| ^^^^^
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `==`
|
||||
--> $DIR/eq_op.rs:11:5
|
||||
--> eq_op.rs:11:5
|
||||
|
|
||||
11 | "no" == "no";
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `!=`
|
||||
--> $DIR/eq_op.rs:13:5
|
||||
--> eq_op.rs:13:5
|
||||
|
|
||||
13 | false != false;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `<`
|
||||
--> $DIR/eq_op.rs:14:5
|
||||
--> eq_op.rs:14:5
|
||||
|
|
||||
14 | 1.5 < 1.5;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `>=`
|
||||
--> $DIR/eq_op.rs:15:5
|
||||
--> eq_op.rs:15:5
|
||||
|
|
||||
15 | 1u64 >= 1u64;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `&`
|
||||
--> $DIR/eq_op.rs:18:5
|
||||
--> eq_op.rs:18:5
|
||||
|
|
||||
18 | (1 as u64) & (1 as u64);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `^`
|
||||
--> $DIR/eq_op.rs:19:5
|
||||
--> eq_op.rs:19:5
|
||||
|
|
||||
19 | 1 ^ ((((((1))))));
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `<`
|
||||
--> $DIR/eq_op.rs:22:5
|
||||
--> eq_op.rs:22:5
|
||||
|
|
||||
22 | (-(2) < -(2));
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `==`
|
||||
--> $DIR/eq_op.rs:23:5
|
||||
--> eq_op.rs:23:5
|
||||
|
|
||||
23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `&`
|
||||
--> $DIR/eq_op.rs:23:6
|
||||
--> eq_op.rs:23:6
|
||||
|
|
||||
23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `&`
|
||||
--> $DIR/eq_op.rs:23:27
|
||||
--> eq_op.rs:23:27
|
||||
|
|
||||
23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `==`
|
||||
--> $DIR/eq_op.rs:24:5
|
||||
--> eq_op.rs:24:5
|
||||
|
|
||||
24 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `!=`
|
||||
--> $DIR/eq_op.rs:27:5
|
||||
--> eq_op.rs:27:5
|
||||
|
|
||||
27 | ([1] != [1]);
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `!=`
|
||||
--> $DIR/eq_op.rs:28:5
|
||||
--> eq_op.rs:28:5
|
||||
|
|
||||
28 | ((1, 2) != (1, 2));
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `==`
|
||||
--> $DIR/eq_op.rs:32:5
|
||||
--> eq_op.rs:32:5
|
||||
|
|
||||
32 | 1 + 1 == 2;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `==`
|
||||
--> $DIR/eq_op.rs:33:5
|
||||
--> eq_op.rs:33:5
|
||||
|
|
||||
33 | 1 - 1 == 0;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `-`
|
||||
--> $DIR/eq_op.rs:33:5
|
||||
--> eq_op.rs:33:5
|
||||
|
|
||||
33 | 1 - 1 == 0;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `-`
|
||||
--> $DIR/eq_op.rs:35:5
|
||||
--> eq_op.rs:35:5
|
||||
|
|
||||
35 | 1 - 1;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `/`
|
||||
--> $DIR/eq_op.rs:36:5
|
||||
--> eq_op.rs:36:5
|
||||
|
|
||||
36 | 1 / 1;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `&&`
|
||||
--> $DIR/eq_op.rs:37:5
|
||||
--> eq_op.rs:37:5
|
||||
|
|
||||
37 | true && true;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `||`
|
||||
--> $DIR/eq_op.rs:39:5
|
||||
--> eq_op.rs:39:5
|
||||
|
|
||||
39 | true || true;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `&&`
|
||||
--> $DIR/eq_op.rs:45:5
|
||||
--> eq_op.rs:45:5
|
||||
|
|
||||
45 | a == b && b == a;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `&&`
|
||||
--> $DIR/eq_op.rs:46:5
|
||||
--> eq_op.rs:46:5
|
||||
|
|
||||
46 | a != b && b != a;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `&&`
|
||||
--> $DIR/eq_op.rs:47:5
|
||||
--> eq_op.rs:47:5
|
||||
|
|
||||
47 | a < b && b > a;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `&&`
|
||||
--> $DIR/eq_op.rs:48:5
|
||||
--> eq_op.rs:48:5
|
||||
|
|
||||
48 | a <= b && b >= a;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
error: equal expressions as operands to `==`
|
||||
--> $DIR/eq_op.rs:51:5
|
||||
--> eq_op.rs:51:5
|
||||
|
|
||||
51 | a == a;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D eq-op` implied by `-D warnings`
|
||||
|
||||
warning: taken reference of right operand
|
||||
--> $DIR/eq_op.rs:89:13
|
||||
error: taken reference of right operand
|
||||
--> eq_op.rs:89:13
|
||||
|
|
||||
89 | let z = x & &y;
|
||||
| ^^^^--
|
||||
| |
|
||||
| help: use the right value directly `y`
|
||||
|
|
||||
= note: #[warn(op_ref)] on by default
|
||||
= note: `-D op-ref` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 32 previous errors
|
||||
error: aborting due to 33 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -2,7 +2,7 @@
|
|||
#![plugin(clippy)]
|
||||
#![allow(warnings, clippy)]
|
||||
|
||||
#![deny(boxed_local)]
|
||||
#![warn(boxed_local)]
|
||||
|
||||
#[derive(Clone)]
|
||||
struct A;
|
0
clippy_tests/examples/escape_analysis.stderr
Normal file
0
clippy_tests/examples/escape_analysis.stderr
Normal file
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![allow(unknown_lints, unused, no_effect, redundant_closure_call, many_single_char_names, needless_pass_by_value)]
|
||||
#![deny(redundant_closure)]
|
||||
#![warn(redundant_closure)]
|
||||
|
||||
fn main() {
|
||||
let a = Some(1u8).map(|a| foo(a));
|
|
@ -1,40 +1,45 @@
|
|||
error: redundant closure found
|
||||
--> $DIR/eta.rs:7:27
|
||||
--> eta.rs:7:27
|
||||
|
|
||||
7 | let a = Some(1u8).map(|a| foo(a));
|
||||
| ^^^^^^^^^^ help: remove closure as shown: `foo`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/eta.rs:4:9
|
||||
|
|
||||
4 | #![deny(redundant_closure)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= note: `-D redundant-closure` implied by `-D warnings`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:8:10
|
||||
--> eta.rs:8:10
|
||||
|
|
||||
8 | meta(|a| foo(a));
|
||||
| ^^^^^^^^^^ help: remove closure as shown: `foo`
|
||||
|
|
||||
= note: `-D redundant-closure` implied by `-D warnings`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:9:27
|
||||
--> eta.rs:9:27
|
||||
|
|
||||
9 | let c = Some(1u8).map(|a| {1+2; foo}(a));
|
||||
| ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}`
|
||||
|
|
||||
= note: `-D redundant-closure` implied by `-D warnings`
|
||||
|
||||
warning: this expression borrows a reference that is immediately dereferenced by the compiler
|
||||
--> $DIR/eta.rs:11:21
|
||||
error: this expression borrows a reference that is immediately dereferenced by the compiler
|
||||
--> eta.rs:11:21
|
||||
|
|
||||
11 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
|
||||
| ^^^
|
||||
|
|
||||
= note: #[warn(needless_borrow)] on by default
|
||||
= note: `-D needless-borrow` implied by `-D warnings`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:18:27
|
||||
--> eta.rs:18:27
|
||||
|
|
||||
18 | let e = Some(1u8).map(|a| generic(a));
|
||||
| ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
|
||||
|
|
||||
= note: `-D redundant-closure` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[deny(eval_order_dependence)]
|
||||
#[warn(eval_order_dependence)]
|
||||
#[allow(unused_assignments, unused_variables, many_single_char_names, no_effect, dead_code, blacklisted_name)]
|
||||
fn main() {
|
||||
let mut x = 0;
|
|
@ -1,55 +1,57 @@
|
|||
error: unsequenced read of a variable
|
||||
--> $DIR/eval_order_dependence.rs:8:28
|
||||
--> eval_order_dependence.rs:8:28
|
||||
|
|
||||
8 | let a = { x = 1; 1 } + x;
|
||||
| ^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/eval_order_dependence.rs:4:8
|
||||
|
|
||||
4 | #[deny(eval_order_dependence)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D eval-order-dependence` implied by `-D warnings`
|
||||
note: whether read occurs before this write depends on evaluation order
|
||||
--> $DIR/eval_order_dependence.rs:8:15
|
||||
--> eval_order_dependence.rs:8:15
|
||||
|
|
||||
8 | let a = { x = 1; 1 } + x;
|
||||
| ^^^^^
|
||||
|
||||
error: unsequenced read of a variable
|
||||
--> $DIR/eval_order_dependence.rs:11:5
|
||||
--> eval_order_dependence.rs:11:5
|
||||
|
|
||||
11 | x += { x = 20; 2 };
|
||||
| ^
|
||||
|
|
||||
= note: `-D eval-order-dependence` implied by `-D warnings`
|
||||
note: whether read occurs before this write depends on evaluation order
|
||||
--> $DIR/eval_order_dependence.rs:11:12
|
||||
--> eval_order_dependence.rs:11:12
|
||||
|
|
||||
11 | x += { x = 20; 2 };
|
||||
| ^^^^^^
|
||||
|
||||
error: unsequenced read of a variable
|
||||
--> $DIR/eval_order_dependence.rs:17:24
|
||||
--> eval_order_dependence.rs:17:24
|
||||
|
|
||||
17 | let foo = Foo { a: x, .. { x = 6; base } };
|
||||
| ^
|
||||
|
|
||||
= note: `-D eval-order-dependence` implied by `-D warnings`
|
||||
note: whether read occurs before this write depends on evaluation order
|
||||
--> $DIR/eval_order_dependence.rs:17:32
|
||||
--> eval_order_dependence.rs:17:32
|
||||
|
|
||||
17 | let foo = Foo { a: x, .. { x = 6; base } };
|
||||
| ^^^^^
|
||||
|
||||
error: unsequenced read of a variable
|
||||
--> $DIR/eval_order_dependence.rs:21:9
|
||||
--> eval_order_dependence.rs:21:9
|
||||
|
|
||||
21 | x += { x = 20; 2 };
|
||||
| ^
|
||||
|
|
||||
= note: `-D eval-order-dependence` implied by `-D warnings`
|
||||
note: whether read occurs before this write depends on evaluation order
|
||||
--> $DIR/eval_order_dependence.rs:21:16
|
||||
--> eval_order_dependence.rs:21:16
|
||||
|
|
||||
21 | x += { x = 20; 2 };
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(clippy, clippy_pedantic)]
|
||||
#![warn(clippy, clippy_pedantic)]
|
||||
#![allow(missing_docs_in_private_items)]
|
||||
|
||||
fn main() {
|
|
@ -1,5 +1,5 @@
|
|||
error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
|
||||
--> $DIR/filter_methods.rs:8:21
|
||||
--> filter_methods.rs:8:21
|
||||
|
|
||||
8 | let _: Vec<_> = vec![5; 6].into_iter()
|
||||
| _____________________^
|
||||
|
@ -7,15 +7,10 @@ error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expre
|
|||
10 | | .map(|x| x * 2)
|
||||
| |_____________________________________________^
|
||||
|
|
||||
= note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
|
||||
note: lint level defined here
|
||||
--> $DIR/filter_methods.rs:4:17
|
||||
|
|
||||
4 | #![deny(clippy, clippy_pedantic)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: `-D filter-map` implied by `-D warnings`
|
||||
|
||||
error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
|
||||
--> $DIR/filter_methods.rs:13:21
|
||||
--> filter_methods.rs:13:21
|
||||
|
|
||||
13 | let _: Vec<_> = vec![5_i8; 6].into_iter()
|
||||
| _____________________^
|
||||
|
@ -23,10 +18,10 @@ error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly
|
|||
15 | | .flat_map(|x| x.checked_mul(2))
|
||||
| |_______________________________________________________________^
|
||||
|
|
||||
= note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
|
||||
= note: `-D filter-map` implied by `-D warnings`
|
||||
|
||||
error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
|
||||
--> $DIR/filter_methods.rs:18:21
|
||||
--> filter_methods.rs:18:21
|
||||
|
|
||||
18 | let _: Vec<_> = vec![5_i8; 6].into_iter()
|
||||
| _____________________^
|
||||
|
@ -34,10 +29,10 @@ error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinc
|
|||
20 | | .flat_map(|x| x.checked_mul(2))
|
||||
| |_______________________________________________________________^
|
||||
|
|
||||
= note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
|
||||
= note: `-D filter-map` implied by `-D warnings`
|
||||
|
||||
error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead.
|
||||
--> $DIR/filter_methods.rs:23:21
|
||||
--> filter_methods.rs:23:21
|
||||
|
|
||||
23 | let _: Vec<_> = vec![5_i8; 6].into_iter()
|
||||
| _____________________^
|
||||
|
@ -45,7 +40,10 @@ error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly e
|
|||
25 | | .map(|x| x.checked_mul(2))
|
||||
| |__________________________________________________________^
|
||||
|
|
||||
= note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
|
||||
= note: `-D filter-map` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(float_cmp)]
|
||||
#![warn(float_cmp)]
|
||||
#![allow(unused, no_effect, unnecessary_operation)]
|
||||
|
||||
use std::ops::Add;
|
|
@ -1,103 +1,109 @@
|
|||
error: strict comparison of f32 or f64
|
||||
--> $DIR/float_cmp.rs:43:5
|
||||
--> float_cmp.rs:43:5
|
||||
|
|
||||
43 | ONE == 1f32;
|
||||
| ^^^^^^^^^^^ help: consider comparing them within some error `(ONE - 1f32).abs() < error`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/float_cmp.rs:4:9
|
||||
|
|
||||
4 | #![deny(float_cmp)]
|
||||
| ^^^^^^^^^
|
||||
= note: `-D float-cmp` implied by `-D warnings`
|
||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||
--> $DIR/float_cmp.rs:43:5
|
||||
--> float_cmp.rs:43:5
|
||||
|
|
||||
43 | ONE == 1f32;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: strict comparison of f32 or f64
|
||||
--> $DIR/float_cmp.rs:44:5
|
||||
--> float_cmp.rs:44:5
|
||||
|
|
||||
44 | ONE == 1.0 + 0.0;
|
||||
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE - (1.0 + 0.0)).abs() < error`
|
||||
|
|
||||
= note: `-D float-cmp` implied by `-D warnings`
|
||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||
--> $DIR/float_cmp.rs:44:5
|
||||
--> float_cmp.rs:44:5
|
||||
|
|
||||
44 | ONE == 1.0 + 0.0;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: strict comparison of f32 or f64
|
||||
--> $DIR/float_cmp.rs:45:5
|
||||
--> float_cmp.rs:45:5
|
||||
|
|
||||
45 | ONE + ONE == ZERO + ONE + ONE;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE + ONE - (ZERO + ONE + ONE)).abs() < error`
|
||||
|
|
||||
= note: `-D float-cmp` implied by `-D warnings`
|
||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||
--> $DIR/float_cmp.rs:45:5
|
||||
--> float_cmp.rs:45:5
|
||||
|
|
||||
45 | ONE + ONE == ZERO + ONE + ONE;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: strict comparison of f32 or f64
|
||||
--> $DIR/float_cmp.rs:46:5
|
||||
--> float_cmp.rs:46:5
|
||||
|
|
||||
46 | ONE != 2.0;
|
||||
| ^^^^^^^^^^ help: consider comparing them within some error `(ONE - 2.0).abs() < error`
|
||||
|
|
||||
= note: `-D float-cmp` implied by `-D warnings`
|
||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||
--> $DIR/float_cmp.rs:46:5
|
||||
--> float_cmp.rs:46:5
|
||||
|
|
||||
46 | ONE != 2.0;
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: strict comparison of f32 or f64
|
||||
--> $DIR/float_cmp.rs:48:5
|
||||
--> float_cmp.rs:48:5
|
||||
|
|
||||
48 | twice(ONE) != ONE;
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(twice(ONE) - ONE).abs() < error`
|
||||
|
|
||||
= note: `-D float-cmp` implied by `-D warnings`
|
||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||
--> $DIR/float_cmp.rs:48:5
|
||||
--> float_cmp.rs:48:5
|
||||
|
|
||||
48 | twice(ONE) != ONE;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: strict comparison of f32 or f64
|
||||
--> $DIR/float_cmp.rs:49:5
|
||||
--> float_cmp.rs:49:5
|
||||
|
|
||||
49 | ONE as f64 != 2.0;
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE as f64 - 2.0).abs() < error`
|
||||
|
|
||||
= note: `-D float-cmp` implied by `-D warnings`
|
||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||
--> $DIR/float_cmp.rs:49:5
|
||||
--> float_cmp.rs:49:5
|
||||
|
|
||||
49 | ONE as f64 != 2.0;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: strict comparison of f32 or f64
|
||||
--> $DIR/float_cmp.rs:54:5
|
||||
--> float_cmp.rs:54:5
|
||||
|
|
||||
54 | x == 1.0;
|
||||
| ^^^^^^^^ help: consider comparing them within some error `(x - 1.0).abs() < error`
|
||||
|
|
||||
= note: `-D float-cmp` implied by `-D warnings`
|
||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||
--> $DIR/float_cmp.rs:54:5
|
||||
--> float_cmp.rs:54:5
|
||||
|
|
||||
54 | x == 1.0;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: strict comparison of f32 or f64
|
||||
--> $DIR/float_cmp.rs:57:5
|
||||
--> float_cmp.rs:57:5
|
||||
|
|
||||
57 | twice(x) != twice(ONE as f64);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(twice(x) - twice(ONE as f64)).abs() < error`
|
||||
|
|
||||
= note: `-D float-cmp` implied by `-D warnings`
|
||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||
--> $DIR/float_cmp.rs:57:5
|
||||
--> float_cmp.rs:57:5
|
||||
|
|
||||
57 | twice(x) != twice(ONE as f64);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -7,7 +7,7 @@ use std::rc::Rc;
|
|||
static STATIC: [usize; 4] = [ 0, 1, 8, 16 ];
|
||||
const CONST: [usize; 4] = [ 0, 1, 8, 16 ];
|
||||
|
||||
#[deny(clippy)]
|
||||
#[warn(clippy)]
|
||||
fn for_loop_over_option_and_result() {
|
||||
let option = Some(1);
|
||||
let result = option.ok_or("x not found");
|
||||
|
@ -72,8 +72,8 @@ impl Unrelated {
|
|||
}
|
||||
}
|
||||
|
||||
#[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
#[deny(unused_collect)]
|
||||
#[warn(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
#[warn(unused_collect)]
|
||||
#[allow(linkedlist, shadow_unrelated, unnecessary_mut_passed, cyclomatic_complexity, similar_names)]
|
||||
#[allow(many_single_char_names)]
|
||||
fn main() {
|
|
@ -1,453 +1,450 @@
|
|||
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop.rs:17:14
|
||||
--> for_loop.rs:17:14
|
||||
|
|
||||
17 | for x in option {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: #[deny(for_loop_over_option)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:10:8
|
||||
|
|
||||
10 | #[deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D for-loop-over-option` implied by `-D warnings`
|
||||
= help: consider replacing `for x in option` with `if let Some(x) = option`
|
||||
|
||||
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop.rs:22:14
|
||||
--> for_loop.rs:22:14
|
||||
|
|
||||
22 | for x in result {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: #[deny(for_loop_over_result)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:10:8
|
||||
|
|
||||
10 | #[deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D for-loop-over-result` implied by `-D warnings`
|
||||
= help: consider replacing `for x in result` with `if let Ok(x) = result`
|
||||
|
||||
error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop.rs:26:14
|
||||
--> for_loop.rs:26:14
|
||||
|
|
||||
26 | for x in option.ok_or("x not found") {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(for_loop_over_result)] implied by #[deny(clippy)]
|
||||
= note: `-D for-loop-over-result` implied by `-D warnings`
|
||||
= help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
|
||||
|
||||
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
||||
--> $DIR/for_loop.rs:31:5
|
||||
--> for_loop.rs:31:5
|
||||
|
|
||||
31 | / for x in v.iter().next() {
|
||||
32 | | println!("{}", x);
|
||||
33 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(iter_next_loop)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:10:8
|
||||
|
|
||||
10 | #[deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D iter-next-loop` implied by `-D warnings`
|
||||
|
||||
error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop.rs:36:14
|
||||
--> for_loop.rs:36:14
|
||||
|
|
||||
36 | for x in v.iter().next().and(Some(0)) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(for_loop_over_option)] implied by #[deny(clippy)]
|
||||
= note: `-D for-loop-over-option` implied by `-D warnings`
|
||||
= help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
|
||||
|
||||
error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop.rs:40:14
|
||||
--> for_loop.rs:40:14
|
||||
|
|
||||
40 | for x in v.iter().next().ok_or("x not found") {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(for_loop_over_result)] implied by #[deny(clippy)]
|
||||
= note: `-D for-loop-over-result` implied by `-D warnings`
|
||||
= help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")`
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:84:5
|
||||
--> for_loop.rs:84:5
|
||||
|
|
||||
84 | / for i in 0..vec.len() {
|
||||
85 | | println!("{}", vec[i]);
|
||||
86 | | }
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:75:8
|
||||
|
|
||||
75 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in &vec {
|
||||
|
||||
warning: unused variable: `i`
|
||||
--> $DIR/for_loop.rs:88:9
|
||||
error: unused variable: `i`
|
||||
--> for_loop.rs:88:9
|
||||
|
|
||||
88 | for i in 0..vec.len() {
|
||||
| ^
|
||||
|
|
||||
= note: #[warn(unused_variables)] on by default
|
||||
= note: `-D unused-variables` implied by `-D warnings`
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:93:5
|
||||
--> for_loop.rs:93:5
|
||||
|
|
||||
93 | for i in 0..vec.len() { let _ = vec[i]; }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in &vec { let _ = vec[i]; }
|
||||
|
||||
error: the loop variable `j` is only used to index `STATIC`.
|
||||
--> $DIR/for_loop.rs:96:5
|
||||
--> for_loop.rs:96:5
|
||||
|
|
||||
96 | / for j in 0..4 {
|
||||
97 | | println!("{:?}", STATIC[j]);
|
||||
98 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in STATIC.iter().take(4) {
|
||||
|
||||
error: the loop variable `j` is only used to index `CONST`.
|
||||
--> $DIR/for_loop.rs:100:5
|
||||
--> for_loop.rs:100:5
|
||||
|
|
||||
100 | / for j in 0..4 {
|
||||
101 | | println!("{:?}", CONST[j]);
|
||||
102 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in CONST.iter().take(4) {
|
||||
|
||||
error: the loop variable `i` is used to index `vec`
|
||||
--> $DIR/for_loop.rs:104:5
|
||||
--> for_loop.rs:104:5
|
||||
|
|
||||
104 | / for i in 0..vec.len() {
|
||||
105 | | println!("{} {}", vec[i], i);
|
||||
106 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for (i, <item>) in vec.iter().enumerate() {
|
||||
|
||||
error: the loop variable `i` is only used to index `vec2`.
|
||||
--> $DIR/for_loop.rs:111:5
|
||||
--> for_loop.rs:111:5
|
||||
|
|
||||
111 | / for i in 0..vec.len() {
|
||||
112 | | println!("{}", vec2[i]);
|
||||
113 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in vec2.iter().take(vec.len()) {
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:115:5
|
||||
--> for_loop.rs:115:5
|
||||
|
|
||||
115 | / for i in 5..vec.len() {
|
||||
116 | | println!("{}", vec[i]);
|
||||
117 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().skip(5) {
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:119:5
|
||||
--> for_loop.rs:119:5
|
||||
|
|
||||
119 | / for i in 0..MAX_LEN {
|
||||
120 | | println!("{}", vec[i]);
|
||||
121 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().take(MAX_LEN) {
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:123:5
|
||||
--> for_loop.rs:123:5
|
||||
|
|
||||
123 | / for i in 0...MAX_LEN {
|
||||
124 | | println!("{}", vec[i]);
|
||||
125 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().take(MAX_LEN + 1) {
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:127:5
|
||||
--> for_loop.rs:127:5
|
||||
|
|
||||
127 | / for i in 5..10 {
|
||||
128 | | println!("{}", vec[i]);
|
||||
129 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().take(10).skip(5) {
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:131:5
|
||||
--> for_loop.rs:131:5
|
||||
|
|
||||
131 | / for i in 5...10 {
|
||||
132 | | println!("{}", vec[i]);
|
||||
133 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().take(10 + 1).skip(5) {
|
||||
|
||||
error: the loop variable `i` is used to index `vec`
|
||||
--> $DIR/for_loop.rs:135:5
|
||||
--> for_loop.rs:135:5
|
||||
|
|
||||
135 | / for i in 5..vec.len() {
|
||||
136 | | println!("{} {}", vec[i], i);
|
||||
137 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for (i, <item>) in vec.iter().enumerate().skip(5) {
|
||||
|
||||
error: the loop variable `i` is used to index `vec`
|
||||
--> $DIR/for_loop.rs:139:5
|
||||
--> for_loop.rs:139:5
|
||||
|
|
||||
139 | / for i in 5..10 {
|
||||
140 | | println!("{} {}", vec[i], i);
|
||||
141 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D needless-range-loop` implied by `-D warnings`
|
||||
help: consider using an iterator
|
||||
| for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
|
||||
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:143:5
|
||||
--> for_loop.rs:143:5
|
||||
|
|
||||
143 | / for i in 10..0 {
|
||||
144 | | println!("{}", i);
|
||||
145 | | }
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:75:90
|
||||
|
|
||||
75 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D reverse-range-loop` implied by `-D warnings`
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in (0..10).rev() {
|
||||
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:147:5
|
||||
--> for_loop.rs:147:5
|
||||
|
|
||||
147 | / for i in 10...0 {
|
||||
148 | | println!("{}", i);
|
||||
149 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D reverse-range-loop` implied by `-D warnings`
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in (0...10).rev() {
|
||||
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:151:5
|
||||
--> for_loop.rs:151:5
|
||||
|
|
||||
151 | / for i in MAX_LEN..0 {
|
||||
152 | | println!("{}", i);
|
||||
153 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D reverse-range-loop` implied by `-D warnings`
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in (0..MAX_LEN).rev() {
|
||||
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:155:5
|
||||
--> for_loop.rs:155:5
|
||||
|
|
||||
155 | / for i in 5..5 {
|
||||
156 | | println!("{}", i);
|
||||
157 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D reverse-range-loop` implied by `-D warnings`
|
||||
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:176:5
|
||||
--> for_loop.rs:176:5
|
||||
|
|
||||
176 | / for i in 10..5+4 {
|
||||
177 | | println!("{}", i);
|
||||
178 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D reverse-range-loop` implied by `-D warnings`
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in (5+4..10).rev() {
|
||||
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:180:5
|
||||
--> for_loop.rs:180:5
|
||||
|
|
||||
180 | / for i in (5+2)..(3-1) {
|
||||
181 | | println!("{}", i);
|
||||
182 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D reverse-range-loop` implied by `-D warnings`
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in ((3-1)..(5+2)).rev() {
|
||||
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:184:5
|
||||
--> for_loop.rs:184:5
|
||||
|
|
||||
184 | / for i in (5+2)..(8-1) {
|
||||
185 | | println!("{}", i);
|
||||
186 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D reverse-range-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:207:15
|
||||
--> for_loop.rs:207:15
|
||||
|
|
||||
207 | for _v in vec.iter() { }
|
||||
| ^^^^^^^^^^ help: to write this more concisely, try `&vec`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:75:29
|
||||
|
|
||||
75 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:209:15
|
||||
--> for_loop.rs:209:15
|
||||
|
|
||||
209 | for _v in vec.iter_mut() { }
|
||||
| ^^^^^^^^^^^^^^ help: to write this more concisely, try `&mut vec`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over containers instead of using explicit iteration methods`
|
||||
--> $DIR/for_loop.rs:212:15
|
||||
--> for_loop.rs:212:15
|
||||
|
|
||||
212 | for _v in out_vec.into_iter() { }
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `out_vec`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:75:49
|
||||
|
|
||||
75 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D explicit-into-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:215:15
|
||||
--> for_loop.rs:215:15
|
||||
|
|
||||
215 | for _v in array.into_iter() {}
|
||||
| ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&array`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:220:15
|
||||
--> for_loop.rs:220:15
|
||||
|
|
||||
220 | for _v in [1, 2, 3].iter() { }
|
||||
| ^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&[1, 2, 3]`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:224:15
|
||||
--> for_loop.rs:224:15
|
||||
|
|
||||
224 | for _v in [0; 32].iter() {}
|
||||
| ^^^^^^^^^^^^^^ help: to write this more concisely, try `&[0; 32]`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:229:15
|
||||
--> for_loop.rs:229:15
|
||||
|
|
||||
229 | for _v in ll.iter() { }
|
||||
| ^^^^^^^^^ help: to write this more concisely, try `&ll`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:232:15
|
||||
--> for_loop.rs:232:15
|
||||
|
|
||||
232 | for _v in vd.iter() { }
|
||||
| ^^^^^^^^^ help: to write this more concisely, try `&vd`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:235:15
|
||||
--> for_loop.rs:235:15
|
||||
|
|
||||
235 | for _v in bh.iter() { }
|
||||
| ^^^^^^^^^ help: to write this more concisely, try `&bh`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:238:15
|
||||
--> for_loop.rs:238:15
|
||||
|
|
||||
238 | for _v in hm.iter() { }
|
||||
| ^^^^^^^^^ help: to write this more concisely, try `&hm`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:241:15
|
||||
--> for_loop.rs:241:15
|
||||
|
|
||||
241 | for _v in bt.iter() { }
|
||||
| ^^^^^^^^^ help: to write this more concisely, try `&bt`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:244:15
|
||||
--> for_loop.rs:244:15
|
||||
|
|
||||
244 | for _v in hs.iter() { }
|
||||
| ^^^^^^^^^ help: to write this more concisely, try `&hs`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:247:15
|
||||
--> for_loop.rs:247:15
|
||||
|
|
||||
247 | for _v in bs.iter() { }
|
||||
| ^^^^^^^^^ help: to write this more concisely, try `&bs`
|
||||
|
|
||||
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
||||
|
||||
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
||||
--> $DIR/for_loop.rs:249:5
|
||||
--> for_loop.rs:249:5
|
||||
|
|
||||
249 | for _v in vec.iter().next() { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:75:74
|
||||
|
|
||||
75 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: `-D iter-next-loop` implied by `-D warnings`
|
||||
|
||||
error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
|
||||
--> $DIR/for_loop.rs:256:5
|
||||
--> for_loop.rs:256:5
|
||||
|
|
||||
256 | vec.iter().map(|x| out.push(x)).collect::<Vec<_>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:76:8
|
||||
|
|
||||
76 | #[deny(unused_collect)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: `-D unused-collect` implied by `-D warnings`
|
||||
|
||||
error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
|
||||
--> $DIR/for_loop.rs:261:5
|
||||
--> for_loop.rs:261:5
|
||||
|
|
||||
261 | for _v in &vec { _index += 1 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:75:110
|
||||
|
|
||||
75 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D explicit-counter-loop` implied by `-D warnings`
|
||||
|
||||
error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
|
||||
--> $DIR/for_loop.rs:265:5
|
||||
--> for_loop.rs:265:5
|
||||
|
|
||||
265 | for _v in &vec { _index += 1 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D explicit-counter-loop` implied by `-D warnings`
|
||||
|
||||
error: you seem to want to iterate on a map's values
|
||||
--> $DIR/for_loop.rs:325:5
|
||||
--> for_loop.rs:325:5
|
||||
|
|
||||
325 | / for (_, v) in &m {
|
||||
326 | | let _v = v;
|
||||
327 | | }
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:75:133
|
||||
|
|
||||
75 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
||||
| ^^^^^^^^^^
|
||||
= note: `-D for-kv-map` implied by `-D warnings`
|
||||
help: use the corresponding method
|
||||
| for v in m.values() {
|
||||
|
||||
error: you seem to want to iterate on a map's values
|
||||
--> $DIR/for_loop.rs:330:5
|
||||
--> for_loop.rs:330:5
|
||||
|
|
||||
330 | / for (_, v) in &*m {
|
||||
331 | | let _v = v;
|
||||
|
@ -456,41 +453,48 @@ error: you seem to want to iterate on a map's values
|
|||
334 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D for-kv-map` implied by `-D warnings`
|
||||
help: use the corresponding method
|
||||
| for v in (*m).values() {
|
||||
|
||||
error: you seem to want to iterate on a map's values
|
||||
--> $DIR/for_loop.rs:337:5
|
||||
--> for_loop.rs:337:5
|
||||
|
|
||||
337 | / for (_, v) in &mut m {
|
||||
338 | | let _v = v;
|
||||
339 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D for-kv-map` implied by `-D warnings`
|
||||
help: use the corresponding method
|
||||
| for v in m.values_mut() {
|
||||
|
||||
error: you seem to want to iterate on a map's values
|
||||
--> $DIR/for_loop.rs:342:5
|
||||
--> for_loop.rs:342:5
|
||||
|
|
||||
342 | / for (_, v) in &mut *m {
|
||||
343 | | let _v = v;
|
||||
344 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D for-kv-map` implied by `-D warnings`
|
||||
help: use the corresponding method
|
||||
| for v in (*m).values_mut() {
|
||||
|
||||
error: you seem to want to iterate on a map's keys
|
||||
--> $DIR/for_loop.rs:348:5
|
||||
--> for_loop.rs:348:5
|
||||
|
|
||||
348 | / for (k, _value) in rm {
|
||||
349 | | let _k = k;
|
||||
350 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D for-kv-map` implied by `-D warnings`
|
||||
help: use the corresponding method
|
||||
| for k in rm.keys() {
|
||||
|
||||
error: aborting due to 48 previous errors
|
||||
error: aborting due to 49 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(useless_format)]
|
||||
#![warn(useless_format)]
|
||||
|
||||
fn main() {
|
||||
format!("foo");
|
|
@ -1,26 +1,29 @@
|
|||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:6:5
|
||||
--> format.rs:6:5
|
||||
|
|
||||
6 | format!("foo");
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/format.rs:3:9
|
||||
|
|
||||
3 | #![deny(useless_format)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: `-D useless-format` implied by `-D warnings`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:8:5
|
||||
--> format.rs:8:5
|
||||
|
|
||||
8 | format!("{}", "foo");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D useless-format` implied by `-D warnings`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:15:5
|
||||
--> format.rs:15:5
|
||||
|
|
||||
15 | format!("{}", arg);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D useless-format` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(clippy)]
|
||||
#![warn(clippy)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(if_same_then_else)]
|
|
@ -1,48 +1,43 @@
|
|||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/formatting.rs:15:6
|
||||
--> formatting.rs:15:6
|
||||
|
|
||||
15 | } if foo() {
|
||||
| ^
|
||||
|
|
||||
= note: #[deny(suspicious_else_formatting)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/formatting.rs:4:9
|
||||
|
|
||||
4 | #![deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D suspicious-else-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/formatting.rs:22:10
|
||||
--> formatting.rs:22:10
|
||||
|
|
||||
22 | } if foo() {
|
||||
| ^
|
||||
|
|
||||
= note: #[deny(suspicious_else_formatting)] implied by #[deny(clippy)]
|
||||
= note: `-D suspicious-else-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/formatting.rs:30:10
|
||||
--> formatting.rs:30:10
|
||||
|
|
||||
30 | } if foo() {
|
||||
| ^
|
||||
|
|
||||
= note: #[deny(suspicious_else_formatting)] implied by #[deny(clippy)]
|
||||
= note: `-D suspicious-else-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this is an `else if` but the formatting might hide it
|
||||
--> $DIR/formatting.rs:39:6
|
||||
--> formatting.rs:39:6
|
||||
|
|
||||
39 | } else
|
||||
| ______^
|
||||
40 | | if foo() { // the span of the above error should continue here
|
||||
| |____^
|
||||
|
|
||||
= note: #[deny(suspicious_else_formatting)] implied by #[deny(clippy)]
|
||||
= note: `-D suspicious-else-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
|
||||
|
||||
error: this is an `else if` but the formatting might hide it
|
||||
--> $DIR/formatting.rs:44:6
|
||||
--> formatting.rs:44:6
|
||||
|
|
||||
44 | }
|
||||
| ______^
|
||||
|
@ -50,63 +45,56 @@ error: this is an `else if` but the formatting might hide it
|
|||
46 | | if foo() { // the span of the above error should continue here
|
||||
| |____^
|
||||
|
|
||||
= note: #[deny(suspicious_else_formatting)] implied by #[deny(clippy)]
|
||||
= note: `-D suspicious-else-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
|
||||
|
||||
error: this looks like you are trying to use `.. -= ..`, but you really are doing `.. = (- ..)`
|
||||
--> $DIR/formatting.rs:71:6
|
||||
--> formatting.rs:71:6
|
||||
|
|
||||
71 | a =- 35;
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(suspicious_assignment_formatting)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/formatting.rs:4:9
|
||||
|
|
||||
4 | #![deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D suspicious-assignment-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, use either `-=` or `= -`
|
||||
|
||||
error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)`
|
||||
--> $DIR/formatting.rs:72:6
|
||||
--> formatting.rs:72:6
|
||||
|
|
||||
72 | a =* &191;
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(suspicious_assignment_formatting)] implied by #[deny(clippy)]
|
||||
= note: `-D suspicious-assignment-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, use either `*=` or `= *`
|
||||
|
||||
error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)`
|
||||
--> $DIR/formatting.rs:75:6
|
||||
--> formatting.rs:75:6
|
||||
|
|
||||
75 | b =! false;
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(suspicious_assignment_formatting)] implied by #[deny(clippy)]
|
||||
= note: `-D suspicious-assignment-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, use either `!=` or `= !`
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:84:19
|
||||
--> formatting.rs:84:19
|
||||
|
|
||||
84 | -1, -2, -3 // <= no comma here
|
||||
| ^
|
||||
|
|
||||
= note: #[deny(possible_missing_comma)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> $DIR/formatting.rs:4:9
|
||||
|
|
||||
4 | #![deny(clippy)]
|
||||
| ^^^^^^
|
||||
= note: `-D possible-missing-comma` implied by `-D warnings`
|
||||
= note: to remove this lint, add a comma or write the expr in a single line
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:88:19
|
||||
--> formatting.rs:88:19
|
||||
|
|
||||
88 | -1, -2, -3 // <= no comma here
|
||||
| ^
|
||||
|
|
||||
= note: #[deny(possible_missing_comma)] implied by #[deny(clippy)]
|
||||
= note: `-D possible-missing-comma` implied by `-D warnings`
|
||||
= note: to remove this lint, add a comma or write the expr in a single line
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(clippy)]
|
||||
#![warn(clippy)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_unsafe)]
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue