diff --git a/.gitignore b/.gitignore index 705ebe4ba0b..11458b88927 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file +.vscode diff --git a/Cargo.toml b/Cargo.toml index ce033c7b1fd..bfe50b10872 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index 9c6a2819535..10408c02e39 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -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" diff --git a/clippy_tests/Cargo.toml b/clippy_tests/Cargo.toml new file mode 100644 index 00000000000..3ac4905285e --- /dev/null +++ b/clippy_tests/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "clippy_tests" +version = "0.1.0" +authors = ["Oliver Schneider "] + +[dependencies] +clippy = { path = ".." } + +[workspace] diff --git a/tests/ui/absurd-extreme-comparisons.rs b/clippy_tests/examples/absurd-extreme-comparisons.rs similarity index 96% rename from tests/ui/absurd-extreme-comparisons.rs rename to clippy_tests/examples/absurd-extreme-comparisons.rs index 4bd1aa35dc9..87c49f88573 100644 --- a/tests/ui/absurd-extreme-comparisons.rs +++ b/clippy_tests/examples/absurd-extreme-comparisons.rs @@ -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() { diff --git a/tests/ui/absurd-extreme-comparisons.stderr b/clippy_tests/examples/absurd-extreme-comparisons.stderr similarity index 69% rename from tests/ui/absurd-extreme-comparisons.stderr rename to clippy_tests/examples/absurd-extreme-comparisons.stderr index 25fabf0aafd..3bb71cf3c79 100644 --- a/tests/ui/absurd-extreme-comparisons.stderr +++ b/clippy_tests/examples/absurd-extreme-comparisons.stderr @@ -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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/approx_const.rs b/clippy_tests/examples/approx_const.rs similarity index 98% rename from tests/ui/approx_const.rs rename to clippy_tests/examples/approx_const.rs index 2da762725b1..eb66a633f9e 100644 --- a/tests/ui/approx_const.rs +++ b/clippy_tests/examples/approx_const.rs @@ -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; diff --git a/tests/ui/approx_const.stderr b/clippy_tests/examples/approx_const.stderr similarity index 63% rename from tests/ui/approx_const.stderr rename to clippy_tests/examples/approx_const.stderr index cc0408fb2d9..d446bdf14ba 100644 --- a/tests/ui/approx_const.stderr +++ b/clippy_tests/examples/approx_const.stderr @@ -1,122 +1,157 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly - --> $DIR/approx_const.rs:7:16 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/arithmetic.rs b/clippy_tests/examples/arithmetic.rs similarity index 90% rename from tests/ui/arithmetic.rs rename to clippy_tests/examples/arithmetic.rs index b4014cc480f..b281c239f36 100644 --- a/tests/ui/arithmetic.rs +++ b/clippy_tests/examples/arithmetic.rs @@ -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; diff --git a/clippy_tests/examples/arithmetic.stderr b/clippy_tests/examples/arithmetic.stderr new file mode 100644 index 00000000000..5e2b9237d6f --- /dev/null +++ b/clippy_tests/examples/arithmetic.stderr @@ -0,0 +1,94 @@ +error: integer arithmetic detected + --> examples/arithmetic.rs:8:5 + | +8 | 1 + i; + | ^^^^^ + | + = note: `-D integer-arithmetic` implied by `-D warnings` + +error: integer arithmetic detected + --> examples/arithmetic.rs:9:5 + | +9 | i * 2; + | ^^^^^ + | + = note: `-D integer-arithmetic` implied by `-D warnings` + +error: integer arithmetic detected + --> examples/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 + --> examples/arithmetic.rs:12:5 + | +12 | i - 2 + 2 - i; + | ^^^^^^^^^^^^^ + | + = note: `-D integer-arithmetic` implied by `-D warnings` + +error: integer arithmetic detected + --> examples/arithmetic.rs:13:5 + | +13 | -i; + | ^^ + | + = note: `-D integer-arithmetic` implied by `-D warnings` + +error: floating-point arithmetic detected + --> examples/arithmetic.rs:23:5 + | +23 | f * 2.0; + | ^^^^^^^ + | + = note: `-D float-arithmetic` implied by `-D warnings` + +error: floating-point arithmetic detected + --> examples/arithmetic.rs:25:5 + | +25 | 1.0 + f; + | ^^^^^^^ + | + = note: `-D float-arithmetic` implied by `-D warnings` + +error: floating-point arithmetic detected + --> examples/arithmetic.rs:26:5 + | +26 | f * 2.0; + | ^^^^^^^ + | + = note: `-D float-arithmetic` implied by `-D warnings` + +error: floating-point arithmetic detected + --> examples/arithmetic.rs:27:5 + | +27 | f / 2.0; + | ^^^^^^^ + | + = note: `-D float-arithmetic` implied by `-D warnings` + +error: floating-point arithmetic detected + --> examples/arithmetic.rs:28:5 + | +28 | f - 2.0 * 4.2; + | ^^^^^^^^^^^^^ + | + = note: `-D float-arithmetic` implied by `-D warnings` + +error: floating-point arithmetic detected + --> examples/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. diff --git a/tests/ui/array_indexing.rs b/clippy_tests/examples/array_indexing.rs similarity index 91% rename from tests/ui/array_indexing.rs rename to clippy_tests/examples/array_indexing.rs index 28b4c78b444..34b422db6e9 100644 --- a/tests/ui/array_indexing.rs +++ b/clippy_tests/examples/array_indexing.rs @@ -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() { diff --git a/clippy_tests/examples/array_indexing.stderr b/clippy_tests/examples/array_indexing.stderr new file mode 100644 index 00000000000..ef952421231 --- /dev/null +++ b/clippy_tests/examples/array_indexing.stderr @@ -0,0 +1,157 @@ +error: const index is out of bounds + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/array_indexing.rs:17:6 + | +17 | &x[...4]; + | ^^^^^^^ + | + = note: `-D out-of-bounds-indexing` implied by `-D warnings` + +error: range is out of bounds + --> examples/array_indexing.rs:21:6 + | +21 | &x[5..]; + | ^^^^^^ + | + = note: `-D out-of-bounds-indexing` implied by `-D warnings` + +error: range is out of bounds + --> examples/array_indexing.rs:23:6 + | +23 | &x[..5]; + | ^^^^^^ + | + = note: `-D out-of-bounds-indexing` implied by `-D warnings` + +error: indexing may panic + --> examples/array_indexing.rs:26:5 + | +26 | y[0]; + | ^^^^ + | + = note: `-D indexing-slicing` implied by `-D warnings` + +error: slicing may panic + --> examples/array_indexing.rs:27:6 + | +27 | &y[1..2]; + | ^^^^^^^ + | + = note: `-D indexing-slicing` implied by `-D warnings` + +error: slicing may panic + --> examples/array_indexing.rs:29:6 + | +29 | &y[0...4]; + | ^^^^^^^^ + | + = note: `-D indexing-slicing` implied by `-D warnings` + +error: slicing may panic + --> examples/array_indexing.rs:30:6 + | +30 | &y[...4]; + | ^^^^^^^ + | + = note: `-D indexing-slicing` implied by `-D warnings` + +error: const index is out of bounds + --> examples/array_indexing.rs:33:5 + | +33 | empty[0]; + | ^^^^^^^^ + | + = note: `-D out-of-bounds-indexing` implied by `-D warnings` + +error: range is out of bounds + --> examples/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 + --> examples/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 + --> examples/array_indexing.rs:36:6 + | +36 | &empty[...4]; + | ^^^^^^^^^^^ + | + = note: `-D out-of-bounds-indexing` implied by `-D warnings` + +error: range is out of bounds + --> examples/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 + --> examples/array_indexing.rs:41:6 + | +41 | &empty[...0]; + | ^^^^^^^^^^^ + | + = note: `-D out-of-bounds-indexing` implied by `-D warnings` + +error: range is out of bounds + --> examples/array_indexing.rs:43:6 + | +43 | &empty[1..]; + | ^^^^^^^^^^ + | + = note: `-D out-of-bounds-indexing` implied by `-D warnings` + +error: range is out of bounds + --> examples/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. diff --git a/tests/ui/assign_ops.rs b/clippy_tests/examples/assign_ops.rs similarity index 92% rename from tests/ui/assign_ops.rs rename to clippy_tests/examples/assign_ops.rs index 1176ec70a08..f92f2252114 100644 --- a/tests/ui/assign_ops.rs +++ b/clippy_tests/examples/assign_ops.rs @@ -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; diff --git a/tests/ui/assign_ops.stderr b/clippy_tests/examples/assign_ops.stderr similarity index 55% rename from tests/ui/assign_ops.stderr rename to clippy_tests/examples/assign_ops.stderr index 308596759b0..c30ec097f76 100644 --- a/tests/ui/assign_ops.stderr +++ b/clippy_tests/examples/assign_ops.stderr @@ -1,140 +1,173 @@ error: assign operation detected - --> $DIR/assign_ops.rs:8:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/assign_ops2.rs b/clippy_tests/examples/assign_ops2.rs similarity index 95% rename from tests/ui/assign_ops2.rs rename to clippy_tests/examples/assign_ops2.rs index be68d2716bd..b5de5b712ff 100644 --- a/tests/ui/assign_ops2.rs +++ b/clippy_tests/examples/assign_ops2.rs @@ -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; diff --git a/tests/ui/assign_ops2.stderr b/clippy_tests/examples/assign_ops2.stderr similarity index 56% rename from tests/ui/assign_ops2.stderr rename to clippy_tests/examples/assign_ops2.stderr index 6fbfac71c15..b27be7d1994 100644 --- a/tests/ui/assign_ops2.stderr +++ b/clippy_tests/examples/assign_ops2.stderr @@ -1,56 +1,69 @@ error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:8:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/attrs.rs b/clippy_tests/examples/attrs.rs similarity index 94% rename from tests/ui/attrs.rs rename to clippy_tests/examples/attrs.rs index 50dddb83847..1ff5edcd630 100644 --- a/tests/ui/attrs.rs +++ b/clippy_tests/examples/attrs.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(inline_always, deprecated_semver)] +#![warn(inline_always, deprecated_semver)] #[inline(always)] fn test_attr_lint() { diff --git a/tests/ui/attrs.stderr b/clippy_tests/examples/attrs.stderr similarity index 57% rename from tests/ui/attrs.stderr rename to clippy_tests/examples/attrs.stderr index 4ea0c5eece0..534e2acaac3 100644 --- a/tests/ui/attrs.stderr +++ b/clippy_tests/examples/attrs.stderr @@ -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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/bit_masks.rs b/clippy_tests/examples/bit_masks.rs similarity index 96% rename from tests/ui/bit_masks.rs rename to clippy_tests/examples/bit_masks.rs index e8f2e47b283..c211b85d7e2 100644 --- a/tests/ui/bit_masks.rs +++ b/clippy_tests/examples/bit_masks.rs @@ -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; diff --git a/tests/ui/bit_masks.stderr b/clippy_tests/examples/bit_masks.stderr similarity index 54% rename from tests/ui/bit_masks.stderr rename to clippy_tests/examples/bit_masks.stderr index cba88f2827b..0cbff5d48c4 100644 --- a/tests/ui/bit_masks.stderr +++ b/clippy_tests/examples/bit_masks.stderr @@ -1,104 +1,125 @@ error: &-masking with zero - --> $DIR/bit_masks.rs:12:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/blacklisted_name.rs b/clippy_tests/examples/blacklisted_name.rs similarity index 96% rename from tests/ui/blacklisted_name.rs rename to clippy_tests/examples/blacklisted_name.rs index 94c1757136f..dabce55883b 100644 --- a/tests/ui/blacklisted_name.rs +++ b/clippy_tests/examples/blacklisted_name.rs @@ -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: ()) {} diff --git a/tests/ui/blacklisted_name.stderr b/clippy_tests/examples/blacklisted_name.stderr similarity index 52% rename from tests/ui/blacklisted_name.stderr rename to clippy_tests/examples/blacklisted_name.stderr index 93405f99239..65c4e9211e3 100644 --- a/tests/ui/blacklisted_name.stderr +++ b/clippy_tests/examples/blacklisted_name.stderr @@ -1,92 +1,117 @@ error: use of a blacklisted/placeholder name `foo` - --> $DIR/blacklisted_name.rs:7:9 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/block_in_if_condition.rs b/clippy_tests/examples/block_in_if_condition.rs similarity index 95% rename from tests/ui/block_in_if_condition.rs rename to clippy_tests/examples/block_in_if_condition.rs index 64832771715..08e510317d9 100644 --- a/tests/ui/block_in_if_condition.rs +++ b/clippy_tests/examples/block_in_if_condition.rs @@ -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)] diff --git a/tests/ui/block_in_if_condition.stderr b/clippy_tests/examples/block_in_if_condition.stderr similarity index 63% rename from tests/ui/block_in_if_condition.stderr rename to clippy_tests/examples/block_in_if_condition.stderr index fb7f1179863..425617cdfca 100644 --- a/tests/ui/block_in_if_condition.stderr +++ b/clippy_tests/examples/block_in_if_condition.stderr @@ -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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/bool_comparison.rs b/clippy_tests/examples/bool_comparison.rs similarity index 90% rename from tests/ui/bool_comparison.rs rename to clippy_tests/examples/bool_comparison.rs index 606cbdc91ff..9b32ed7304b 100644 --- a/tests/ui/bool_comparison.rs +++ b/clippy_tests/examples/bool_comparison.rs @@ -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" }; diff --git a/tests/ui/bool_comparison.stderr b/clippy_tests/examples/bool_comparison.stderr similarity index 60% rename from tests/ui/bool_comparison.stderr rename to clippy_tests/examples/bool_comparison.stderr index 6cefb2f2223..bf053e21b11 100644 --- a/tests/ui/bool_comparison.stderr +++ b/clippy_tests/examples/bool_comparison.stderr @@ -1,32 +1,37 @@ error: equality checks against true are unnecessary - --> $DIR/bool_comparison.rs:7:8 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/booleans.rs b/clippy_tests/examples/booleans.rs similarity index 96% rename from tests/ui/booleans.rs rename to clippy_tests/examples/booleans.rs index 6acb66d9c40..ac60bf5e345 100644 --- a/tests/ui/booleans.rs +++ b/clippy_tests/examples/booleans.rs @@ -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() { diff --git a/tests/ui/booleans.stderr b/clippy_tests/examples/booleans.stderr similarity index 68% rename from tests/ui/booleans.stderr rename to clippy_tests/examples/booleans.stderr index 54a09c97874..0c3ded9061b 100644 --- a/tests/ui/booleans.stderr +++ b/clippy_tests/examples/booleans.stderr @@ -1,133 +1,143 @@ error: this boolean expression contains a logic bug - --> $DIR/booleans.rs:12:13 + --> examples/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 + --> examples/booleans.rs:12:18 | 12 | let _ = a && b || a; | ^ error: this boolean expression can be simplified - --> $DIR/booleans.rs:14:13 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/booleans.rs:17:22 | 17 | let _ = false && a; | ^ error: this boolean expression can be simplified - --> $DIR/booleans.rs:18:13 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/booleans.rs:33:13 | 33 | let _ = a == b && a != b; | ^^^^^^ error: this boolean expression can be simplified - --> $DIR/booleans.rs:34:13 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/booleans.rs:36:13 | 36 | let _ = a < b && a >= b; | ^^^^^ error: this boolean expression contains a logic bug - --> $DIR/booleans.rs:37:13 + --> examples/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 + --> examples/booleans.rs:37:13 | 37 | let _ = a > b && a <= b; | ^^^^^ error: this boolean expression can be simplified - --> $DIR/booleans.rs:39:13 + --> examples/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. diff --git a/tests/ui/box_vec.rs b/clippy_tests/examples/box_vec.rs similarity index 96% rename from tests/ui/box_vec.rs rename to clippy_tests/examples/box_vec.rs index 836ac0fd37f..507d9e77da0 100644 --- a/tests/ui/box_vec.rs +++ b/clippy_tests/examples/box_vec.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(boxed_local, needless_pass_by_value)] #![allow(blacklisted_name)] diff --git a/tests/ui/box_vec.stderr b/clippy_tests/examples/box_vec.stderr similarity index 61% rename from tests/ui/box_vec.stderr rename to clippy_tests/examples/box_vec.stderr index a7ccf1dcd85..e1d2a17539d 100644 --- a/tests/ui/box_vec.stderr +++ b/clippy_tests/examples/box_vec.stderr @@ -1,16 +1,14 @@ error: you seem to be trying to use `Box>`. Consider using just `Vec` - --> $DIR/box_vec.rs:17:18 + --> examples/box_vec.rs:17:18 | 17 | pub fn test(foo: Box>) { | ^^^^^^^^^^^^^^ | - = 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` is already on the heap, `Box>` 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. diff --git a/tests/ui/cast.rs b/clippy_tests/examples/cast.rs similarity index 95% rename from tests/ui/cast.rs rename to clippy_tests/examples/cast.rs index 19c98481873..bacfaa74454 100644 --- a/tests/ui/cast.rs +++ b/clippy_tests/examples/cast.rs @@ -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 diff --git a/tests/ui/cast.stderr b/clippy_tests/examples/cast.stderr similarity index 55% rename from tests/ui/cast.stderr rename to clippy_tests/examples/cast.stderr index e9fd694d121..78970a9b2bb 100644 --- a/tests/ui/cast.stderr +++ b/clippy_tests/examples/cast.stderr @@ -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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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`) + --> examples/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`) + --> examples/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`) + --> examples/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. diff --git a/tests/ui/char_lit_as_u8.rs b/clippy_tests/examples/char_lit_as_u8.rs similarity index 80% rename from tests/ui/char_lit_as_u8.rs rename to clippy_tests/examples/char_lit_as_u8.rs index 84f76fb0131..6f07b60fb10 100644 --- a/tests/ui/char_lit_as_u8.rs +++ b/clippy_tests/examples/char_lit_as_u8.rs @@ -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; diff --git a/tests/ui/char_lit_as_u8.stderr b/clippy_tests/examples/char_lit_as_u8.stderr similarity index 59% rename from tests/ui/char_lit_as_u8.stderr rename to clippy_tests/examples/char_lit_as_u8.stderr index 95550194a8d..f1b5b867c41 100644 --- a/tests/ui/char_lit_as_u8.stderr +++ b/clippy_tests/examples/char_lit_as_u8.stderr @@ -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 + --> examples/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. diff --git a/tests/ui/cmp_nan.rs b/clippy_tests/examples/cmp_nan.rs similarity index 96% rename from tests/ui/cmp_nan.rs rename to clippy_tests/examples/cmp_nan.rs index 53aaba61787..e8639273485 100644 --- a/tests/ui/cmp_nan.rs +++ b/clippy_tests/examples/cmp_nan.rs @@ -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; diff --git a/tests/ui/cmp_nan.stderr b/clippy_tests/examples/cmp_nan.stderr similarity index 62% rename from tests/ui/cmp_nan.stderr rename to clippy_tests/examples/cmp_nan.stderr index 9015e2fd3b2..24776d6c8d5 100644 --- a/tests/ui/cmp_nan.stderr +++ b/clippy_tests/examples/cmp_nan.stderr @@ -1,98 +1,101 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:8:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/cmp_null.rs b/clippy_tests/examples/cmp_null.rs similarity index 94% rename from tests/ui/cmp_null.rs rename to clippy_tests/examples/cmp_null.rs index 5449d2d31ac..47ecacd5558 100644 --- a/tests/ui/cmp_null.rs +++ b/clippy_tests/examples/cmp_null.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(cmp_null)] +#![warn(cmp_null)] #![allow(unused_mut)] use std::ptr; diff --git a/tests/ui/cmp_null.stderr b/clippy_tests/examples/cmp_null.stderr similarity index 56% rename from tests/ui/cmp_null.stderr rename to clippy_tests/examples/cmp_null.stderr index f98edeaca46..6709ad799c4 100644 --- a/tests/ui/cmp_null.stderr +++ b/clippy_tests/examples/cmp_null.stderr @@ -1,20 +1,21 @@ error: Comparing with null is better expressed by the .is_null() method - --> $DIR/cmp_null.rs:11:8 + --> examples/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 + --> examples/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. diff --git a/tests/ui/cmp_owned.rs b/clippy_tests/examples/cmp_owned.rs similarity index 97% rename from tests/ui/cmp_owned.rs rename to clippy_tests/examples/cmp_owned.rs index e586b164cc6..4b9b6434ebc 100644 --- a/tests/ui/cmp_owned.rs +++ b/clippy_tests/examples/cmp_owned.rs @@ -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) { diff --git a/tests/ui/cmp_owned.stderr b/clippy_tests/examples/cmp_owned.stderr similarity index 54% rename from tests/ui/cmp_owned.stderr rename to clippy_tests/examples/cmp_owned.stderr index 14cad03a0f2..b5fe50094d6 100644 --- a/tests/ui/cmp_owned.stderr +++ b/clippy_tests/examples/cmp_owned.stderr @@ -1,46 +1,53 @@ error: this creates an owned instance just for comparison - --> $DIR/cmp_owned.rs:8:14 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/collapsible_if.rs b/clippy_tests/examples/collapsible_if.rs similarity index 99% rename from tests/ui/collapsible_if.rs rename to clippy_tests/examples/collapsible_if.rs index b06f4fa793e..d03a1ee1980 100644 --- a/tests/ui/collapsible_if.rs +++ b/clippy_tests/examples/collapsible_if.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#[deny(collapsible_if)] +#[warn(collapsible_if)] fn main() { let x = "hello"; let y = "world"; diff --git a/tests/ui/collapsible_if.stderr b/clippy_tests/examples/collapsible_if.stderr similarity index 77% rename from tests/ui/collapsible_if.stderr rename to clippy_tests/examples/collapsible_if.stderr index 5e643f68160..dbdbae59ca1 100644 --- a/tests/ui/collapsible_if.stderr +++ b/clippy_tests/examples/collapsible_if.stderr @@ -1,5 +1,5 @@ error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:8:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/complex_types.rs b/clippy_tests/examples/complex_types.rs similarity index 98% rename from tests/ui/complex_types.rs rename to clippy_tests/examples/complex_types.rs index f3b9e0a03af..ebe7fad9e17 100644 --- a/tests/ui/complex_types.rs +++ b/clippy_tests/examples/complex_types.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(unused, needless_pass_by_value)] #![feature(associated_consts, associated_type_defaults)] diff --git a/tests/ui/complex_types.stderr b/clippy_tests/examples/complex_types.stderr similarity index 67% rename from tests/ui/complex_types.stderr rename to clippy_tests/examples/complex_types.stderr index a2e7f9384d1..4fff13a5fa0 100644 --- a/tests/ui/complex_types.stderr +++ b/clippy_tests/examples/complex_types.stderr @@ -1,127 +1,125 @@ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:9:12 + --> examples/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 + --> examples/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 + --> examples/complex_types.rs:13:8 | 13 | f: 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:16:11 + --> examples/complex_types.rs:16:11 | 16 | struct TS(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:19:11 + --> examples/complex_types.rs:19:11 | 19 | Tuple(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:20:17 + --> examples/complex_types.rs:20:17 | 20 | Struct { f: 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:24:14 + --> examples/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 + --> examples/complex_types.rs:25:30 | 25 | fn impl_method(&self, p: 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:29:14 + --> examples/complex_types.rs:29:14 | 29 | const A: 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:30:14 + --> examples/complex_types.rs:30:14 | 30 | type B = 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:31:25 + --> examples/complex_types.rs:31:25 | 31 | fn method(&self, p: 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:32:29 + --> examples/complex_types.rs:32:29 | 32 | fn def_method(&self, p: 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:35:15 + --> examples/complex_types.rs:35:15 | 35 | fn test1() -> Vec>> { 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 + --> examples/complex_types.rs:37:14 | 37 | fn test2(_x: 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:40:13 + --> examples/complex_types.rs:40:13 | 40 | let _y: Vec>> = 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. diff --git a/tests/ui/copies.rs b/clippy_tests/examples/copies.rs similarity index 98% rename from tests/ui/copies.rs rename to clippy_tests/examples/copies.rs index 8192593be1a..a7b99252735 100644 --- a/tests/ui/copies.rs +++ b/clippy_tests/examples/copies.rs @@ -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; diff --git a/clippy_tests/examples/copies.stderr b/clippy_tests/examples/copies.stderr new file mode 100644 index 00000000000..3c95940e1a9 --- /dev/null +++ b/clippy_tests/examples/copies.stderr @@ -0,0 +1,41 @@ +error: This else block is redundant. + + --> examples/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. + + --> examples/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. diff --git a/tests/ui/cyclomatic_complexity.rs b/clippy_tests/examples/cyclomatic_complexity.rs similarity index 99% rename from tests/ui/cyclomatic_complexity.rs rename to clippy_tests/examples/cyclomatic_complexity.rs index 0b02c937be6..a236d6e869f 100644 --- a/tests/ui/cyclomatic_complexity.rs +++ b/clippy_tests/examples/cyclomatic_complexity.rs @@ -1,7 +1,7 @@ #![feature(plugin, custom_attribute)] #![plugin(clippy)] #![allow(clippy)] -#![deny(cyclomatic_complexity)] +#![warn(cyclomatic_complexity)] #![allow(unused)] fn main() { diff --git a/tests/ui/cyclomatic_complexity.stderr b/clippy_tests/examples/cyclomatic_complexity.stderr similarity index 72% rename from tests/ui/cyclomatic_complexity.stderr rename to clippy_tests/examples/cyclomatic_complexity.stderr index fb42e14d5b0..dd9adfacdc2 100644 --- a/tests/ui/cyclomatic_complexity.stderr +++ b/clippy_tests/examples/cyclomatic_complexity.stderr @@ -1,5 +1,5 @@ error: the function has a cyclomatic complexity of 28 - --> $DIR/cyclomatic_complexity.rs:7:1 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/cyclomatic_complexity.rs:319:1 | 319 | / fn try() -> Result { 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 + --> examples/cyclomatic_complexity.rs:327:1 | 327 | / fn try_again() -> Result { 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 + --> examples/cyclomatic_complexity.rs:343:1 | 343 | / fn early() -> Result { 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 + --> examples/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. diff --git a/tests/ui/cyclomatic_complexity_attr_used.rs b/clippy_tests/examples/cyclomatic_complexity_attr_used.rs similarity index 82% rename from tests/ui/cyclomatic_complexity_attr_used.rs rename to clippy_tests/examples/cyclomatic_complexity_attr_used.rs index 14388827979..48ae12bc2d8 100644 --- a/tests/ui/cyclomatic_complexity_attr_used.rs +++ b/clippy_tests/examples/cyclomatic_complexity_attr_used.rs @@ -1,7 +1,7 @@ #![feature(plugin, custom_attribute)] #![plugin(clippy)] -#![deny(cyclomatic_complexity)] -#![deny(unused)] +#![warn(cyclomatic_complexity)] +#![warn(unused)] fn main() { kaboom(); diff --git a/tests/ui/cyclomatic_complexity_attr_used.stderr b/clippy_tests/examples/cyclomatic_complexity_attr_used.stderr similarity index 61% rename from tests/ui/cyclomatic_complexity_attr_used.stderr rename to clippy_tests/examples/cyclomatic_complexity_attr_used.stderr index 5086d511753..67ed1a9e072 100644 --- a/tests/ui/cyclomatic_complexity_attr_used.stderr +++ b/clippy_tests/examples/cyclomatic_complexity_attr_used.stderr @@ -1,5 +1,5 @@ error: the function has a cyclomatic complexity of 3 - --> $DIR/cyclomatic_complexity_attr_used.rs:11:1 + --> examples/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. diff --git a/tests/ui/derive.rs b/clippy_tests/examples/derive.rs similarity index 98% rename from tests/ui/derive.rs rename to clippy_tests/examples/derive.rs index 50c1c1103c4..11cade0dc8e 100644 --- a/tests/ui/derive.rs +++ b/clippy_tests/examples/derive.rs @@ -3,7 +3,6 @@ #![feature(untagged_unions)] -#![deny(warnings)] #![allow(dead_code)] use std::hash::{Hash, Hasher}; diff --git a/clippy_tests/examples/derive.stderr b/clippy_tests/examples/derive.stderr new file mode 100644 index 00000000000..079238ef044 --- /dev/null +++ b/clippy_tests/examples/derive.stderr @@ -0,0 +1,84 @@ +error: you are deriving `Hash` but have implemented `PartialEq` explicitly + --> examples/derive.rs:17:10 + | +17 | #[derive(Hash)] + | ^^^^ + | + = note: `-D derive-hash-xor-eq` implied by `-D warnings` +note: `PartialEq` implemented here + --> examples/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 + --> examples/derive.rs:24:10 + | +24 | #[derive(Hash)] + | ^^^^ + | + = note: `-D derive-hash-xor-eq` implied by `-D warnings` +note: `PartialEq` implemented here + --> examples/derive.rs:27:1 + | +27 | / impl PartialEq for Baz { +28 | | fn eq(&self, _: &Baz) -> bool { true } +29 | | } + | |_^ + +error: you are implementing `Hash` explicitly but have derived `PartialEq` + --> examples/derive.rs:34:1 + | +34 | / impl Hash for Bah { +35 | | fn hash(&self, _: &mut H) {} +36 | | } + | |_^ + | + = note: `-D derive-hash-xor-eq` implied by `-D warnings` +note: `PartialEq` implemented here + --> examples/derive.rs:31:10 + | +31 | #[derive(PartialEq)] + | ^^^^^^^^^ + +error: you are implementing `Clone` explicitly on a `Copy` type + --> examples/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` + --> examples/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 + --> examples/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` + --> examples/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. diff --git a/tests/ui/diverging_sub_expression.rs b/clippy_tests/examples/diverging_sub_expression.rs similarity index 95% rename from tests/ui/diverging_sub_expression.rs rename to clippy_tests/examples/diverging_sub_expression.rs index 57e7a545b7c..7ae531cc6f2 100644 --- a/tests/ui/diverging_sub_expression.rs +++ b/clippy_tests/examples/diverging_sub_expression.rs @@ -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)] diff --git a/clippy_tests/examples/diverging_sub_expression.stderr b/clippy_tests/examples/diverging_sub_expression.stderr new file mode 100644 index 00000000000..b9d95c4fcba --- /dev/null +++ b/clippy_tests/examples/diverging_sub_expression.stderr @@ -0,0 +1,53 @@ +error: sub-expression diverges + --> examples/diverging_sub_expression.rs:18:10 + | +18 | b || diverge(); + | ^^^^^^^^^ + | + = note: `-D diverging-sub-expression` implied by `-D warnings` + +error: sub-expression diverges + --> examples/diverging_sub_expression.rs:19:10 + | +19 | b || A.foo(); + | ^^^^^^^ + | + = note: `-D diverging-sub-expression` implied by `-D warnings` + +error: sub-expression diverges + --> examples/diverging_sub_expression.rs:28:26 + | +28 | 6 => true || return, + | ^^^^^^ + | + = note: `-D diverging-sub-expression` implied by `-D warnings` + +error: sub-expression diverges + --> examples/diverging_sub_expression.rs:29:26 + | +29 | 7 => true || continue, + | ^^^^^^^^ + | + = note: `-D diverging-sub-expression` implied by `-D warnings` + +error: sub-expression diverges + --> examples/diverging_sub_expression.rs:32:26 + | +32 | 3 => true || diverge(), + | ^^^^^^^^^ + | + = note: `-D diverging-sub-expression` implied by `-D warnings` + +error: sub-expression diverges + --> examples/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. diff --git a/tests/ui/dlist.rs b/clippy_tests/examples/dlist.rs similarity index 97% rename from tests/ui/dlist.rs rename to clippy_tests/examples/dlist.rs index 2a3cefcbc1f..a41bf1b52e0 100644 --- a/tests/ui/dlist.rs +++ b/clippy_tests/examples/dlist.rs @@ -3,7 +3,7 @@ #![feature(associated_consts)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(dead_code, needless_pass_by_value)] extern crate collections; diff --git a/tests/ui/dlist.stderr b/clippy_tests/examples/dlist.stderr similarity index 68% rename from tests/ui/dlist.stderr rename to clippy_tests/examples/dlist.stderr index 7af01a32ec0..aa524c8eb10 100644 --- a/tests/ui/dlist.stderr +++ b/clippy_tests/examples/dlist.stderr @@ -1,61 +1,59 @@ error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:13:16 + --> examples/dlist.rs:13:16 | 13 | type Baz = LinkedList; | ^^^^^^^^^^^^^^ | - = 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 + --> examples/dlist.rs:14:12 | 14 | fn foo(LinkedList); | ^^^^^^^^^^^^^^ | - = 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 + --> examples/dlist.rs:15:24 | 15 | const BAR : Option>; | ^^^^^^^^^^^^^^ | - = 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 + --> examples/dlist.rs:26:15 | 26 | fn foo(_: LinkedList) {} | ^^^^^^^^^^^^^^ | - = 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 + --> examples/dlist.rs:29:39 | 29 | pub fn test(my_favourite_linked_list: LinkedList) { | ^^^^^^^^^^^^^^ | - = 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 + --> examples/dlist.rs:33:29 | 33 | pub fn test_ret() -> Option> { | ^^^^^^^^^^^^^^ | - = 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. diff --git a/tests/ui/doc.rs b/clippy_tests/examples/doc.rs similarity index 99% rename from tests/ui/doc.rs rename to clippy_tests/examples/doc.rs index b954e78999e..a46383c7c53 100644 --- a/tests/ui/doc.rs +++ b/clippy_tests/examples/doc.rs @@ -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 diff --git a/tests/ui/doc.stderr b/clippy_tests/examples/doc.stderr similarity index 64% rename from tests/ui/doc.stderr rename to clippy_tests/examples/doc.stderr index d267331fb68..84e09860c56 100644 --- a/tests/ui/doc.stderr +++ b/clippy_tests/examples/doc.stderr @@ -1,182 +1,237 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation - --> $DIR/doc.rs:1:29 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/double_neg.rs b/clippy_tests/examples/double_neg.rs similarity index 82% rename from tests/ui/double_neg.rs rename to clippy_tests/examples/double_neg.rs index 362b3a72dd7..d462e6f4ab6 100644 --- a/tests/ui/double_neg.rs +++ b/clippy_tests/examples/double_neg.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#[deny(double_neg)] +#[warn(double_neg)] fn main() { let x = 1; -x; diff --git a/clippy_tests/examples/double_neg.stderr b/clippy_tests/examples/double_neg.stderr new file mode 100644 index 00000000000..56289b2c4bc --- /dev/null +++ b/clippy_tests/examples/double_neg.stderr @@ -0,0 +1,13 @@ +error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op + --> examples/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. diff --git a/tests/ui/double_parens.rs b/clippy_tests/examples/double_parens.rs similarity index 96% rename from tests/ui/double_parens.rs rename to clippy_tests/examples/double_parens.rs index 208482eb6ce..8b57619edb0 100644 --- a/tests/ui/double_parens.rs +++ b/clippy_tests/examples/double_parens.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(double_parens)] +#![warn(double_parens)] #![allow(dead_code)] fn dummy_fn(_: T) {} diff --git a/clippy_tests/examples/double_parens.stderr b/clippy_tests/examples/double_parens.stderr new file mode 100644 index 00000000000..c4171026274 --- /dev/null +++ b/clippy_tests/examples/double_parens.stderr @@ -0,0 +1,45 @@ +error: Consider removing unnecessary double parentheses + --> examples/double_parens.rs:16:5 + | +16 | ((0)) + | ^^^^^ + | + = note: `-D double-parens` implied by `-D warnings` + +error: Consider removing unnecessary double parentheses + --> examples/double_parens.rs:20:14 + | +20 | dummy_fn((0)); + | ^^^ + | + = note: `-D double-parens` implied by `-D warnings` + +error: Consider removing unnecessary double parentheses + --> examples/double_parens.rs:24:20 + | +24 | x.dummy_method((0)); + | ^^^ + | + = note: `-D double-parens` implied by `-D warnings` + +error: Consider removing unnecessary double parentheses + --> examples/double_parens.rs:28:5 + | +28 | ((1, 2)) + | ^^^^^^^^ + | + = note: `-D double-parens` implied by `-D warnings` + +error: Consider removing unnecessary double parentheses + --> examples/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. diff --git a/tests/ui/drop_forget_copy.rs b/clippy_tests/examples/drop_forget_copy.rs similarity index 96% rename from tests/ui/drop_forget_copy.rs rename to clippy_tests/examples/drop_forget_copy.rs index d92c053476f..4e48a89b659 100644 --- a/tests/ui/drop_forget_copy.rs +++ b/clippy_tests/examples/drop_forget_copy.rs @@ -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}; diff --git a/tests/ui/drop_forget_copy.stderr b/clippy_tests/examples/drop_forget_copy.stderr similarity index 62% rename from tests/ui/drop_forget_copy.stderr rename to clippy_tests/examples/drop_forget_copy.stderr index 5d95e9f8685..048eee2b567 100644 --- a/tests/ui/drop_forget_copy.stderr +++ b/clippy_tests/examples/drop_forget_copy.stderr @@ -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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/drop_forget_ref.rs b/clippy_tests/examples/drop_forget_ref.rs similarity index 97% rename from tests/ui/drop_forget_ref.rs rename to clippy_tests/examples/drop_forget_ref.rs index 97c6df8563e..48811f03b6f 100644 --- a/tests/ui/drop_forget_ref.rs +++ b/clippy_tests/examples/drop_forget_ref.rs @@ -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}; diff --git a/tests/ui/drop_forget_ref.stderr b/clippy_tests/examples/drop_forget_ref.stderr similarity index 67% rename from tests/ui/drop_forget_ref.stderr rename to clippy_tests/examples/drop_forget_ref.stderr index b1d67460411..0bb49c0f0a9 100644 --- a/tests/ui/drop_forget_ref.stderr +++ b/clippy_tests/examples/drop_forget_ref.stderr @@ -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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/duplicate_underscore_argument.rs b/clippy_tests/examples/duplicate_underscore_argument.rs similarity index 87% rename from tests/ui/duplicate_underscore_argument.rs rename to clippy_tests/examples/duplicate_underscore_argument.rs index ca02002bcc0..893cc43f364 100644 --- a/tests/ui/duplicate_underscore_argument.rs +++ b/clippy_tests/examples/duplicate_underscore_argument.rs @@ -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) {} diff --git a/tests/ui/duplicate_underscore_argument.stderr b/clippy_tests/examples/duplicate_underscore_argument.stderr similarity index 55% rename from tests/ui/duplicate_underscore_argument.stderr rename to clippy_tests/examples/duplicate_underscore_argument.stderr index 3e507acd98b..0e08c65a5a3 100644 --- a/tests/ui/duplicate_underscore_argument.stderr +++ b/clippy_tests/examples/duplicate_underscore_argument.stderr @@ -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 + --> examples/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. diff --git a/tests/ui/empty_enum.rs b/clippy_tests/examples/empty_enum.rs similarity index 81% rename from tests/ui/empty_enum.rs rename to clippy_tests/examples/empty_enum.rs index 941f0e73c0a..98138add0de 100644 --- a/tests/ui/empty_enum.rs +++ b/clippy_tests/examples/empty_enum.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(dead_code)] -#![deny(empty_enum)] +#![warn(empty_enum)] enum Empty {} diff --git a/tests/ui/empty_enum.stderr b/clippy_tests/examples/empty_enum.stderr similarity index 51% rename from tests/ui/empty_enum.stderr rename to clippy_tests/examples/empty_enum.stderr index 2a5e1165fb3..c439a26ef4a 100644 --- a/tests/ui/empty_enum.stderr +++ b/clippy_tests/examples/empty_enum.stderr @@ -1,19 +1,18 @@ error: enum with no variants - --> $DIR/empty_enum.rs:7:1 + --> examples/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 + --> examples/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. diff --git a/tests/ui/entry.rs b/clippy_tests/examples/entry.rs similarity index 98% rename from tests/ui/entry.rs rename to clippy_tests/examples/entry.rs index c7ee1840904..1ae39689d8b 100644 --- a/tests/ui/entry.rs +++ b/clippy_tests/examples/entry.rs @@ -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; diff --git a/tests/ui/entry.stderr b/clippy_tests/examples/entry.stderr similarity index 71% rename from tests/ui/entry.stderr rename to clippy_tests/examples/entry.stderr index 838eb887370..2f61611efdb 100644 --- a/tests/ui/entry.stderr +++ b/clippy_tests/examples/entry.stderr @@ -1,50 +1,61 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` - --> $DIR/entry.rs:13:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/enum_glob_use.rs b/clippy_tests/examples/enum_glob_use.rs similarity index 91% rename from tests/ui/enum_glob_use.rs rename to clippy_tests/examples/enum_glob_use.rs index 6becdb3c9ae..514ef47c566 100644 --- a/tests/ui/enum_glob_use.rs +++ b/clippy_tests/examples/enum_glob_use.rs @@ -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::*; diff --git a/clippy_tests/examples/enum_glob_use.stderr b/clippy_tests/examples/enum_glob_use.stderr new file mode 100644 index 00000000000..df21b86bb52 --- /dev/null +++ b/clippy_tests/examples/enum_glob_use.stderr @@ -0,0 +1,21 @@ +error: don't use glob imports for enum variants + --> examples/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 + --> examples/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. diff --git a/tests/ui/enum_variants.rs b/clippy_tests/examples/enum_variants.rs similarity index 96% rename from tests/ui/enum_variants.rs rename to clippy_tests/examples/enum_variants.rs index 8d7a41b986e..a12eb3fd344 100644 --- a/tests/ui/enum_variants.rs +++ b/clippy_tests/examples/enum_variants.rs @@ -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 diff --git a/tests/ui/enum_variants.stderr b/clippy_tests/examples/enum_variants.stderr similarity index 62% rename from tests/ui/enum_variants.stderr rename to clippy_tests/examples/enum_variants.stderr index 876c4e827dc..0bdd2113469 100644 --- a/tests/ui/enum_variants.stderr +++ b/clippy_tests/examples/enum_variants.stderr @@ -1,42 +1,37 @@ error: Variant name ends with the enum's name - --> $DIR/enum_variants.rs:14:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/enums_clike.rs b/clippy_tests/examples/enums_clike.rs similarity index 98% rename from tests/ui/enums_clike.rs rename to clippy_tests/examples/enums_clike.rs index 9b4cdbb56b8..df20c64527a 100644 --- a/tests/ui/enums_clike.rs +++ b/clippy_tests/examples/enums_clike.rs @@ -1,7 +1,7 @@ // ignore-x86 #![feature(plugin, associated_consts)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(unused)] diff --git a/tests/ui/enums_clike.stderr b/clippy_tests/examples/enums_clike.stderr similarity index 54% rename from tests/ui/enums_clike.stderr rename to clippy_tests/examples/enums_clike.stderr index 0bfb732feb5..868fd810653 100644 --- a/tests/ui/enums_clike.stderr +++ b/clippy_tests/examples/enums_clike.stderr @@ -1,71 +1,69 @@ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:10:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/eq_op.rs b/clippy_tests/examples/eq_op.rs similarity index 97% rename from tests/ui/eq_op.rs rename to clippy_tests/examples/eq_op.rs index cb02947933b..12d62042dca 100644 --- a/tests/ui/eq_op.rs +++ b/clippy_tests/examples/eq_op.rs @@ -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; diff --git a/tests/ui/eq_op.stderr b/clippy_tests/examples/eq_op.stderr similarity index 55% rename from tests/ui/eq_op.stderr rename to clippy_tests/examples/eq_op.stderr index 3e96dd4f968..55d4d2c5146 100644 --- a/tests/ui/eq_op.stderr +++ b/clippy_tests/examples/eq_op.stderr @@ -1,216 +1,271 @@ error: this boolean expression can be simplified - --> $DIR/eq_op.rs:37:5 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/escape_analysis.rs b/clippy_tests/examples/escape_analysis.rs similarity index 98% rename from tests/ui/escape_analysis.rs rename to clippy_tests/examples/escape_analysis.rs index 595857b82df..b4793198b7a 100644 --- a/tests/ui/escape_analysis.rs +++ b/clippy_tests/examples/escape_analysis.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(warnings, clippy)] -#![deny(boxed_local)] +#![warn(boxed_local)] #[derive(Clone)] struct A; diff --git a/clippy_tests/examples/escape_analysis.stderr b/clippy_tests/examples/escape_analysis.stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/ui/eta.rs b/clippy_tests/examples/eta.rs similarity index 97% rename from tests/ui/eta.rs rename to clippy_tests/examples/eta.rs index 91e081f5ec6..46ac0ec8c73 100644 --- a/tests/ui/eta.rs +++ b/clippy_tests/examples/eta.rs @@ -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)); diff --git a/tests/ui/eta.stderr b/clippy_tests/examples/eta.stderr similarity index 52% rename from tests/ui/eta.stderr rename to clippy_tests/examples/eta.stderr index b218523ba5f..938a7ad5b78 100644 --- a/tests/ui/eta.stderr +++ b/clippy_tests/examples/eta.stderr @@ -1,40 +1,45 @@ error: redundant closure found - --> $DIR/eta.rs:7:27 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/eval_order_dependence.rs b/clippy_tests/examples/eval_order_dependence.rs similarity index 97% rename from tests/ui/eval_order_dependence.rs rename to clippy_tests/examples/eval_order_dependence.rs index 1c25afed77a..853c61af2f2 100644 --- a/tests/ui/eval_order_dependence.rs +++ b/clippy_tests/examples/eval_order_dependence.rs @@ -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; diff --git a/tests/ui/eval_order_dependence.stderr b/clippy_tests/examples/eval_order_dependence.stderr similarity index 59% rename from tests/ui/eval_order_dependence.stderr rename to clippy_tests/examples/eval_order_dependence.stderr index 5e5ae53e184..4089938e7d2 100644 --- a/tests/ui/eval_order_dependence.stderr +++ b/clippy_tests/examples/eval_order_dependence.stderr @@ -1,55 +1,57 @@ error: unsequenced read of a variable - --> $DIR/eval_order_dependence.rs:8:28 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/eval_order_dependence.rs:11:12 | 11 | x += { x = 20; 2 }; | ^^^^^^ error: unsequenced read of a variable - --> $DIR/eval_order_dependence.rs:17:24 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/filter_methods.rs b/clippy_tests/examples/filter_methods.rs similarity index 96% rename from tests/ui/filter_methods.rs rename to clippy_tests/examples/filter_methods.rs index 922f9fba6a8..77ebe9d12dd 100644 --- a/tests/ui/filter_methods.rs +++ b/clippy_tests/examples/filter_methods.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy, clippy_pedantic)] +#![warn(clippy, clippy_pedantic)] #![allow(missing_docs_in_private_items)] fn main() { diff --git a/tests/ui/filter_methods.stderr b/clippy_tests/examples/filter_methods.stderr similarity index 76% rename from tests/ui/filter_methods.stderr rename to clippy_tests/examples/filter_methods.stderr index 36b5a84c725..7221e019dbd 100644 --- a/tests/ui/filter_methods.stderr +++ b/clippy_tests/examples/filter_methods.stderr @@ -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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/float_cmp.rs b/clippy_tests/examples/float_cmp.rs similarity index 98% rename from tests/ui/float_cmp.rs rename to clippy_tests/examples/float_cmp.rs index d6a74193ae3..47d29a42183 100644 --- a/tests/ui/float_cmp.rs +++ b/clippy_tests/examples/float_cmp.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(float_cmp)] +#![warn(float_cmp)] #![allow(unused, no_effect, unnecessary_operation)] use std::ops::Add; diff --git a/tests/ui/float_cmp.stderr b/clippy_tests/examples/float_cmp.stderr similarity index 70% rename from tests/ui/float_cmp.stderr rename to clippy_tests/examples/float_cmp.stderr index 082990334d1..802c9b8bba7 100644 --- a/tests/ui/float_cmp.stderr +++ b/clippy_tests/examples/float_cmp.stderr @@ -1,103 +1,109 @@ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:43:5 + --> examples/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 + --> examples/float_cmp.rs:43:5 | 43 | ONE == 1f32; | ^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:44:5 + --> examples/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 + --> examples/float_cmp.rs:44:5 | 44 | ONE == 1.0 + 0.0; | ^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:45:5 + --> examples/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 + --> examples/float_cmp.rs:45:5 | 45 | ONE + ONE == ZERO + ONE + ONE; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:46:5 + --> examples/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 + --> examples/float_cmp.rs:46:5 | 46 | ONE != 2.0; | ^^^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:48:5 + --> examples/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 + --> examples/float_cmp.rs:48:5 | 48 | twice(ONE) != ONE; | ^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:49:5 + --> examples/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 + --> examples/float_cmp.rs:49:5 | 49 | ONE as f64 != 2.0; | ^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:54:5 + --> examples/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 + --> examples/float_cmp.rs:54:5 | 54 | x == 1.0; | ^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:57:5 + --> examples/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 + --> examples/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. diff --git a/tests/ui/for_loop.rs b/clippy_tests/examples/for_loop.rs similarity index 98% rename from tests/ui/for_loop.rs rename to clippy_tests/examples/for_loop.rs index 556053fdbc5..4770befe541 100644 --- a/tests/ui/for_loop.rs +++ b/clippy_tests/examples/for_loop.rs @@ -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() { diff --git a/tests/ui/for_loop.stderr b/clippy_tests/examples/for_loop.stderr similarity index 71% rename from tests/ui/for_loop.stderr rename to clippy_tests/examples/for_loop.stderr index fb5592a54e7..432ec659fcc 100644 --- a/tests/ui/for_loop.stderr +++ b/clippy_tests/examples/for_loop.stderr @@ -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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 in &vec { -warning: unused variable: `i` - --> $DIR/for_loop.rs:88:9 +error: unused variable: `i` + --> examples/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 + --> examples/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 in &vec { let _ = vec[i]; } error: the loop variable `j` is only used to index `STATIC`. - --> $DIR/for_loop.rs:96:5 + --> examples/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 in STATIC.iter().take(4) { error: the loop variable `j` is only used to index `CONST`. - --> $DIR/for_loop.rs:100:5 + --> examples/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 in CONST.iter().take(4) { error: the loop variable `i` is used to index `vec` - --> $DIR/for_loop.rs:104:5 + --> examples/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, ) in vec.iter().enumerate() { error: the loop variable `i` is only used to index `vec2`. - --> $DIR/for_loop.rs:111:5 + --> examples/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 in vec2.iter().take(vec.len()) { error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:115:5 + --> examples/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 in vec.iter().skip(5) { error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:119:5 + --> examples/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 in vec.iter().take(MAX_LEN) { error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:123:5 + --> examples/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 in vec.iter().take(MAX_LEN + 1) { error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:127:5 + --> examples/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 in vec.iter().take(10).skip(5) { error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:131:5 + --> examples/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 in vec.iter().take(10 + 1).skip(5) { error: the loop variable `i` is used to index `vec` - --> $DIR/for_loop.rs:135:5 + --> examples/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, ) in vec.iter().enumerate().skip(5) { error: the loop variable `i` is used to index `vec` - --> $DIR/for_loop.rs:139:5 + --> examples/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, ) 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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/for_loop.rs:256:5 | 256 | vec.iter().map(|x| out.push(x)).collect::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/format.rs b/clippy_tests/examples/format.rs similarity index 97% rename from tests/ui/format.rs rename to clippy_tests/examples/format.rs index 67561dca87d..377bcc7ca8d 100644 --- a/tests/ui/format.rs +++ b/clippy_tests/examples/format.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(useless_format)] +#![warn(useless_format)] fn main() { format!("foo"); diff --git a/clippy_tests/examples/format.stderr b/clippy_tests/examples/format.stderr new file mode 100644 index 00000000000..5c0ad89ca25 --- /dev/null +++ b/clippy_tests/examples/format.stderr @@ -0,0 +1,29 @@ +error: useless use of `format!` + --> examples/format.rs:6:5 + | +6 | format!("foo"); + | ^^^^^^^^^^^^^^^ + | + = note: `-D useless-format` implied by `-D warnings` + +error: useless use of `format!` + --> examples/format.rs:8:5 + | +8 | format!("{}", "foo"); + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D useless-format` implied by `-D warnings` + +error: useless use of `format!` + --> examples/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. diff --git a/tests/ui/formatting.rs b/clippy_tests/examples/formatting.rs similarity index 98% rename from tests/ui/formatting.rs rename to clippy_tests/examples/formatting.rs index 822e57d4541..7e2691776bf 100644 --- a/tests/ui/formatting.rs +++ b/clippy_tests/examples/formatting.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(if_same_then_else)] diff --git a/tests/ui/formatting.stderr b/clippy_tests/examples/formatting.stderr similarity index 62% rename from tests/ui/formatting.stderr rename to clippy_tests/examples/formatting.stderr index d69c4dae730..8177c854924 100644 --- a/tests/ui/formatting.stderr +++ b/clippy_tests/examples/formatting.stderr @@ -1,48 +1,43 @@ error: this looks like an `else if` but the `else` is missing - --> $DIR/formatting.rs:15:6 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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 + --> examples/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. diff --git a/tests/ui/functions.rs b/clippy_tests/examples/functions.rs similarity index 99% rename from tests/ui/functions.rs rename to clippy_tests/examples/functions.rs index 7f2330b60cc..13d116542ac 100644 --- a/tests/ui/functions.rs +++ b/clippy_tests/examples/functions.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(dead_code)] #![allow(unused_unsafe)] diff --git a/tests/ui/functions.stderr b/clippy_tests/examples/functions.stderr similarity index 63% rename from tests/ui/functions.stderr rename to clippy_tests/examples/functions.stderr index 0abf8f2f0a8..c633bd2a797 100644 --- a/tests/ui/functions.stderr +++ b/clippy_tests/examples/functions.stderr @@ -1,109 +1,102 @@ error: this function has too many arguments (8/7) - --> $DIR/functions.rs:11:1 + --> examples/functions.rs:11:1 | 11 | / fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) { 12 | | } | |_^ | - = note: #[deny(too_many_arguments)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/functions.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ + = note: `-D too-many-arguments` implied by `-D warnings` error: this function has too many arguments (8/7) - --> $DIR/functions.rs:19:5 + --> examples/functions.rs:19:5 | 19 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(too_many_arguments)] implied by #[deny(clippy)] + = note: `-D too-many-arguments` implied by `-D warnings` error: this function has too many arguments (8/7) - --> $DIR/functions.rs:28:5 + --> examples/functions.rs:28:5 | 28 | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(too_many_arguments)] implied by #[deny(clippy)] + = note: `-D too-many-arguments` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:37:34 + --> examples/functions.rs:37:34 | 37 | println!("{}", unsafe { *p }); | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/functions.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ + = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:38:35 + --> examples/functions.rs:38:35 | 38 | println!("{:?}", unsafe { p.as_ref() }); | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] + = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:39:33 + --> examples/functions.rs:39:33 | 39 | unsafe { std::ptr::read(p) }; | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] + = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:50:30 + --> examples/functions.rs:50:30 | 50 | println!("{}", unsafe { *p }); | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] + = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:51:31 + --> examples/functions.rs:51:31 | 51 | println!("{:?}", unsafe { p.as_ref() }); | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] + = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:52:29 + --> examples/functions.rs:52:29 | 52 | unsafe { std::ptr::read(p) }; | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] + = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:61:34 + --> examples/functions.rs:61:34 | 61 | println!("{}", unsafe { *p }); | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] + = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:62:35 + --> examples/functions.rs:62:35 | 62 | println!("{:?}", unsafe { p.as_ref() }); | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] + = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:63:33 + --> examples/functions.rs:63:33 | 63 | unsafe { std::ptr::read(p) }; | ^ | - = note: #[deny(not_unsafe_ptr_arg_deref)] implied by #[deny(clippy)] + = note: `-D not-unsafe-ptr-arg-deref` 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. diff --git a/tests/ui/identity_op.rs b/clippy_tests/examples/identity_op.rs similarity index 96% rename from tests/ui/identity_op.rs rename to clippy_tests/examples/identity_op.rs index ea68ec3e1ab..e6ebb972643 100644 --- a/tests/ui/identity_op.rs +++ b/clippy_tests/examples/identity_op.rs @@ -6,7 +6,7 @@ const NEG_ONE : i64 = -1; const ZERO : i64 = 0; #[allow(eq_op, no_effect, unnecessary_operation, double_parens)] -#[deny(identity_op)] +#[warn(identity_op)] fn main() { let x = 0; diff --git a/tests/ui/identity_op.stderr b/clippy_tests/examples/identity_op.stderr similarity index 51% rename from tests/ui/identity_op.stderr rename to clippy_tests/examples/identity_op.stderr index ab455ad1585..0311ed33b88 100644 --- a/tests/ui/identity_op.stderr +++ b/clippy_tests/examples/identity_op.stderr @@ -1,50 +1,61 @@ error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:13:5 + --> examples/identity_op.rs:13:5 | 13 | x + 0; | ^^^^^ | -note: lint level defined here - --> $DIR/identity_op.rs:9:8 - | -9 | #[deny(identity_op)] - | ^^^^^^^^^^^ + = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:14:5 + --> examples/identity_op.rs:14:5 | 14 | x + (1 - 1); | ^^^^^^^^^^^ + | + = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:16:5 + --> examples/identity_op.rs:16:5 | 16 | 0 + x; | ^^^^^ + | + = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:19:5 + --> examples/identity_op.rs:19:5 | 19 | x | (0); | ^^^^^^^ + | + = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:22:5 + --> examples/identity_op.rs:22:5 | 22 | x * 1; | ^^^^^ + | + = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:23:5 + --> examples/identity_op.rs:23:5 | 23 | 1 * x; | ^^^^^ + | + = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:29:5 + --> examples/identity_op.rs:29:5 | 29 | -1 & x; | ^^^^^^ + | + = note: `-D identity-op` 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. diff --git a/tests/ui/if_let_redundant_pattern_matching.rs b/clippy_tests/examples/if_let_redundant_pattern_matching.rs similarity index 88% rename from tests/ui/if_let_redundant_pattern_matching.rs rename to clippy_tests/examples/if_let_redundant_pattern_matching.rs index 8ba2e1c5ff7..6444bd8ef68 100644 --- a/tests/ui/if_let_redundant_pattern_matching.rs +++ b/clippy_tests/examples/if_let_redundant_pattern_matching.rs @@ -1,8 +1,8 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] -#![deny(if_let_redundant_pattern_matching)] +#![warn(clippy)] +#![warn(if_let_redundant_pattern_matching)] fn main() { diff --git a/tests/ui/if_let_redundant_pattern_matching.stderr b/clippy_tests/examples/if_let_redundant_pattern_matching.stderr similarity index 55% rename from tests/ui/if_let_redundant_pattern_matching.stderr rename to clippy_tests/examples/if_let_redundant_pattern_matching.stderr index a5dddf05ec4..44e61675b55 100644 --- a/tests/ui/if_let_redundant_pattern_matching.stderr +++ b/clippy_tests/examples/if_let_redundant_pattern_matching.stderr @@ -1,39 +1,37 @@ error: redundant pattern matching, consider using `is_ok()` - --> $DIR/if_let_redundant_pattern_matching.rs:9:12 + --> examples/if_let_redundant_pattern_matching.rs:9:12 | 9 | if let Ok(_) = Ok::(42) {} | -------^^^^^--------------------- help: try this `if Ok::(42).is_ok()` | - = note: #[deny(if_let_redundant_pattern_matching)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/if_let_redundant_pattern_matching.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ + = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_err()` - --> $DIR/if_let_redundant_pattern_matching.rs:11:12 + --> examples/if_let_redundant_pattern_matching.rs:11:12 | 11 | if let Err(_) = Err::(42) { | -------^^^^^^---------------------- help: try this `if Err::(42).is_err()` | - = note: #[deny(if_let_redundant_pattern_matching)] implied by #[deny(clippy)] + = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_none()` - --> $DIR/if_let_redundant_pattern_matching.rs:14:12 + --> examples/if_let_redundant_pattern_matching.rs:14:12 | 14 | if let None = None::<()> { | -------^^^^------------- help: try this `if None::<()>.is_none()` | - = note: #[deny(if_let_redundant_pattern_matching)] implied by #[deny(clippy)] + = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_some()` - --> $DIR/if_let_redundant_pattern_matching.rs:17:12 + --> examples/if_let_redundant_pattern_matching.rs:17:12 | 17 | if let Some(_) = Some(42) { | -------^^^^^^^----------- help: try this `if Some(42).is_some()` | - = note: #[deny(if_let_redundant_pattern_matching)] implied by #[deny(clippy)] + = note: `-D if-let-redundant-pattern-matching` 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. diff --git a/tests/ui/if_not_else.rs b/clippy_tests/examples/if_not_else.rs similarity index 87% rename from tests/ui/if_not_else.rs rename to clippy_tests/examples/if_not_else.rs index 5cdc6ce8678..7b838560ed1 100644 --- a/tests/ui/if_not_else.rs +++ b/clippy_tests/examples/if_not_else.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] -#![deny(if_not_else)] +#![warn(clippy)] +#![warn(if_not_else)] fn bla() -> bool { unimplemented!() } diff --git a/tests/ui/if_not_else.stderr b/clippy_tests/examples/if_not_else.stderr similarity index 66% rename from tests/ui/if_not_else.stderr rename to clippy_tests/examples/if_not_else.stderr index 75e814ee0ee..06aea90eaf1 100644 --- a/tests/ui/if_not_else.stderr +++ b/clippy_tests/examples/if_not_else.stderr @@ -1,5 +1,5 @@ error: Unnecessary boolean `not` operation - --> $DIR/if_not_else.rs:9:5 + --> examples/if_not_else.rs:9:5 | 9 | / if !bla() { 10 | | println!("Bugs"); @@ -8,15 +8,11 @@ error: Unnecessary boolean `not` operation 13 | | } | |_____^ | -note: lint level defined here - --> $DIR/if_not_else.rs:4:9 - | -4 | #![deny(if_not_else)] - | ^^^^^^^^^^^ + = note: `-D if-not-else` implied by `-D warnings` = help: remove the `!` and swap the blocks of the if/else error: Unnecessary `!=` operation - --> $DIR/if_not_else.rs:14:5 + --> examples/if_not_else.rs:14:5 | 14 | / if 4 != 5 { 15 | | println!("Bugs"); @@ -25,7 +21,11 @@ error: Unnecessary `!=` operation 18 | | } | |_____^ | + = note: `-D if-not-else` implied by `-D warnings` = help: change to `==` and swap the blocks of the if/else error: aborting due to 2 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/invalid_upcast_comparisons.rs b/clippy_tests/examples/invalid_upcast_comparisons.rs similarity index 97% rename from tests/ui/invalid_upcast_comparisons.rs rename to clippy_tests/examples/invalid_upcast_comparisons.rs index c59f04d4f38..de606902e72 100644 --- a/tests/ui/invalid_upcast_comparisons.rs +++ b/clippy_tests/examples/invalid_upcast_comparisons.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(invalid_upcast_comparisons)] +#![warn(invalid_upcast_comparisons)] #![allow(unused, eq_op, no_effect, unnecessary_operation)] fn mk_value() -> T { unimplemented!() } diff --git a/tests/ui/invalid_upcast_comparisons.stderr b/clippy_tests/examples/invalid_upcast_comparisons.stderr similarity index 55% rename from tests/ui/invalid_upcast_comparisons.stderr rename to clippy_tests/examples/invalid_upcast_comparisons.stderr index 874081c22ab..578395a9795 100644 --- a/tests/ui/invalid_upcast_comparisons.stderr +++ b/clippy_tests/examples/invalid_upcast_comparisons.stderr @@ -1,170 +1,221 @@ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:16:5 + --> examples/invalid_upcast_comparisons.rs:16:5 | 16 | (u8 as u32) > 300; | ^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/invalid_upcast_comparisons.rs:4:9 - | -4 | #![deny(invalid_upcast_comparisons)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:17:5 + --> examples/invalid_upcast_comparisons.rs:17:5 | 17 | (u8 as i32) > 300; | ^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:18:5 + --> examples/invalid_upcast_comparisons.rs:18:5 | 18 | (u8 as u32) == 300; | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:19:5 + --> examples/invalid_upcast_comparisons.rs:19:5 | 19 | (u8 as i32) == 300; | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:20:5 + --> examples/invalid_upcast_comparisons.rs:20:5 | 20 | 300 < (u8 as u32); | ^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:21:5 + --> examples/invalid_upcast_comparisons.rs:21:5 | 21 | 300 < (u8 as i32); | ^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:22:5 + --> examples/invalid_upcast_comparisons.rs:22:5 | 22 | 300 == (u8 as u32); | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:23:5 + --> examples/invalid_upcast_comparisons.rs:23:5 | 23 | 300 == (u8 as i32); | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:25:5 + --> examples/invalid_upcast_comparisons.rs:25:5 | 25 | (u8 as u32) <= 300; | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:26:5 + --> examples/invalid_upcast_comparisons.rs:26:5 | 26 | (u8 as i32) <= 300; | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:27:5 + --> examples/invalid_upcast_comparisons.rs:27:5 | 27 | (u8 as u32) != 300; | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:28:5 + --> examples/invalid_upcast_comparisons.rs:28:5 | 28 | (u8 as i32) != 300; | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:29:5 + --> examples/invalid_upcast_comparisons.rs:29:5 | 29 | 300 >= (u8 as u32); | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:30:5 + --> examples/invalid_upcast_comparisons.rs:30:5 | 30 | 300 >= (u8 as i32); | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:31:5 + --> examples/invalid_upcast_comparisons.rs:31:5 | 31 | 300 != (u8 as u32); | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:32:5 + --> examples/invalid_upcast_comparisons.rs:32:5 | 32 | 300 != (u8 as i32); | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:35:5 + --> examples/invalid_upcast_comparisons.rs:35:5 | 35 | (u8 as i32) < 0; | ^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:36:5 + --> examples/invalid_upcast_comparisons.rs:36:5 | 36 | -5 != (u8 as i32); | ^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:38:5 + --> examples/invalid_upcast_comparisons.rs:38:5 | 38 | (u8 as i32) >= 0; | ^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:39:5 + --> examples/invalid_upcast_comparisons.rs:39:5 | 39 | -5 == (u8 as i32); | ^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:42:5 + --> examples/invalid_upcast_comparisons.rs:42:5 | 42 | 1337 == (u8 as i32); | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:43:5 + --> examples/invalid_upcast_comparisons.rs:43:5 | 43 | 1337 == (u8 as u32); | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:45:5 + --> examples/invalid_upcast_comparisons.rs:45:5 | 45 | 1337 != (u8 as i32); | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:46:5 + --> examples/invalid_upcast_comparisons.rs:46:5 | 46 | 1337 != (u8 as u32); | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:61:5 + --> examples/invalid_upcast_comparisons.rs:61:5 | 61 | (u8 as i32) > -1; | ^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:62:5 + --> examples/invalid_upcast_comparisons.rs:62:5 | 62 | (u8 as i32) < -1; | ^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:78:5 + --> examples/invalid_upcast_comparisons.rs:78:5 | 78 | -5 >= (u8 as i32); | ^^^^^^^^^^^^^^^^^ + | + = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: aborting due to 27 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/item_after_statement.rs b/clippy_tests/examples/item_after_statement.rs similarity index 92% rename from tests/ui/item_after_statement.rs rename to clippy_tests/examples/item_after_statement.rs index 5ba94383cc6..e3e4a4c7578 100644 --- a/tests/ui/item_after_statement.rs +++ b/clippy_tests/examples/item_after_statement.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(items_after_statements)] +#![warn(items_after_statements)] fn ok() { fn foo() { println!("foo"); } diff --git a/tests/ui/item_after_statement.stderr b/clippy_tests/examples/item_after_statement.stderr similarity index 57% rename from tests/ui/item_after_statement.stderr rename to clippy_tests/examples/item_after_statement.stderr index 318db240ca2..f1010bc65c6 100644 --- a/tests/ui/item_after_statement.stderr +++ b/clippy_tests/examples/item_after_statement.stderr @@ -1,20 +1,21 @@ error: adding items after statements is confusing, since items exist from the start of the scope - --> $DIR/item_after_statement.rs:12:5 + --> examples/item_after_statement.rs:12:5 | 12 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/item_after_statement.rs:3:9 - | -3 | #![deny(items_after_statements)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D items-after-statements` implied by `-D warnings` error: adding items after statements is confusing, since items exist from the start of the scope - --> $DIR/item_after_statement.rs:17:5 + --> examples/item_after_statement.rs:17:5 | 17 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D items-after-statements` 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. diff --git a/tests/ui/large_enum_variant.rs b/clippy_tests/examples/large_enum_variant.rs similarity index 96% rename from tests/ui/large_enum_variant.rs rename to clippy_tests/examples/large_enum_variant.rs index 8ac7571c1b1..31a7760aa19 100644 --- a/tests/ui/large_enum_variant.rs +++ b/clippy_tests/examples/large_enum_variant.rs @@ -3,7 +3,7 @@ #![allow(dead_code)] #![allow(unused_variables)] -#![deny(large_enum_variant)] +#![warn(large_enum_variant)] enum LargeEnum { A(i32), diff --git a/tests/ui/large_enum_variant.stderr b/clippy_tests/examples/large_enum_variant.stderr similarity index 68% rename from tests/ui/large_enum_variant.stderr rename to clippy_tests/examples/large_enum_variant.stderr index 84213003eb7..d7df84799ef 100644 --- a/tests/ui/large_enum_variant.stderr +++ b/clippy_tests/examples/large_enum_variant.stderr @@ -1,70 +1,74 @@ error: large size difference between variants - --> $DIR/large_enum_variant.rs:10:5 + --> examples/large_enum_variant.rs:10:5 | 10 | B([i32; 8000]), | ^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/large_enum_variant.rs:6:9 - | -6 | #![deny(large_enum_variant)] - | ^^^^^^^^^^^^^^^^^^ + = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum | B(Box<[i32; 8000]>), error: large size difference between variants - --> $DIR/large_enum_variant.rs:21:5 + --> examples/large_enum_variant.rs:21:5 | 21 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ | + = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum - --> $DIR/large_enum_variant.rs:21:5 + --> examples/large_enum_variant.rs:21:5 | 21 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> $DIR/large_enum_variant.rs:34:5 + --> examples/large_enum_variant.rs:34:5 | 34 | ContainingLargeEnum(LargeEnum), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum | ContainingLargeEnum(Box), error: large size difference between variants - --> $DIR/large_enum_variant.rs:37:5 + --> examples/large_enum_variant.rs:37:5 | 37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum - --> $DIR/large_enum_variant.rs:37:5 + --> examples/large_enum_variant.rs:37:5 | 37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> $DIR/large_enum_variant.rs:44:5 + --> examples/large_enum_variant.rs:44:5 | 44 | StructLikeLarge { x: [i32; 8000], y: i32 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum - --> $DIR/large_enum_variant.rs:44:5 + --> examples/large_enum_variant.rs:44:5 | 44 | StructLikeLarge { x: [i32; 8000], y: i32 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> $DIR/large_enum_variant.rs:49:5 + --> examples/large_enum_variant.rs:49:5 | 49 | StructLikeLarge2 { x: [i32; 8000] }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum | StructLikeLarge2 { x: Box<[i32; 8000]> }, error: aborting due to 6 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/len_zero.rs b/clippy_tests/examples/len_zero.rs similarity index 98% rename from tests/ui/len_zero.rs rename to clippy_tests/examples/len_zero.rs index 4940ef4684f..c90e1193db1 100644 --- a/tests/ui/len_zero.rs +++ b/clippy_tests/examples/len_zero.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(len_without_is_empty, len_zero)] +#![warn(len_without_is_empty, len_zero)] #![allow(dead_code, unused)] pub struct PubOne; diff --git a/tests/ui/len_zero.stderr b/clippy_tests/examples/len_zero.stderr similarity index 65% rename from tests/ui/len_zero.stderr rename to clippy_tests/examples/len_zero.stderr index 891f1741aa7..f78838fdfe6 100644 --- a/tests/ui/len_zero.stderr +++ b/clippy_tests/examples/len_zero.stderr @@ -1,5 +1,5 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` method - --> $DIR/len_zero.rs:9:1 + --> examples/len_zero.rs:9:1 | 9 | / impl PubOne { 10 | | pub fn len(self: &Self) -> isize { @@ -8,22 +8,20 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` m 13 | | } | |_^ | -note: lint level defined here - --> $DIR/len_zero.rs:4:9 - | -4 | #![deny(len_without_is_empty, len_zero)] - | ^^^^^^^^^^^^^^^^^^^^ + = note: `-D len-without-is-empty` implied by `-D warnings` error: trait `PubTraitsToo` has a `len` method but no `is_empty` method - --> $DIR/len_zero.rs:55:1 + --> examples/len_zero.rs:55:1 | 55 | / pub trait PubTraitsToo { 56 | | fn len(self: &Self) -> isize; 57 | | } | |_^ + | + = note: `-D len-without-is-empty` implied by `-D warnings` error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method - --> $DIR/len_zero.rs:89:1 + --> examples/len_zero.rs:89:1 | 89 | / impl HasIsEmpty { 90 | | pub fn len(self: &Self) -> isize { @@ -33,9 +31,11 @@ error: item `HasIsEmpty` has a public `len` method but a private `is_empty` meth 96 | | } 97 | | } | |_^ + | + = note: `-D len-without-is-empty` implied by `-D warnings` error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method - --> $DIR/len_zero.rs:118:1 + --> examples/len_zero.rs:118:1 | 118 | / impl HasWrongIsEmpty { 119 | | pub fn len(self: &Self) -> isize { @@ -45,54 +45,67 @@ error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is 125 | | } 126 | | } | |_^ + | + = note: `-D len-without-is-empty` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:130:8 + --> examples/len_zero.rs:130:8 | 130 | if x.len() == 0 { | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `x.is_empty()` | -note: lint level defined here - --> $DIR/len_zero.rs:4:31 - | -4 | #![deny(len_without_is_empty, len_zero)] - | ^^^^^^^^ + = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:134:8 + --> examples/len_zero.rs:134:8 | 134 | if "".len() == 0 { | ^^^^^^^^^^^^^ help: using `is_empty` is more concise: `"".is_empty()` + | + = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:148:8 + --> examples/len_zero.rs:148:8 | 148 | if has_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` + | + = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:151:8 + --> examples/len_zero.rs:151:8 | 151 | if has_is_empty.len() != 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` + | + = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:154:8 + --> examples/len_zero.rs:154:8 | 154 | if has_is_empty.len() > 0 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` + | + = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:160:8 + --> examples/len_zero.rs:160:8 | 160 | if with_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `with_is_empty.is_empty()` + | + = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:172:8 + --> examples/len_zero.rs:172:8 | 172 | if b.len() != 0 { | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()` + | + = note: `-D len-zero` 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. diff --git a/tests/ui/let_if_seq.rs b/clippy_tests/examples/let_if_seq.rs similarity index 98% rename from tests/ui/let_if_seq.rs rename to clippy_tests/examples/let_if_seq.rs index 2e9edea006e..2d3ab7da996 100644 --- a/tests/ui/let_if_seq.rs +++ b/clippy_tests/examples/let_if_seq.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(unused_variables, unused_assignments, similar_names, blacklisted_name)] -#![deny(useless_let_if_seq)] +#![warn(useless_let_if_seq)] fn f() -> bool { true } fn g(x: i32) -> i32 { x + 1 } diff --git a/tests/ui/let_if_seq.stderr b/clippy_tests/examples/let_if_seq.stderr similarity index 72% rename from tests/ui/let_if_seq.stderr rename to clippy_tests/examples/let_if_seq.stderr index ea3c820dd8c..3f862a9133f 100644 --- a/tests/ui/let_if_seq.stderr +++ b/clippy_tests/examples/let_if_seq.stderr @@ -1,5 +1,5 @@ error: `if _ { .. } else { .. }` is an expression - --> $DIR/let_if_seq.rs:57:5 + --> examples/let_if_seq.rs:57:5 | 57 | / let mut foo = 0; 58 | | if f() { @@ -7,15 +7,11 @@ error: `if _ { .. } else { .. }` is an expression 60 | | } | |_____^ help: it is more idiomatic to write `let foo = if f() { 42 } else { 0 };` | -note: lint level defined here - --> $DIR/let_if_seq.rs:5:9 - | -5 | #![deny(useless_let_if_seq)] - | ^^^^^^^^^^^^^^^^^^ + = note: `-D useless-let-if-seq` implied by `-D warnings` = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression - --> $DIR/let_if_seq.rs:62:5 + --> examples/let_if_seq.rs:62:5 | 62 | / let mut bar = 0; 63 | | if f() { @@ -26,10 +22,11 @@ error: `if _ { .. } else { .. }` is an expression 69 | | } | |_____^ help: it is more idiomatic to write `let bar = if f() { ..; 42 } else { ..; 0 };` | + = note: `-D useless-let-if-seq` implied by `-D warnings` = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression - --> $DIR/let_if_seq.rs:71:5 + --> examples/let_if_seq.rs:71:5 | 71 | / let quz; 72 | | if f() { @@ -38,9 +35,11 @@ error: `if _ { .. } else { .. }` is an expression 75 | | quz = 0; 76 | | } | |_____^ help: it is more idiomatic to write `let quz = if f() { 42 } else { 0 };` + | + = note: `-D useless-let-if-seq` implied by `-D warnings` error: `if _ { .. } else { .. }` is an expression - --> $DIR/let_if_seq.rs:100:5 + --> examples/let_if_seq.rs:100:5 | 100 | / let mut baz = 0; 101 | | if f() { @@ -48,7 +47,11 @@ error: `if _ { .. } else { .. }` is an expression 103 | | } | |_____^ help: it is more idiomatic to write `let baz = if f() { 42 } else { 0 };` | + = note: `-D useless-let-if-seq` implied by `-D warnings` = note: you might not need `mut` at all error: aborting due to 4 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/let_return.rs b/clippy_tests/examples/let_return.rs similarity index 96% rename from tests/ui/let_return.rs rename to clippy_tests/examples/let_return.rs index 71cdf88c887..6aab70dbd8a 100644 --- a/tests/ui/let_return.rs +++ b/clippy_tests/examples/let_return.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(unused)] -#![deny(let_and_return)] +#![warn(let_and_return)] fn test() -> i32 { let _y = 0; // no warning diff --git a/tests/ui/let_return.stderr b/clippy_tests/examples/let_return.stderr similarity index 59% rename from tests/ui/let_return.stderr rename to clippy_tests/examples/let_return.stderr index 8b5cfa6f31d..e966066ccdc 100644 --- a/tests/ui/let_return.stderr +++ b/clippy_tests/examples/let_return.stderr @@ -1,31 +1,31 @@ error: returning the result of a let binding from a block. Consider returning the expression directly. - --> $DIR/let_return.rs:10:5 + --> examples/let_return.rs:10:5 | 10 | x | ^ | -note: lint level defined here - --> $DIR/let_return.rs:5:9 - | -5 | #![deny(let_and_return)] - | ^^^^^^^^^^^^^^ + = note: `-D let-and-return` implied by `-D warnings` note: this expression can be directly returned - --> $DIR/let_return.rs:9:13 + --> examples/let_return.rs:9:13 | 9 | let x = 5; | ^ error: returning the result of a let binding from a block. Consider returning the expression directly. - --> $DIR/let_return.rs:16:9 + --> examples/let_return.rs:16:9 | 16 | x | ^ | + = note: `-D let-and-return` implied by `-D warnings` note: this expression can be directly returned - --> $DIR/let_return.rs:15:17 + --> examples/let_return.rs:15:17 | 15 | let x = 5; | ^ error: aborting due to 2 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/let_unit.rs b/clippy_tests/examples/let_unit.rs similarity index 94% rename from tests/ui/let_unit.rs rename to clippy_tests/examples/let_unit.rs index fe541f3054c..ecae967f781 100644 --- a/tests/ui/let_unit.rs +++ b/clippy_tests/examples/let_unit.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(let_unit_value)] +#![warn(let_unit_value)] #![allow(unused_variables)] macro_rules! let_and_return { diff --git a/tests/ui/let_unit.stderr b/clippy_tests/examples/let_unit.stderr similarity index 54% rename from tests/ui/let_unit.stderr rename to clippy_tests/examples/let_unit.stderr index abeeb3b3981..c70ab7a58b5 100644 --- a/tests/ui/let_unit.stderr +++ b/clippy_tests/examples/let_unit.stderr @@ -1,20 +1,21 @@ error: this let-binding has unit value. Consider omitting `let _x =` - --> $DIR/let_unit.rs:14:5 + --> examples/let_unit.rs:14:5 | 14 | let _x = println!("x"); | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/let_unit.rs:4:9 - | -4 | #![deny(let_unit_value)] - | ^^^^^^^^^^^^^^ + = note: `-D let-unit-value` implied by `-D warnings` error: this let-binding has unit value. Consider omitting `let _a =` - --> $DIR/let_unit.rs:18:9 + --> examples/let_unit.rs:18:9 | 18 | let _a = (); | ^^^^^^^^^^^^ + | + = note: `-D let-unit-value` 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. diff --git a/tests/ui/lifetimes.rs b/clippy_tests/examples/lifetimes.rs similarity index 99% rename from tests/ui/lifetimes.rs rename to clippy_tests/examples/lifetimes.rs index e10fd590e6c..5f3c3604d80 100644 --- a/tests/ui/lifetimes.rs +++ b/clippy_tests/examples/lifetimes.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(needless_lifetimes, unused_lifetimes)] +#![warn(needless_lifetimes, unused_lifetimes)] #![allow(dead_code, needless_pass_by_value)] fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { } diff --git a/tests/ui/lifetimes.stderr b/clippy_tests/examples/lifetimes.stderr similarity index 69% rename from tests/ui/lifetimes.stderr rename to clippy_tests/examples/lifetimes.stderr index f80335af563..9875f4c29fb 100644 --- a/tests/ui/lifetimes.stderr +++ b/clippy_tests/examples/lifetimes.stderr @@ -1,94 +1,119 @@ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:7:1 + --> examples/lifetimes.rs:7:1 | 7 | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/lifetimes.rs:4:9 - | -4 | #![deny(needless_lifetimes, unused_lifetimes)] - | ^^^^^^^^^^^^^^^^^^ + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:9:1 + --> examples/lifetimes.rs:9:1 | 9 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:17:1 + --> examples/lifetimes.rs:17:1 | 17 | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:29:1 + --> examples/lifetimes.rs:29:1 | 29 | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:32:1 + --> examples/lifetimes.rs:32:1 | 32 | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> where T: Copy { Ok(x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:38:1 + --> examples/lifetimes.rs:38:1 | 38 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:52:1 + --> examples/lifetimes.rs:52:1 | 52 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I> 53 | | where for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I> 54 | | { unreachable!() } | |__________________^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:61:5 + --> examples/lifetimes.rs:61:5 | 61 | fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:65:5 + --> examples/lifetimes.rs:65:5 | 65 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:81:1 + --> examples/lifetimes.rs:81:1 | 81 | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:101:1 + --> examples/lifetimes.rs:101:1 | 101 | fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:105:1 + --> examples/lifetimes.rs:105:1 | 105 | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:116:1 + --> examples/lifetimes.rs:116:1 | 116 | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:120:1 + --> examples/lifetimes.rs:120:1 | 120 | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-lifetimes` 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. diff --git a/tests/ui/lint_pass.rs b/clippy_tests/examples/lint_pass.rs similarity index 92% rename from tests/ui/lint_pass.rs rename to clippy_tests/examples/lint_pass.rs index 3dbd672fc5a..5ecbeb7f11a 100644 --- a/tests/ui/lint_pass.rs +++ b/clippy_tests/examples/lint_pass.rs @@ -2,7 +2,7 @@ #![feature(rustc_private)] #![plugin(clippy)] -#![deny(lint_without_lint_pass)] +#![warn(lint_without_lint_pass)] #[macro_use] extern crate rustc; diff --git a/tests/ui/lint_pass.stderr b/clippy_tests/examples/lint_pass.stderr similarity index 54% rename from tests/ui/lint_pass.stderr rename to clippy_tests/examples/lint_pass.stderr index 2439007feac..ab3df34a8aa 100644 --- a/tests/ui/lint_pass.stderr +++ b/clippy_tests/examples/lint_pass.stderr @@ -1,14 +1,13 @@ error: the lint `MISSING_LINT` is not added to any `LintPass` - --> $DIR/lint_pass.rs:12:1 + --> examples/lint_pass.rs:12:1 | 12 | declare_lint! { MISSING_LINT, Warn, "missing lint" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/lint_pass.rs:5:9 - | -5 | #![deny(lint_without_lint_pass)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D lint-without-lint-pass` 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. diff --git a/tests/ui/literals.rs b/clippy_tests/examples/literals.rs similarity index 85% rename from tests/ui/literals.rs rename to clippy_tests/examples/literals.rs index 527a96b755e..5fc22f238d0 100644 --- a/tests/ui/literals.rs +++ b/clippy_tests/examples/literals.rs @@ -1,8 +1,8 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(mixed_case_hex_literals)] -#![deny(unseparated_literal_suffix)] -#![deny(zero_prefixed_literal)] +#![warn(mixed_case_hex_literals)] +#![warn(unseparated_literal_suffix)] +#![warn(zero_prefixed_literal)] #![allow(dead_code)] fn main() { diff --git a/tests/ui/literals.stderr b/clippy_tests/examples/literals.stderr similarity index 57% rename from tests/ui/literals.stderr rename to clippy_tests/examples/literals.stderr index b9a0fc04181..77c6b562113 100644 --- a/tests/ui/literals.stderr +++ b/clippy_tests/examples/literals.stderr @@ -1,74 +1,74 @@ error: inconsistent casing in hexadecimal literal - --> $DIR/literals.rs:14:17 + --> examples/literals.rs:14:17 | 14 | let fail1 = 0xabCD; | ^^^^^^ | -note: lint level defined here - --> $DIR/literals.rs:3:9 - | -3 | #![deny(mixed_case_hex_literals)] - | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D mixed-case-hex-literals` implied by `-D warnings` error: inconsistent casing in hexadecimal literal - --> $DIR/literals.rs:15:17 + --> examples/literals.rs:15:17 | 15 | let fail2 = 0xabCD_u32; | ^^^^^^^^^^ + | + = note: `-D mixed-case-hex-literals` implied by `-D warnings` error: inconsistent casing in hexadecimal literal - --> $DIR/literals.rs:16:17 + --> examples/literals.rs:16:17 | 16 | let fail2 = 0xabCD_isize; | ^^^^^^^^^^^^ + | + = note: `-D mixed-case-hex-literals` implied by `-D warnings` error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:21:17 + --> examples/literals.rs:21:17 | 21 | let fail3 = 1234i32; | ^^^^^^^ | -note: lint level defined here - --> $DIR/literals.rs:4:9 - | -4 | #![deny(unseparated_literal_suffix)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:22:17 + --> examples/literals.rs:22:17 | 22 | let fail4 = 1234u32; | ^^^^^^^ + | + = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:23:17 + --> examples/literals.rs:23:17 | 23 | let fail5 = 1234isize; | ^^^^^^^^^ + | + = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:24:17 + --> examples/literals.rs:24:17 | 24 | let fail6 = 1234usize; | ^^^^^^^^^ + | + = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: float type suffix should be separated by an underscore - --> $DIR/literals.rs:25:17 + --> examples/literals.rs:25:17 | 25 | let fail7 = 1.5f32; | ^^^^^^ + | + = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: this is a decimal constant - --> $DIR/literals.rs:29:17 + --> examples/literals.rs:29:17 | 29 | let fail8 = 0123; | ^^^^ | -note: lint level defined here - --> $DIR/literals.rs:5:9 - | -5 | #![deny(zero_prefixed_literal)] - | ^^^^^^^^^^^^^^^^^^^^^ + = note: `-D zero-prefixed-literal` implied by `-D warnings` help: if you mean to use a decimal constant, remove the `0` to remove confusion: | let fail8 = 123; help: if you mean to use an octal constant, use `0o`: @@ -76,3 +76,6 @@ help: if you mean to use an octal constant, use `0o`: error: aborting due to 9 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/map_clone.rs b/clippy_tests/examples/map_clone.rs similarity index 98% rename from tests/ui/map_clone.rs rename to clippy_tests/examples/map_clone.rs index a71a3067d25..81e298390f5 100644 --- a/tests/ui/map_clone.rs +++ b/clippy_tests/examples/map_clone.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(map_clone)] +#![warn(map_clone)] #![allow(clone_on_copy, unused)] diff --git a/tests/ui/map_clone.stderr b/clippy_tests/examples/map_clone.stderr similarity index 71% rename from tests/ui/map_clone.stderr rename to clippy_tests/examples/map_clone.stderr index 0a8a659d720..378c7fc5269 100644 --- a/tests/ui/map_clone.stderr +++ b/clippy_tests/examples/map_clone.stderr @@ -1,106 +1,115 @@ error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> $DIR/map_clone.rs:12:5 + --> examples/map_clone.rs:12:5 | 12 | x.iter().map(|y| y.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/map_clone.rs:4:9 - | -4 | #![deny(map_clone)] - | ^^^^^^^^^ + = note: `-D map-clone` implied by `-D warnings` = help: try x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> $DIR/map_clone.rs:14:5 + --> examples/map_clone.rs:14:5 | 14 | x.iter().map(|&y| y); | ^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> $DIR/map_clone.rs:16:5 + --> examples/map_clone.rs:16:5 | 16 | x.iter().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> $DIR/map_clone.rs:18:5 + --> examples/map_clone.rs:18:5 | 18 | x.iter().map(|y| { y.clone() }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> $DIR/map_clone.rs:20:5 + --> examples/map_clone.rs:20:5 | 20 | x.iter().map(|&y| { y }); | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> $DIR/map_clone.rs:22:5 + --> examples/map_clone.rs:22:5 | 22 | x.iter().map(|y| { *y }); | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> $DIR/map_clone.rs:24:5 + --> examples/map_clone.rs:24:5 | 24 | x.iter().map(Clone::clone); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.iter().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> $DIR/map_clone.rs:30:5 + --> examples/map_clone.rs:30:5 | 30 | x.as_ref().map(|y| y.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> $DIR/map_clone.rs:32:5 + --> examples/map_clone.rs:32:5 | 32 | x.as_ref().map(|&y| y); | ^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> $DIR/map_clone.rs:34:5 + --> examples/map_clone.rs:34:5 | 34 | x.as_ref().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> $DIR/map_clone.rs:90:35 + --> examples/map_clone.rs:90:35 | 90 | let _: Option = x.as_ref().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D map-clone` implied by `-D warnings` = help: try x.as_ref().cloned() error: aborting due to 11 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/matches.rs b/clippy_tests/examples/matches.rs similarity index 99% rename from tests/ui/matches.rs rename to clippy_tests/examples/matches.rs index e45b0c97f2f..be1ca72aece 100644 --- a/tests/ui/matches.rs +++ b/clippy_tests/examples/matches.rs @@ -2,9 +2,9 @@ #![feature(exclusive_range_pattern)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(unused, if_let_redundant_pattern_matching)] -#![deny(single_match_else)] +#![warn(single_match_else)] use std::borrow::Cow; diff --git a/tests/ui/matches.stderr b/clippy_tests/examples/matches.stderr similarity index 67% rename from tests/ui/matches.stderr rename to clippy_tests/examples/matches.stderr index a1013aa5011..e94b1872b9e 100644 --- a/tests/ui/matches.stderr +++ b/clippy_tests/examples/matches.stderr @@ -1,5 +1,5 @@ error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/matches.rs:26:5 + --> examples/matches.rs:26:5 | 26 | / match ExprNode::Butterflies { 27 | | ExprNode::ExprAddrOf => Some(&NODE), @@ -7,14 +7,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 29 | | } | |_____^ help: try this `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }` | -note: lint level defined here - --> $DIR/matches.rs:7:9 - | -7 | #![deny(single_match_else)] - | ^^^^^^^^^^^^^^^^^ + = note: `-D single-match-else` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/matches.rs:35:5 + --> examples/matches.rs:35:5 | 35 | / match x { 36 | | Some(y) => { println!("{:?}", y); } @@ -22,15 +18,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 38 | | }; | |_____^ help: try this `if let Some(y) = x { println!("{:?}", y); }` | - = note: #[deny(single_match)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/matches.rs:5:9 - | -5 | #![deny(clippy)] - | ^^^^^^ + = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/matches.rs:41:5 + --> examples/matches.rs:41:5 | 41 | / match z { 42 | | (2...3, 7...9) => dummy(), @@ -38,10 +29,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 44 | | }; | |_____^ help: try this `if let (2...3, 7...9) = z { dummy() }` | - = note: #[deny(single_match)] implied by #[deny(clippy)] + = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/matches.rs:63:5 + --> examples/matches.rs:63:5 | 63 | / match x { 64 | | Some(y) => dummy(), @@ -49,10 +40,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 66 | | }; | |_____^ help: try this `if let Some(y) = x { dummy() }` | - = note: #[deny(single_match)] implied by #[deny(clippy)] + = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/matches.rs:68:5 + --> examples/matches.rs:68:5 | 68 | / match y { 69 | | Ok(y) => dummy(), @@ -60,10 +51,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 71 | | }; | |_____^ help: try this `if let Ok(y) = y { dummy() }` | - = note: #[deny(single_match)] implied by #[deny(clippy)] + = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/matches.rs:75:5 + --> examples/matches.rs:75:5 | 75 | / match c { 76 | | Cow::Borrowed(..) => dummy(), @@ -71,10 +62,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 78 | | }; | |_____^ help: try this `if let Cow::Borrowed(..) = c { dummy() }` | - = note: #[deny(single_match)] implied by #[deny(clippy)] + = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> $DIR/matches.rs:96:5 + --> examples/matches.rs:96:5 | 96 | / match test { 97 | | true => 0, @@ -82,15 +73,10 @@ error: you seem to be trying to match on a boolean expression 99 | | }; | |_____^ help: consider using an if/else expression `if test { 0 } else { 42 }` | - = note: #[deny(match_bool)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/matches.rs:5:9 - | -5 | #![deny(clippy)] - | ^^^^^^ + = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> $DIR/matches.rs:102:5 + --> examples/matches.rs:102:5 | 102 | / match option == 1 { 103 | | true => 1, @@ -98,10 +84,10 @@ error: you seem to be trying to match on a boolean expression 105 | | }; | |_____^ help: consider using an if/else expression `if option == 1 { 1 } else { 0 }` | - = note: #[deny(match_bool)] implied by #[deny(clippy)] + = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> $DIR/matches.rs:107:5 + --> examples/matches.rs:107:5 | 107 | / match test { 108 | | true => (), @@ -109,10 +95,10 @@ error: you seem to be trying to match on a boolean expression 110 | | }; | |_____^ help: consider using an if/else expression `if !test { println!("Noooo!"); }` | - = note: #[deny(match_bool)] implied by #[deny(clippy)] + = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> $DIR/matches.rs:112:5 + --> examples/matches.rs:112:5 | 112 | / match test { 113 | | false => { println!("Noooo!"); } @@ -120,10 +106,10 @@ error: you seem to be trying to match on a boolean expression 115 | | }; | |_____^ help: consider using an if/else expression `if !test { println!("Noooo!"); }` | - = note: #[deny(match_bool)] implied by #[deny(clippy)] + = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> $DIR/matches.rs:117:5 + --> examples/matches.rs:117:5 | 117 | / match test && test { 118 | | false => { println!("Noooo!"); } @@ -131,23 +117,18 @@ error: you seem to be trying to match on a boolean expression 120 | | }; | |_____^ help: consider using an if/else expression `if !(test && test) { println!("Noooo!"); }` | - = note: #[deny(match_bool)] implied by #[deny(clippy)] + = note: `-D match-bool` implied by `-D warnings` error: equal expressions as operands to `&&` - --> $DIR/matches.rs:117:11 + --> examples/matches.rs:117:11 | 117 | match test && test { | ^^^^^^^^^^^^ | - = note: #[deny(eq_op)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/matches.rs:5:9 - | -5 | #![deny(clippy)] - | ^^^^^^ + = note: `-D eq-op` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> $DIR/matches.rs:122:5 + --> examples/matches.rs:122:5 | 122 | / match test { 123 | | false => { println!("Noooo!"); } @@ -155,10 +136,10 @@ error: you seem to be trying to match on a boolean expression 125 | | }; | |_____^ help: consider using an if/else expression `if test { println!("Yes!"); } else { println!("Noooo!"); }` | - = note: #[deny(match_bool)] implied by #[deny(clippy)] + = note: `-D match-bool` implied by `-D warnings` error: you don't need to add `&` to all patterns - --> $DIR/matches.rs:138:9 + --> examples/matches.rs:138:9 | 138 | / match v { 139 | | &Some(v) => println!("{:?}", v), @@ -166,17 +147,12 @@ error: you don't need to add `&` to all patterns 141 | | } | |_________^ | - = note: #[deny(match_ref_pats)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/matches.rs:5:9 - | -5 | #![deny(clippy)] - | ^^^^^^ + = note: `-D match-ref-pats` implied by `-D warnings` help: instead of prefixing all patterns with `&`, you can dereference the expression | match *v { .. } error: you don't need to add `&` to all patterns - --> $DIR/matches.rs:148:5 + --> examples/matches.rs:148:5 | 148 | / match tup { 149 | | &(v, 1) => println!("{}", v), @@ -184,12 +160,12 @@ error: you don't need to add `&` to all patterns 151 | | } | |_____^ | - = note: #[deny(match_ref_pats)] implied by #[deny(clippy)] + = note: `-D match-ref-pats` implied by `-D warnings` help: instead of prefixing all patterns with `&`, you can dereference the expression | match *tup { .. } error: you don't need to add `&` to both the expression and the patterns - --> $DIR/matches.rs:154:5 + --> examples/matches.rs:154:5 | 154 | / match &w { 155 | | &Some(v) => println!("{:?}", v), @@ -197,131 +173,124 @@ error: you don't need to add `&` to both the expression and the patterns 157 | | } | |_____^ help: try `match w { .. }` | - = note: #[deny(match_ref_pats)] implied by #[deny(clippy)] + = note: `-D match-ref-pats` implied by `-D warnings` error: you don't need to add `&` to all patterns - --> $DIR/matches.rs:165:5 + --> examples/matches.rs:165:5 | 165 | / if let &None = a { 166 | | println!("none"); 167 | | } | |_____^ | - = note: #[deny(match_ref_pats)] implied by #[deny(clippy)] + = note: `-D match-ref-pats` implied by `-D warnings` help: instead of prefixing all patterns with `&`, you can dereference the expression | if let .. = *a { .. } error: you don't need to add `&` to both the expression and the patterns - --> $DIR/matches.rs:170:5 + --> examples/matches.rs:170:5 | 170 | / if let &None = &b { 171 | | println!("none"); 172 | | } | |_____^ help: try `if let .. = b { .. }` | - = note: #[deny(match_ref_pats)] implied by #[deny(clippy)] + = note: `-D match-ref-pats` implied by `-D warnings` error: some ranges overlap - --> $DIR/matches.rs:179:9 + --> examples/matches.rs:179:9 | 179 | 0 ... 10 => println!("0 ... 10"), | ^^^^^^^^ | - = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/matches.rs:5:9 - | -5 | #![deny(clippy)] - | ^^^^^^ + = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> $DIR/matches.rs:180:9 + --> examples/matches.rs:180:9 | 180 | 0 ... 11 => println!("0 ... 11"), | ^^^^^^^^ error: some ranges overlap - --> $DIR/matches.rs:185:9 + --> examples/matches.rs:185:9 | 185 | 0 ... 5 => println!("0 ... 5"), | ^^^^^^^ | - = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)] + = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> $DIR/matches.rs:187:9 + --> examples/matches.rs:187:9 | 187 | FOO ... 11 => println!("0 ... 11"), | ^^^^^^^^^^ error: some ranges overlap - --> $DIR/matches.rs:193:9 + --> examples/matches.rs:193:9 | 193 | 0 ... 5 => println!("0 ... 5"), | ^^^^^^^ | - = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)] + = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> $DIR/matches.rs:192:9 + --> examples/matches.rs:192:9 | 192 | 2 => println!("2"), | ^ error: some ranges overlap - --> $DIR/matches.rs:199:9 + --> examples/matches.rs:199:9 | 199 | 0 ... 2 => println!("0 ... 2"), | ^^^^^^^ | - = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)] + = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> $DIR/matches.rs:198:9 + --> examples/matches.rs:198:9 | 198 | 2 => println!("2"), | ^ error: some ranges overlap - --> $DIR/matches.rs:222:9 + --> examples/matches.rs:222:9 | 222 | 0 .. 11 => println!("0 .. 11"), | ^^^^^^^ | - = note: #[deny(match_overlapping_arm)] implied by #[deny(clippy)] + = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> $DIR/matches.rs:223:9 + --> examples/matches.rs:223:9 | 223 | 0 ... 11 => println!("0 ... 11"), | ^^^^^^^^ error: Err(_) will match all errors, maybe not a good idea - --> $DIR/matches.rs:240:9 + --> examples/matches.rs:240:9 | 240 | Err(_) => panic!("err") | ^^^^^^ | - = note: #[deny(match_wild_err_arm)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/matches.rs:5:9 - | -5 | #![deny(clippy)] - | ^^^^^^ + = note: `-D match-wild-err-arm` implied by `-D warnings` = note: to remove this warning, match each error seperately or use unreachable macro error: Err(_) will match all errors, maybe not a good idea - --> $DIR/matches.rs:246:9 + --> examples/matches.rs:246:9 | 246 | Err(_) => {panic!()} | ^^^^^^ | - = note: #[deny(match_wild_err_arm)] implied by #[deny(clippy)] + = note: `-D match-wild-err-arm` implied by `-D warnings` = note: to remove this warning, match each error seperately or use unreachable macro error: Err(_) will match all errors, maybe not a good idea - --> $DIR/matches.rs:252:9 + --> examples/matches.rs:252:9 | 252 | Err(_) => {panic!();} | ^^^^^^ | - = note: #[deny(match_wild_err_arm)] implied by #[deny(clippy)] + = note: `-D match-wild-err-arm` implied by `-D warnings` = note: to remove this warning, match each error seperately or use unreachable macro error: aborting due to 26 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/mem_forget.rs b/clippy_tests/examples/mem_forget.rs similarity index 95% rename from tests/ui/mem_forget.rs rename to clippy_tests/examples/mem_forget.rs index 82212414cf3..7854a373968 100644 --- a/tests/ui/mem_forget.rs +++ b/clippy_tests/examples/mem_forget.rs @@ -8,7 +8,7 @@ use std::rc::Rc; use std::mem::forget as forgetSomething; use std::mem as memstuff; -#[deny(mem_forget)] +#[warn(mem_forget)] #[allow(forget_copy)] fn main() { let five: i32 = 5; diff --git a/tests/ui/mem_forget.stderr b/clippy_tests/examples/mem_forget.stderr similarity index 52% rename from tests/ui/mem_forget.stderr rename to clippy_tests/examples/mem_forget.stderr index 306032c49c3..9bbe6d85b06 100644 --- a/tests/ui/mem_forget.stderr +++ b/clippy_tests/examples/mem_forget.stderr @@ -1,26 +1,29 @@ error: usage of mem::forget on Drop type - --> $DIR/mem_forget.rs:18:5 + --> examples/mem_forget.rs:18:5 | 18 | memstuff::forget(six); | ^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/mem_forget.rs:11:8 - | -11 | #[deny(mem_forget)] - | ^^^^^^^^^^ + = note: `-D mem-forget` implied by `-D warnings` error: usage of mem::forget on Drop type - --> $DIR/mem_forget.rs:21:5 + --> examples/mem_forget.rs:21:5 | 21 | std::mem::forget(seven); | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D mem-forget` implied by `-D warnings` error: usage of mem::forget on Drop type - --> $DIR/mem_forget.rs:24:5 + --> examples/mem_forget.rs:24:5 | 24 | forgetSomething(eight); | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D mem-forget` 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. diff --git a/tests/ui/methods.rs b/clippy_tests/examples/methods.rs similarity index 99% rename from tests/ui/methods.rs rename to clippy_tests/examples/methods.rs index 71b4c48f3de..33c507ed82a 100644 --- a/tests/ui/methods.rs +++ b/clippy_tests/examples/methods.rs @@ -2,7 +2,7 @@ #![feature(const_fn)] #![plugin(clippy)] -#![deny(clippy, clippy_pedantic)] +#![warn(clippy, clippy_pedantic)] #![allow(blacklisted_name, unused, print_stdout, non_ascii_literal, new_without_default, new_without_default_derive, missing_docs_in_private_items)] use std::collections::BTreeMap; diff --git a/tests/ui/methods.stderr b/clippy_tests/examples/methods.stderr similarity index 64% rename from tests/ui/methods.stderr rename to clippy_tests/examples/methods.stderr index 9c77d4dac87..d68f4e2e931 100644 --- a/tests/ui/methods.stderr +++ b/clippy_tests/examples/methods.stderr @@ -1,68 +1,53 @@ error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name - --> $DIR/methods.rs:18:5 + --> examples/methods.rs:18:5 | 18 | fn add(self, other: T) -> T { self } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(should_implement_trait)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D should-implement-trait` implied by `-D warnings` error: defining a method called `drop` on this type; consider implementing the `std::ops::Drop` trait or choosing a less ambiguous name - --> $DIR/methods.rs:19:5 + --> examples/methods.rs:19:5 | 19 | fn drop(&mut self) { } | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(should_implement_trait)] implied by #[deny(clippy)] + = note: `-D should-implement-trait` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> $DIR/methods.rs:26:17 + --> examples/methods.rs:26:17 | 26 | fn into_u16(&self) -> u16 { 0 } | ^^^^^ | - = note: #[deny(wrong_self_convention)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> $DIR/methods.rs:28:21 + --> examples/methods.rs:28:21 | 28 | fn to_something(self) -> u32 { 0 } | ^^^^ | - = note: #[deny(wrong_self_convention)] implied by #[deny(clippy)] + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `new` usually take no self; consider choosing a less ambiguous name - --> $DIR/methods.rs:30:12 + --> examples/methods.rs:30:12 | 30 | fn new(self) {} | ^^^^ | - = note: #[deny(wrong_self_convention)] implied by #[deny(clippy)] + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `new` usually return `Self` - --> $DIR/methods.rs:30:5 + --> examples/methods.rs:30:5 | 30 | fn new(self) {} | ^^^^^^^^^^^^^^^ | - = note: #[deny(new_ret_no_self)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D new-ret-no-self` implied by `-D warnings` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:97:13 + --> examples/methods.rs:97:13 | 97 | let _ = opt.map(|x| x + 1) | _____________^ @@ -70,16 +55,11 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di 99 | | .unwrap_or(0); // should lint even though this call is on a separate line | |____________________________^ | - = note: #[deny(option_map_unwrap_or)] implied by #[deny(clippy_pedantic)] -note: lint level defined here - --> $DIR/methods.rs:5:17 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^^^^^^^^^^ + = note: `-D option-map-unwrap-or` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:101:13 + --> examples/methods.rs:101:13 | 101 | let _ = opt.map(|x| { | _____________^ @@ -88,10 +68,10 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di 104 | | ).unwrap_or(0); | |____________________________^ | - = note: #[deny(option_map_unwrap_or)] implied by #[deny(clippy_pedantic)] + = note: `-D option-map-unwrap-or` implied by `-D warnings` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:105:13 + --> examples/methods.rs:105:13 | 105 | let _ = opt.map(|x| x + 1) | _____________^ @@ -100,10 +80,10 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di 108 | | }); | |__________________^ | - = note: #[deny(option_map_unwrap_or)] implied by #[deny(clippy_pedantic)] + = note: `-D option-map-unwrap-or` implied by `-D warnings` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:114:13 + --> examples/methods.rs:114:13 | 114 | let _ = opt.map(|x| x + 1) | _____________^ @@ -111,16 +91,11 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo 116 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line | |____________________________________^ | - = note: #[deny(option_map_unwrap_or_else)] implied by #[deny(clippy_pedantic)] -note: lint level defined here - --> $DIR/methods.rs:5:17 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^^^^^^^^^^ + = note: `-D option-map-unwrap-or-else` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:118:13 + --> examples/methods.rs:118:13 | 118 | let _ = opt.map(|x| { | _____________^ @@ -129,10 +104,10 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo 121 | | ).unwrap_or_else(|| 0); | |____________________________________^ | - = note: #[deny(option_map_unwrap_or_else)] implied by #[deny(clippy_pedantic)] + = note: `-D option-map-unwrap-or-else` implied by `-D warnings` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:122:13 + --> examples/methods.rs:122:13 | 122 | let _ = opt.map(|x| x + 1) | _____________^ @@ -141,24 +116,19 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo 125 | | ); | |_________________^ | - = note: #[deny(option_map_unwrap_or_else)] implied by #[deny(clippy_pedantic)] + = note: `-D option-map-unwrap-or-else` implied by `-D warnings` error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> $DIR/methods.rs:194:13 + --> examples/methods.rs:194:13 | 194 | let _ = v.iter().filter(|&x| *x < 0).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(filter_next)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D filter-next` implied by `-D warnings` = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)` error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> $DIR/methods.rs:197:13 + --> examples/methods.rs:197:13 | 197 | let _ = v.iter().filter(|&x| { | _____________^ @@ -167,24 +137,19 @@ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expre 200 | | ).next(); | |___________________________^ | - = note: #[deny(filter_next)] implied by #[deny(clippy)] + = note: `-D filter-next` implied by `-D warnings` error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:212:13 + --> examples/methods.rs:212:13 | 212 | let _ = v.iter().find(|&x| *x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(search_is_some)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D search-is-some` implied by `-D warnings` = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)` error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:215:13 + --> examples/methods.rs:215:13 | 215 | let _ = v.iter().find(|&x| { | _____________^ @@ -193,19 +158,19 @@ error: called `is_some()` after searching an `Iterator` with find. This is more 218 | | ).is_some(); | |______________________________^ | - = note: #[deny(search_is_some)] implied by #[deny(clippy)] + = note: `-D search-is-some` implied by `-D warnings` error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:221:13 + --> examples/methods.rs:221:13 | 221 | let _ = v.iter().position(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(search_is_some)] implied by #[deny(clippy)] + = note: `-D search-is-some` implied by `-D warnings` = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:224:13 + --> examples/methods.rs:224:13 | 224 | let _ = v.iter().position(|&x| { | _____________^ @@ -214,19 +179,19 @@ error: called `is_some()` after searching an `Iterator` with position. This is m 227 | | ).is_some(); | |______________________________^ | - = note: #[deny(search_is_some)] implied by #[deny(clippy)] + = note: `-D search-is-some` implied by `-D warnings` error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:230:13 + --> examples/methods.rs:230:13 | 230 | let _ = v.iter().rposition(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(search_is_some)] implied by #[deny(clippy)] + = note: `-D search-is-some` implied by `-D warnings` = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:233:13 + --> examples/methods.rs:233:13 | 233 | let _ = v.iter().rposition(|&x| { | _____________^ @@ -235,635 +200,568 @@ error: called `is_some()` after searching an `Iterator` with rposition. This is 236 | | ).is_some(); | |______________________________^ | - = note: #[deny(search_is_some)] implied by #[deny(clippy)] + = note: `-D search-is-some` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:268:5 + --> examples/methods.rs:268:5 | 268 | with_constructor.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_constructor.unwrap_or_else(make)` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `new` - --> $DIR/methods.rs:271:5 + --> examples/methods.rs:271:5 | 271 | with_new.unwrap_or(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_new.unwrap_or_default()` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:274:5 + --> examples/methods.rs:274:5 | 274 | with_const_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_const_args.unwrap_or_else(|| Vec::with_capacity(12))` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:277:5 + --> examples/methods.rs:277:5 | 277 | with_err.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_err.unwrap_or_else(|_| make())` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:280:5 + --> examples/methods.rs:280:5 | 280 | with_err_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_err_args.unwrap_or_else(|_| Vec::with_capacity(12))` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `default` - --> $DIR/methods.rs:283:5 + --> examples/methods.rs:283:5 | 283 | with_default_trait.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_default_trait.unwrap_or_default()` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `default` - --> $DIR/methods.rs:286:5 + --> examples/methods.rs:286:5 | 286 | with_default_type.unwrap_or(u64::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_default_type.unwrap_or_default()` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:289:5 + --> examples/methods.rs:289:5 | 289 | with_vec.unwrap_or(vec![]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:294:5 + --> examples/methods.rs:294:5 | 294 | without_default.unwrap_or(Foo::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `without_default.unwrap_or_else(Foo::new)` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `or_insert` followed by a function call - --> $DIR/methods.rs:297:5 + --> examples/methods.rs:297:5 | 297 | map.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `map.entry(42).or_insert_with(String::new)` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `or_insert` followed by a function call - --> $DIR/methods.rs:300:5 + --> examples/methods.rs:300:5 | 300 | btree.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `btree.entry(42).or_insert_with(String::new)` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:303:13 + --> examples/methods.rs:303:13 | 303 | let _ = stringy.unwrap_or("".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `stringy.unwrap_or_else(|| "".to_owned())` | - = note: #[deny(or_fun_call)] implied by #[deny(clippy)] + = note: `-D or-fun-call` implied by `-D warnings` error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:314:23 + --> examples/methods.rs:314:23 | 314 | let bad_vec = some_vec.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_nth)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:315:26 + --> examples/methods.rs:315:26 | 315 | let bad_slice = &some_vec[..].iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_nth)] implied by #[deny(clippy)] + = note: `-D iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:316:31 + --> examples/methods.rs:316:31 | 316 | let bad_boxed_slice = boxed_slice.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_nth)] implied by #[deny(clippy)] + = note: `-D iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:317:29 + --> examples/methods.rs:317:29 | 317 | let bad_vec_deque = some_vec_deque.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_nth)] implied by #[deny(clippy)] + = note: `-D iter-nth` implied by `-D warnings` error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:322:23 + --> examples/methods.rs:322:23 | 322 | let bad_vec = some_vec.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_nth)] implied by #[deny(clippy)] + = note: `-D iter-nth` implied by `-D warnings` error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:325:26 + --> examples/methods.rs:325:26 | 325 | let bad_slice = &some_vec[..].iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_nth)] implied by #[deny(clippy)] + = note: `-D iter-nth` implied by `-D warnings` error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:328:29 + --> examples/methods.rs:328:29 | 328 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_nth)] implied by #[deny(clippy)] + = note: `-D iter-nth` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:340:13 + --> examples/methods.rs:340:13 | 340 | let _ = some_vec.iter().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_skip_next)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:341:13 + --> examples/methods.rs:341:13 | 341 | let _ = some_vec.iter().cycle().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_skip_next)] implied by #[deny(clippy)] + = note: `-D iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:342:13 + --> examples/methods.rs:342:13 | 342 | let _ = (1..10).skip(10).next(); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_skip_next)] implied by #[deny(clippy)] + = note: `-D iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:343:14 + --> examples/methods.rs:343:14 | 343 | let _ = &some_vec[..].iter().skip(3).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_skip_next)] implied by #[deny(clippy)] + = note: `-D iter-skip-next` implied by `-D warnings` error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise - --> $DIR/methods.rs:369:17 + --> examples/methods.rs:369:17 | 369 | let _ = boxed_slice.get(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&boxed_slice[1]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise - --> $DIR/methods.rs:370:17 + --> examples/methods.rs:370:17 | 370 | let _ = some_slice.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_slice[0]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> $DIR/methods.rs:371:17 + --> examples/methods.rs:371:17 | 371 | let _ = some_vec.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_vec[0]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise - --> $DIR/methods.rs:372:17 + --> examples/methods.rs:372:17 | 372 | let _ = some_vecdeque.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_vecdeque[0]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise - --> $DIR/methods.rs:373:17 + --> examples/methods.rs:373:17 | 373 | let _ = some_hashmap.get(&1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_hashmap[&1]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise - --> $DIR/methods.rs:374:17 + --> examples/methods.rs:374:17 | 374 | let _ = some_btreemap.get(&1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_btreemap[&1]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise - --> $DIR/methods.rs:379:10 + --> examples/methods.rs:379:10 | 379 | *boxed_slice.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut boxed_slice[0]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise - --> $DIR/methods.rs:380:10 + --> examples/methods.rs:380:10 | 380 | *some_slice.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_slice[0]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> $DIR/methods.rs:381:10 + --> examples/methods.rs:381:10 | 381 | *some_vec.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_vec[0]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise - --> $DIR/methods.rs:382:10 + --> examples/methods.rs:382:10 | 382 | *some_vecdeque.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_vecdeque[0]` | - = note: #[deny(get_unwrap)] implied by #[deny(clippy)] + = note: `-D get-unwrap` implied by `-D warnings` error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message - --> $DIR/methods.rs:396:13 + --> examples/methods.rs:396:13 | 396 | let _ = opt.unwrap(); | ^^^^^^^^^^^^ | - = note: #[deny(option_unwrap_used)] implied by #[deny(clippy_pedantic)] -note: lint level defined here - --> $DIR/methods.rs:5:17 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^^^^^^^^^^ + = note: `-D option-unwrap-used` implied by `-D warnings` error: used unwrap() on a Result value. If you don't want to handle the Err case gracefully, consider using expect() to provide a better panic message - --> $DIR/methods.rs:399:13 + --> examples/methods.rs:399:13 | 399 | let _ = res.unwrap(); | ^^^^^^^^^^^^ | - = note: #[deny(result_unwrap_used)] implied by #[deny(clippy_pedantic)] -note: lint level defined here - --> $DIR/methods.rs:5:17 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^^^^^^^^^^ + = note: `-D result-unwrap-used` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/methods.rs:401:5 + --> examples/methods.rs:401:5 | 401 | res.ok().expect("disaster!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(ok_expect)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/methods.rs:407:5 + --> examples/methods.rs:407:5 | 407 | res3.ok().expect("whoof"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(ok_expect)] implied by #[deny(clippy)] + = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/methods.rs:409:5 + --> examples/methods.rs:409:5 | 409 | res4.ok().expect("argh"); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(ok_expect)] implied by #[deny(clippy)] + = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/methods.rs:411:5 + --> examples/methods.rs:411:5 | 411 | res5.ok().expect("oops"); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(ok_expect)] implied by #[deny(clippy)] + = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/methods.rs:413:5 + --> examples/methods.rs:413:5 | 413 | res6.ok().expect("meh"); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(ok_expect)] implied by #[deny(clippy)] + = note: `-D ok-expect` implied by `-D warnings` error: you should use the `starts_with` method - --> $DIR/methods.rs:425:5 + --> examples/methods.rs:425:5 | 425 | "".chars().next() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this `"".starts_with(' ')` | - = note: #[deny(chars_next_cmp)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D chars-next-cmp` implied by `-D warnings` error: you should use the `starts_with` method - --> $DIR/methods.rs:426:5 + --> examples/methods.rs:426:5 | 426 | Some(' ') != "".chars().next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this `!"".starts_with(' ')` | - = note: #[deny(chars_next_cmp)] implied by #[deny(clippy)] + = note: `-D chars-next-cmp` implied by `-D warnings` error: calling `.extend(_.chars())` - --> $DIR/methods.rs:435:5 + --> examples/methods.rs:435:5 | 435 | s.extend(abc.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str(abc)` | - = note: #[deny(string_extend_chars)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D string-extend-chars` implied by `-D warnings` error: calling `.extend(_.chars())` - --> $DIR/methods.rs:438:5 + --> examples/methods.rs:438:5 | 438 | s.extend("abc".chars()); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str("abc")` | - = note: #[deny(string_extend_chars)] implied by #[deny(clippy)] + = note: `-D string-extend-chars` implied by `-D warnings` error: calling `.extend(_.chars())` - --> $DIR/methods.rs:441:5 + --> examples/methods.rs:441:5 | 441 | s.extend(def.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str(&def)` | - = note: #[deny(string_extend_chars)] implied by #[deny(clippy)] + = note: `-D string-extend-chars` implied by `-D warnings` error: using `clone` on a `Copy` type - --> $DIR/methods.rs:452:5 + --> examples/methods.rs:452:5 | 452 | 42.clone(); | ^^^^^^^^^^ help: try removing the `clone` call `42` | - = note: #[deny(clone_on_copy)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> $DIR/methods.rs:456:5 + --> examples/methods.rs:456:5 | 456 | (&42).clone(); | ^^^^^^^^^^^^^ help: try dereferencing it `*(&42)` | - = note: #[deny(clone_on_copy)] implied by #[deny(clippy)] + = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> $DIR/methods.rs:460:5 + --> examples/methods.rs:460:5 | 460 | t.clone(); | ^^^^^^^^^ help: try removing the `clone` call `t` | - = note: #[deny(clone_on_copy)] implied by #[deny(clippy)] + = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> $DIR/methods.rs:462:5 + --> examples/methods.rs:462:5 | 462 | Some(t).clone(); | ^^^^^^^^^^^^^^^ help: try removing the `clone` call `Some(t)` | - = note: #[deny(clone_on_copy)] implied by #[deny(clippy)] + = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type - --> $DIR/methods.rs:468:22 + --> examples/methods.rs:468:22 | 468 | let z: &Vec<_> = y.clone(); | ^^^^^^^^^ help: try dereferencing it `(*y).clone()` | - = note: #[deny(clone_double_ref)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D clone-double-ref` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:475:13 + --> examples/methods.rs:475:13 | 475 | x.split("x"); | --------^^^- help: try using a char instead: `x.split('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:492:16 + --> examples/methods.rs:492:16 | 492 | x.contains("x"); | -----------^^^- help: try using a char instead: `x.contains('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:493:19 + --> examples/methods.rs:493:19 | 493 | x.starts_with("x"); | --------------^^^- help: try using a char instead: `x.starts_with('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:494:17 + --> examples/methods.rs:494:17 | 494 | x.ends_with("x"); | ------------^^^- help: try using a char instead: `x.ends_with('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:495:12 + --> examples/methods.rs:495:12 | 495 | x.find("x"); | -------^^^- help: try using a char instead: `x.find('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:496:13 + --> examples/methods.rs:496:13 | 496 | x.rfind("x"); | --------^^^- help: try using a char instead: `x.rfind('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:497:14 + --> examples/methods.rs:497:14 | 497 | x.rsplit("x"); | ---------^^^- help: try using a char instead: `x.rsplit('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:498:24 + --> examples/methods.rs:498:24 | 498 | x.split_terminator("x"); | -------------------^^^- help: try using a char instead: `x.split_terminator('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:499:25 + --> examples/methods.rs:499:25 | 499 | x.rsplit_terminator("x"); | --------------------^^^- help: try using a char instead: `x.rsplit_terminator('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:500:17 + --> examples/methods.rs:500:17 | 500 | x.splitn(0, "x"); | ------------^^^- help: try using a char instead: `x.splitn(0, 'x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:501:18 + --> examples/methods.rs:501:18 | 501 | x.rsplitn(0, "x"); | -------------^^^- help: try using a char instead: `x.rsplitn(0, 'x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:502:15 + --> examples/methods.rs:502:15 | 502 | x.matches("x"); | ----------^^^- help: try using a char instead: `x.matches('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:503:16 + --> examples/methods.rs:503:16 | 503 | x.rmatches("x"); | -----------^^^- help: try using a char instead: `x.rmatches('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:504:21 + --> examples/methods.rs:504:21 | 504 | x.match_indices("x"); | ----------------^^^- help: try using a char instead: `x.match_indices('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:505:22 + --> examples/methods.rs:505:22 | 505 | x.rmatch_indices("x"); | -----------------^^^- help: try using a char instead: `x.rmatch_indices('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:506:25 + --> examples/methods.rs:506:25 | 506 | x.trim_left_matches("x"); | --------------------^^^- help: try using a char instead: `x.trim_left_matches('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/methods.rs:507:26 + --> examples/methods.rs:507:26 | 507 | x.trim_right_matches("x"); | ---------------------^^^- help: try using a char instead: `x.trim_right_matches('x')` | - = note: #[deny(single_char_pattern)] implied by #[deny(clippy)] + = note: `-D single-char-pattern` implied by `-D warnings` error: you are getting the inner pointer of a temporary `CString` - --> $DIR/methods.rs:517:5 + --> examples/methods.rs:517:5 | 517 | CString::new("foo").unwrap().as_ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(temporary_cstring_as_ptr)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D temporary-cstring-as-ptr` implied by `-D warnings` = note: that pointer will be invalid outside this expression help: assign the `CString` to a variable to extend its lifetime - --> $DIR/methods.rs:517:5 + --> examples/methods.rs:517:5 | 517 | CString::new("foo").unwrap().as_ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable - --> $DIR/methods.rs:522:27 + --> examples/methods.rs:522:27 | 522 | let v2 : Vec = v.iter().cloned().collect(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(iter_cloned_collect)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/methods.rs:5:9 - | -5 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^ + = note: `-D iter-cloned-collect` implied by `-D warnings` error: aborting due to 89 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/min_max.rs b/clippy_tests/examples/min_max.rs similarity index 97% rename from tests/ui/min_max.rs rename to clippy_tests/examples/min_max.rs index d74e5273263..9a077eae4d9 100644 --- a/tests/ui/min_max.rs +++ b/clippy_tests/examples/min_max.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] use std::cmp::{min, max}; use std::cmp::min as my_min; diff --git a/tests/ui/min_max.stderr b/clippy_tests/examples/min_max.stderr similarity index 58% rename from tests/ui/min_max.stderr rename to clippy_tests/examples/min_max.stderr index 1170373ab98..9df1aa7fa83 100644 --- a/tests/ui/min_max.stderr +++ b/clippy_tests/examples/min_max.stderr @@ -1,63 +1,61 @@ error: this min/max combination leads to constant result - --> $DIR/min_max.rs:15:5 + --> examples/min_max.rs:15:5 | 15 | min(1, max(3, x)); | ^^^^^^^^^^^^^^^^^ | - = note: #[deny(min_max)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/min_max.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ + = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> $DIR/min_max.rs:16:5 + --> examples/min_max.rs:16:5 | 16 | min(max(3, x), 1); | ^^^^^^^^^^^^^^^^^ | - = note: #[deny(min_max)] implied by #[deny(clippy)] + = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> $DIR/min_max.rs:17:5 + --> examples/min_max.rs:17:5 | 17 | max(min(x, 1), 3); | ^^^^^^^^^^^^^^^^^ | - = note: #[deny(min_max)] implied by #[deny(clippy)] + = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> $DIR/min_max.rs:18:5 + --> examples/min_max.rs:18:5 | 18 | max(3, min(x, 1)); | ^^^^^^^^^^^^^^^^^ | - = note: #[deny(min_max)] implied by #[deny(clippy)] + = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> $DIR/min_max.rs:20:5 + --> examples/min_max.rs:20:5 | 20 | my_max(3, my_min(x, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(min_max)] implied by #[deny(clippy)] + = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> $DIR/min_max.rs:29:5 + --> examples/min_max.rs:29:5 | 29 | min("Apple", max("Zoo", s)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(min_max)] implied by #[deny(clippy)] + = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> $DIR/min_max.rs:30:5 + --> examples/min_max.rs:30:5 | 30 | max(min(s, "Apple"), "Zoo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(min_max)] implied by #[deny(clippy)] + = note: `-D min-max` 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. diff --git a/tests/ui/missing-doc.rs b/clippy_tests/examples/missing-doc.rs similarity index 98% rename from tests/ui/missing-doc.rs rename to clippy_tests/examples/missing-doc.rs index cd69ef1b08e..596cec886f4 100644 --- a/tests/ui/missing-doc.rs +++ b/clippy_tests/examples/missing-doc.rs @@ -13,7 +13,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(missing_docs_in_private_items)] +#![warn(missing_docs_in_private_items)] // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. diff --git a/tests/ui/missing-doc.stderr b/clippy_tests/examples/missing-doc.stderr similarity index 50% rename from tests/ui/missing-doc.stderr rename to clippy_tests/examples/missing-doc.stderr index 3e1e7b0135e..8e032b0c3cb 100644 --- a/tests/ui/missing-doc.stderr +++ b/clippy_tests/examples/missing-doc.stderr @@ -1,146 +1,182 @@ error: missing documentation for a type alias - --> $DIR/missing-doc.rs:26:1 + --> examples/missing-doc.rs:26:1 | 26 | type Typedef = String; | ^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/missing-doc.rs:16:9 - | -16 | #![deny(missing_docs_in_private_items)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a type alias - --> $DIR/missing-doc.rs:27:1 + --> examples/missing-doc.rs:27:1 | 27 | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct - --> $DIR/missing-doc.rs:29:1 + --> examples/missing-doc.rs:29:1 | 29 | / struct Foo { 30 | | a: isize, 31 | | b: isize, 32 | | } | |_^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> $DIR/missing-doc.rs:30:5 + --> examples/missing-doc.rs:30:5 | 30 | a: isize, | ^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> $DIR/missing-doc.rs:31:5 + --> examples/missing-doc.rs:31:5 | 31 | b: isize, | ^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct - --> $DIR/missing-doc.rs:34:1 + --> examples/missing-doc.rs:34:1 | 34 | / pub struct PubFoo { 35 | | pub a: isize, 36 | | b: isize, 37 | | } | |_^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> $DIR/missing-doc.rs:35:5 + --> examples/missing-doc.rs:35:5 | 35 | pub a: isize, | ^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> $DIR/missing-doc.rs:36:5 + --> examples/missing-doc.rs:36:5 | 36 | b: isize, | ^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a module - --> $DIR/missing-doc.rs:45:1 + --> examples/missing-doc.rs:45:1 | 45 | mod module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a module - --> $DIR/missing-doc.rs:46:1 + --> examples/missing-doc.rs:46:1 | 46 | pub mod pub_module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> $DIR/missing-doc.rs:50:1 + --> examples/missing-doc.rs:50:1 | 50 | pub fn foo2() {} | ^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> $DIR/missing-doc.rs:51:1 + --> examples/missing-doc.rs:51:1 | 51 | fn foo3() {} | ^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a trait - --> $DIR/missing-doc.rs:68:1 + --> examples/missing-doc.rs:68:1 | 68 | / pub trait C { 69 | | fn foo(&self); 70 | | fn foo_with_impl(&self) {} 71 | | } | |_^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a trait method - --> $DIR/missing-doc.rs:69:5 + --> examples/missing-doc.rs:69:5 | 69 | fn foo(&self); | ^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a trait method - --> $DIR/missing-doc.rs:70:5 + --> examples/missing-doc.rs:70:5 | 70 | fn foo_with_impl(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for an associated type - --> $DIR/missing-doc.rs:80:5 + --> examples/missing-doc.rs:80:5 | 80 | type AssociatedType; | ^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for an associated type - --> $DIR/missing-doc.rs:81:5 + --> examples/missing-doc.rs:81:5 | 81 | type AssociatedTypeDef = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a method - --> $DIR/missing-doc.rs:92:5 + --> examples/missing-doc.rs:92:5 | 92 | pub fn foo() {} | ^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a method - --> $DIR/missing-doc.rs:93:5 + --> examples/missing-doc.rs:93:5 | 93 | fn bar() {} | ^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a method - --> $DIR/missing-doc.rs:97:5 + --> examples/missing-doc.rs:97:5 | 97 | pub fn foo() {} | ^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a method - --> $DIR/missing-doc.rs:100:5 + --> examples/missing-doc.rs:100:5 | 100 | fn foo2() {} | ^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for an enum - --> $DIR/missing-doc.rs:126:1 + --> examples/missing-doc.rs:126:1 | 126 | / enum Baz { 127 | | BazA { @@ -150,36 +186,46 @@ error: missing documentation for an enum 131 | | BarB 132 | | } | |_^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a variant - --> $DIR/missing-doc.rs:127:5 + --> examples/missing-doc.rs:127:5 | 127 | / BazA { 128 | | a: isize, 129 | | b: isize 130 | | }, | |_____^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> $DIR/missing-doc.rs:128:9 + --> examples/missing-doc.rs:128:9 | 128 | a: isize, | ^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> $DIR/missing-doc.rs:129:9 + --> examples/missing-doc.rs:129:9 | 129 | b: isize | ^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a variant - --> $DIR/missing-doc.rs:131:5 + --> examples/missing-doc.rs:131:5 | 131 | BarB | ^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for an enum - --> $DIR/missing-doc.rs:134:1 + --> examples/missing-doc.rs:134:1 | 134 | / pub enum PubBaz { 135 | | PubBazA { @@ -187,47 +233,61 @@ error: missing documentation for an enum 137 | | }, 138 | | } | |_^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a variant - --> $DIR/missing-doc.rs:135:5 + --> examples/missing-doc.rs:135:5 | 135 | / PubBazA { 136 | | a: isize, 137 | | }, | |_____^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> $DIR/missing-doc.rs:136:9 + --> examples/missing-doc.rs:136:9 | 136 | a: isize, | ^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a constant - --> $DIR/missing-doc.rs:160:1 + --> examples/missing-doc.rs:160:1 | 160 | const FOO: u32 = 0; | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a constant - --> $DIR/missing-doc.rs:167:1 + --> examples/missing-doc.rs:167:1 | 167 | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a static - --> $DIR/missing-doc.rs:170:1 + --> examples/missing-doc.rs:170:1 | 170 | static BAR: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a static - --> $DIR/missing-doc.rs:177:1 + --> examples/missing-doc.rs:177:1 | 177 | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a module - --> $DIR/missing-doc.rs:180:1 + --> examples/missing-doc.rs:180:1 | 180 | / mod internal_impl { 181 | | /// dox @@ -237,42 +297,59 @@ error: missing documentation for a module 192 | | } 193 | | } | |_^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> $DIR/missing-doc.rs:183:5 + --> examples/missing-doc.rs:183:5 | 183 | pub fn undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> $DIR/missing-doc.rs:184:5 + --> examples/missing-doc.rs:184:5 | 184 | pub fn undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> $DIR/missing-doc.rs:185:5 + --> examples/missing-doc.rs:185:5 | 185 | fn undocumented3() {} | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> $DIR/missing-doc.rs:190:9 + --> examples/missing-doc.rs:190:9 | 190 | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> $DIR/missing-doc.rs:191:9 + --> examples/missing-doc.rs:191:9 | 191 | fn also_undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> $DIR/missing-doc.rs:202:1 + --> examples/missing-doc.rs:202:1 | 202 | fn main() {} | ^^^^^^^^^^^^ + | + = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: aborting due to 40 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/module_inception.rs b/clippy_tests/examples/module_inception.rs similarity index 92% rename from tests/ui/module_inception.rs rename to clippy_tests/examples/module_inception.rs index f102057c1da..c1dd7958fff 100644 --- a/tests/ui/module_inception.rs +++ b/clippy_tests/examples/module_inception.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(module_inception)] +#![warn(module_inception)] mod foo { mod bar { diff --git a/tests/ui/module_inception.stderr b/clippy_tests/examples/module_inception.stderr similarity index 52% rename from tests/ui/module_inception.stderr rename to clippy_tests/examples/module_inception.stderr index 44041eae000..00e406814ce 100644 --- a/tests/ui/module_inception.stderr +++ b/clippy_tests/examples/module_inception.stderr @@ -1,24 +1,25 @@ error: module has the same name as its containing module - --> $DIR/module_inception.rs:7:9 + --> examples/module_inception.rs:7:9 | 7 | / mod bar { 8 | | mod foo {} 9 | | } | |_________^ | -note: lint level defined here - --> $DIR/module_inception.rs:3:9 - | -3 | #![deny(module_inception)] - | ^^^^^^^^^^^^^^^^ + = note: `-D module-inception` implied by `-D warnings` error: module has the same name as its containing module - --> $DIR/module_inception.rs:12:5 + --> examples/module_inception.rs:12:5 | 12 | / mod foo { 13 | | mod bar {} 14 | | } | |_____^ + | + = note: `-D module-inception` 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. diff --git a/tests/ui/modulo_one.rs b/clippy_tests/examples/modulo_one.rs similarity index 85% rename from tests/ui/modulo_one.rs rename to clippy_tests/examples/modulo_one.rs index d9ab7492ead..cda3f190f1e 100644 --- a/tests/ui/modulo_one.rs +++ b/clippy_tests/examples/modulo_one.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(modulo_one)] +#![warn(modulo_one)] #![allow(no_effect, unnecessary_operation)] fn main() { diff --git a/clippy_tests/examples/modulo_one.stderr b/clippy_tests/examples/modulo_one.stderr new file mode 100644 index 00000000000..0596b99d38f --- /dev/null +++ b/clippy_tests/examples/modulo_one.stderr @@ -0,0 +1,13 @@ +error: any number modulo 1 will be 0 + --> examples/modulo_one.rs:7:5 + | +7 | 10 % 1; + | ^^^^^^ + | + = note: `-D modulo-one` 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. diff --git a/tests/ui/mut_from_ref.rs b/clippy_tests/examples/mut_from_ref.rs similarity index 97% rename from tests/ui/mut_from_ref.rs rename to clippy_tests/examples/mut_from_ref.rs index 35bff9371d9..55498bad759 100644 --- a/tests/ui/mut_from_ref.rs +++ b/clippy_tests/examples/mut_from_ref.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] #![allow(unused)] -#![deny(mut_from_ref)] +#![warn(mut_from_ref)] struct Foo; diff --git a/tests/ui/mut_from_ref.stderr b/clippy_tests/examples/mut_from_ref.stderr similarity index 67% rename from tests/ui/mut_from_ref.stderr rename to clippy_tests/examples/mut_from_ref.stderr index 5098d7d0ab5..8da32219a8f 100644 --- a/tests/ui/mut_from_ref.stderr +++ b/clippy_tests/examples/mut_from_ref.stderr @@ -1,67 +1,70 @@ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:9:39 + --> examples/mut_from_ref.rs:9:39 | 9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^^^^ | -note: lint level defined here - --> $DIR/mut_from_ref.rs:4:9 - | -4 | #![deny(mut_from_ref)] - | ^^^^^^^^^^^^ + = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> $DIR/mut_from_ref.rs:9:29 + --> examples/mut_from_ref.rs:9:29 | 9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:15:25 + --> examples/mut_from_ref.rs:15:25 | 15 | fn ouch(x: &Foo) -> &mut Foo; | ^^^^^^^^ | + = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> $DIR/mut_from_ref.rs:15:16 + --> examples/mut_from_ref.rs:15:16 | 15 | fn ouch(x: &Foo) -> &mut Foo; | ^^^^ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:24:21 + --> examples/mut_from_ref.rs:24:21 | 24 | fn fail(x: &u32) -> &mut u16 { | ^^^^^^^^ | + = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> $DIR/mut_from_ref.rs:24:12 + --> examples/mut_from_ref.rs:24:12 | 24 | fn fail(x: &u32) -> &mut u16 { | ^^^^ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:28:50 + --> examples/mut_from_ref.rs:28:50 | 28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | + = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> $DIR/mut_from_ref.rs:28:25 + --> examples/mut_from_ref.rs:28:25 | 28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:32:67 + --> examples/mut_from_ref.rs:32:67 | 32 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | + = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> $DIR/mut_from_ref.rs:32:27 + --> examples/mut_from_ref.rs:32:27 | 32 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { | ^^^^^^^ ^^^^^^^ error: aborting due to 5 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/mut_mut.rs b/clippy_tests/examples/mut_mut.rs similarity index 98% rename from tests/ui/mut_mut.rs rename to clippy_tests/examples/mut_mut.rs index b938c822f95..766276bc417 100644 --- a/tests/ui/mut_mut.rs +++ b/clippy_tests/examples/mut_mut.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(unused, no_effect, unnecessary_operation)] -#![deny(mut_mut)] +#![warn(mut_mut)] //#![plugin(regex_macros)] //extern crate regex; diff --git a/tests/ui/mut_mut.stderr b/clippy_tests/examples/mut_mut.stderr similarity index 64% rename from tests/ui/mut_mut.stderr rename to clippy_tests/examples/mut_mut.stderr index 82120f583ef..7d4021a73fc 100644 --- a/tests/ui/mut_mut.stderr +++ b/clippy_tests/examples/mut_mut.stderr @@ -1,89 +1,112 @@ error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:10:12 + --> examples/mut_mut.rs:10:12 | 10 | fn fun(x : &mut &mut u32) -> bool { | ^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/mut_mut.rs:5:9 - | -5 | #![deny(mut_mut)] - | ^^^^^^^ + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:24:17 + --> examples/mut_mut.rs:24:17 | 24 | let mut x = &mut &mut 1u32; | ^^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:19:20 + --> examples/mut_mut.rs:19:20 | 19 | ($p:expr) => { &mut $p } | ^^^^^^^ ... 39 | let mut z = mut_ptr!(&mut 3u32); | ------------------- in this macro invocation + | + = note: `-D mut-mut` implied by `-D warnings` error: this expression mutably borrows a mutable reference. Consider reborrowing - --> $DIR/mut_mut.rs:26:21 + --> examples/mut_mut.rs:26:21 | 26 | let mut y = &mut x; | ^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:30:17 + --> examples/mut_mut.rs:30:17 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:30:33 + --> examples/mut_mut.rs:30:33 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:30:17 + --> examples/mut_mut.rs:30:17 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:17 + --> examples/mut_mut.rs:35:17 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:22 + --> examples/mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:38 + --> examples/mut_mut.rs:35:38 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:17 + --> examples/mut_mut.rs:35:17 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:22 + --> examples/mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:22 + --> examples/mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ + | + = note: `-D mut-mut` implied by `-D warnings` error: aborting due to 13 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/mut_reference.rs b/clippy_tests/examples/mut_reference.rs similarity index 97% rename from tests/ui/mut_reference.rs rename to clippy_tests/examples/mut_reference.rs index a3b9a965ec4..d746fc5e529 100644 --- a/tests/ui/mut_reference.rs +++ b/clippy_tests/examples/mut_reference.rs @@ -16,7 +16,7 @@ impl MyStruct { } } -#[deny(unnecessary_mut_passed)] +#[warn(unnecessary_mut_passed)] fn main() { // Functions takes_an_immutable_reference(&mut 42); diff --git a/tests/ui/mut_reference.stderr b/clippy_tests/examples/mut_reference.stderr similarity index 58% rename from tests/ui/mut_reference.stderr rename to clippy_tests/examples/mut_reference.stderr index f4c2b60746e..6f616d53c21 100644 --- a/tests/ui/mut_reference.stderr +++ b/clippy_tests/examples/mut_reference.stderr @@ -1,26 +1,29 @@ error: The function/method "takes_an_immutable_reference" doesn't need a mutable reference - --> $DIR/mut_reference.rs:22:34 + --> examples/mut_reference.rs:22:34 | 22 | takes_an_immutable_reference(&mut 42); | ^^^^^^^ | -note: lint level defined here - --> $DIR/mut_reference.rs:19:8 - | -19 | #[deny(unnecessary_mut_passed)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D unnecessary-mut-passed` implied by `-D warnings` error: The function/method "as_ptr" doesn't need a mutable reference - --> $DIR/mut_reference.rs:24:12 + --> examples/mut_reference.rs:24:12 | 24 | as_ptr(&mut 42); | ^^^^^^^ + | + = note: `-D unnecessary-mut-passed` implied by `-D warnings` error: The function/method "takes_an_immutable_reference" doesn't need a mutable reference - --> $DIR/mut_reference.rs:28:44 + --> examples/mut_reference.rs:28:44 | 28 | my_struct.takes_an_immutable_reference(&mut 42); | ^^^^^^^ + | + = note: `-D unnecessary-mut-passed` 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. diff --git a/tests/ui/mutex_atomic.rs b/clippy_tests/examples/mutex_atomic.rs similarity index 89% rename from tests/ui/mutex_atomic.rs rename to clippy_tests/examples/mutex_atomic.rs index 5a5289c2cf4..b84ece497eb 100644 --- a/tests/ui/mutex_atomic.rs +++ b/clippy_tests/examples/mutex_atomic.rs @@ -1,8 +1,8 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] -#![deny(mutex_integer)] +#![warn(clippy)] +#![warn(mutex_integer)] fn main() { use std::sync::Mutex; diff --git a/tests/ui/mutex_atomic.stderr b/clippy_tests/examples/mutex_atomic.stderr similarity index 68% rename from tests/ui/mutex_atomic.stderr rename to clippy_tests/examples/mutex_atomic.stderr index 6a61c42cbe2..6f770704370 100644 --- a/tests/ui/mutex_atomic.stderr +++ b/clippy_tests/examples/mutex_atomic.stderr @@ -1,65 +1,61 @@ error: Consider using an AtomicBool instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:9:5 + --> examples/mutex_atomic.rs:9:5 | 9 | Mutex::new(true); | ^^^^^^^^^^^^^^^^ | - = note: #[deny(mutex_atomic)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/mutex_atomic.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ + = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicUsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:10:5 + --> examples/mutex_atomic.rs:10:5 | 10 | Mutex::new(5usize); | ^^^^^^^^^^^^^^^^^^ | - = note: #[deny(mutex_atomic)] implied by #[deny(clippy)] + = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicIsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:11:5 + --> examples/mutex_atomic.rs:11:5 | 11 | Mutex::new(9isize); | ^^^^^^^^^^^^^^^^^^ | - = note: #[deny(mutex_atomic)] implied by #[deny(clippy)] + = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicPtr instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:13:5 + --> examples/mutex_atomic.rs:13:5 | 13 | Mutex::new(&x as *const u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(mutex_atomic)] implied by #[deny(clippy)] + = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicPtr instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:14:5 + --> examples/mutex_atomic.rs:14:5 | 14 | Mutex::new(&mut x as *mut u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(mutex_atomic)] implied by #[deny(clippy)] + = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicUsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:15:5 + --> examples/mutex_atomic.rs:15:5 | 15 | Mutex::new(0u32); | ^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/mutex_atomic.rs:5:9 - | -5 | #![deny(mutex_integer)] - | ^^^^^^^^^^^^^ + = note: `-D mutex-integer` implied by `-D warnings` error: Consider using an AtomicIsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:16:5 + --> examples/mutex_atomic.rs:16:5 | 16 | Mutex::new(0i32); | ^^^^^^^^^^^^^^^^ + | + = note: `-D mutex-integer` 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. diff --git a/tests/ui/needless_bool.rs b/clippy_tests/examples/needless_bool.rs similarity index 98% rename from tests/ui/needless_bool.rs rename to clippy_tests/examples/needless_bool.rs index d2b0e76f6e1..bd44332a170 100644 --- a/tests/ui/needless_bool.rs +++ b/clippy_tests/examples/needless_bool.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(needless_bool)] +#![warn(needless_bool)] #[allow(if_same_then_else)] fn main() { diff --git a/tests/ui/needless_bool.stderr b/clippy_tests/examples/needless_bool.stderr similarity index 64% rename from tests/ui/needless_bool.stderr rename to clippy_tests/examples/needless_bool.stderr index edf596c2ec9..c29e04ff504 100644 --- a/tests/ui/needless_bool.stderr +++ b/clippy_tests/examples/needless_bool.stderr @@ -1,74 +1,93 @@ error: this if-then-else expression will always return true - --> $DIR/needless_bool.rs:9:5 + --> examples/needless_bool.rs:9:5 | 9 | if x { true } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/needless_bool.rs:3:9 - | -3 | #![deny(needless_bool)] - | ^^^^^^^^^^^^^ + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression will always return false - --> $DIR/needless_bool.rs:10:5 + --> examples/needless_bool.rs:10:5 | 10 | if x { false } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:11:5 + --> examples/needless_bool.rs:11:5 | 11 | if x { true } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `x` + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:12:5 + --> examples/needless_bool.rs:12:5 | 12 | if x { false } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `!x` + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:13:5 + --> examples/needless_bool.rs:13:5 | 13 | if x && y { false } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `!(x && y)` + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression will always return true - --> $DIR/needless_bool.rs:25:5 + --> examples/needless_bool.rs:25:5 | 25 | if x { return true } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression will always return false - --> $DIR/needless_bool.rs:30:5 + --> examples/needless_bool.rs:30:5 | 30 | if x { return false } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:35:5 + --> examples/needless_bool.rs:35:5 | 35 | if x { return true } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return x` + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:40:5 + --> examples/needless_bool.rs:40:5 | 40 | if x && y { return true } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return x && y` + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:45:5 + --> examples/needless_bool.rs:45:5 | 45 | if x { return false } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return !x` + | + = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:50:5 + --> examples/needless_bool.rs:50:5 | 50 | if x && y { return false } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return !(x && y)` + | + = note: `-D needless-bool` 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. diff --git a/tests/ui/needless_borrow.rs b/clippy_tests/examples/needless_borrow.rs similarity index 98% rename from tests/ui/needless_borrow.rs rename to clippy_tests/examples/needless_borrow.rs index 27ee4d1f696..23d935e7df8 100644 --- a/tests/ui/needless_borrow.rs +++ b/clippy_tests/examples/needless_borrow.rs @@ -5,7 +5,7 @@ fn x(y: &i32) -> i32 { *y } -#[deny(clippy)] +#[warn(clippy)] #[allow(unused_variables)] fn main() { let a = 5; diff --git a/clippy_tests/examples/needless_borrow.stderr b/clippy_tests/examples/needless_borrow.stderr new file mode 100644 index 00000000000..3fead935a19 --- /dev/null +++ b/clippy_tests/examples/needless_borrow.stderr @@ -0,0 +1,37 @@ +error: this expression borrows a reference that is immediately dereferenced by the compiler + --> examples/needless_borrow.rs:13:15 + | +13 | let c = x(&&a); + | ^^^ + | + = note: `-D needless-borrow` implied by `-D warnings` + +error: this pattern creates a reference to a reference + --> examples/needless_borrow.rs:20:17 + | +20 | if let Some(ref cake) = Some(&5) {} + | ^^^^^^^^ + | + = note: `-D needless-borrow` implied by `-D warnings` + +error: this expression borrows a reference that is immediately dereferenced by the compiler + --> examples/needless_borrow.rs:27:15 + | +27 | 46 => &&a, + | ^^^ + | + = note: `-D needless-borrow` implied by `-D warnings` + +error: this pattern creates a reference to a reference + --> examples/needless_borrow.rs:50:31 + | +50 | let _ = v.iter().filter(|&ref a| a.is_empty()); + | ^^^^^ + | + = note: `-D needless-borrow` 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. diff --git a/tests/ui/needless_continue.rs b/clippy_tests/examples/needless_continue.rs similarity index 97% rename from tests/ui/needless_continue.rs rename to clippy_tests/examples/needless_continue.rs index b6f9513be44..6710867077d 100644 --- a/tests/ui/needless_continue.rs +++ b/clippy_tests/examples/needless_continue.rs @@ -9,7 +9,7 @@ macro_rules! nonzero { ($x:expr) => (!zero!($x)); } -#[deny(needless_continue)] +#[warn(needless_continue)] fn main() { let mut i = 1; while i < 10 { diff --git a/tests/ui/needless_continue.stderr b/clippy_tests/examples/needless_continue.stderr similarity index 84% rename from tests/ui/needless_continue.stderr rename to clippy_tests/examples/needless_continue.stderr index 50be062a67b..b1e6c6b0196 100644 --- a/tests/ui/needless_continue.stderr +++ b/clippy_tests/examples/needless_continue.stderr @@ -1,6 +1,6 @@ error: This else block is redundant. - --> $DIR/needless_continue.rs:26:16 + --> examples/needless_continue.rs:26:16 | 26 | } else { | ________________^ @@ -8,11 +8,7 @@ error: This else block is redundant. 28 | | } | |_________^ | -note: lint level defined here - --> $DIR/needless_continue.rs:12:8 - | -12 | #[deny(needless_continue)] - | ^^^^^^^^^^^^^^^^^ + = 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 i % 2 == 0 && i % 3 == 0 { println!("{}", i); @@ -41,7 +37,7 @@ note: lint level defined here error: There is no need for an explicit `else` block for this `if` expression - --> $DIR/needless_continue.rs:41:9 + --> examples/needless_continue.rs:41:9 | 41 | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 { 42 | | continue; @@ -51,6 +47,7 @@ error: There is no need for an explicit `else` block for this `if` expression 46 | | } | |_________^ | + = note: `-D needless-continue` implied by `-D warnings` = help: Consider dropping the else clause, and moving out the code in the else block, like so: if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 { continue; @@ -61,3 +58,6 @@ error: There is no need for an explicit `else` block for this `if` expression error: aborting due to 2 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/needless_pass_by_value.rs b/clippy_tests/examples/needless_pass_by_value.rs similarity index 97% rename from tests/ui/needless_pass_by_value.rs rename to clippy_tests/examples/needless_pass_by_value.rs index 5caf8017f96..ea97e875ff7 100644 --- a/tests/ui/needless_pass_by_value.rs +++ b/clippy_tests/examples/needless_pass_by_value.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(needless_pass_by_value)] +#![warn(needless_pass_by_value)] #![allow(dead_code, single_match, if_let_redundant_pattern_matching, many_single_char_names)] // `v` should be warned diff --git a/tests/ui/needless_pass_by_value.stderr b/clippy_tests/examples/needless_pass_by_value.stderr similarity index 69% rename from tests/ui/needless_pass_by_value.stderr rename to clippy_tests/examples/needless_pass_by_value.stderr index 6cc5149d183..702d6fa22ea 100644 --- a/tests/ui/needless_pass_by_value.stderr +++ b/clippy_tests/examples/needless_pass_by_value.stderr @@ -1,55 +1,61 @@ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:9:23 + --> examples/needless_pass_by_value.rs:9:23 | 9 | fn foo(v: Vec, w: Vec, mut x: Vec, y: Vec) -> Vec { | ^^^^^^ help: consider changing the type to `&[T]` | -note: lint level defined here - --> $DIR/needless_pass_by_value.rs:4:9 - | -4 | #![deny(needless_pass_by_value)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:23:11 + --> examples/needless_pass_by_value.rs:23:11 | 23 | fn bar(x: String, y: Wrapper) { | ^^^^^^ help: consider changing the type to `&str` + | + = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:23:22 + --> examples/needless_pass_by_value.rs:23:22 | 23 | fn bar(x: String, y: Wrapper) { | ^^^^^^^ help: consider taking a reference instead `&Wrapper` + | + = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:29:63 + --> examples/needless_pass_by_value.rs:29:63 | 29 | fn test_borrow_trait, U>(t: T, u: U) { | ^ help: consider taking a reference instead `&U` + | + = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:40:18 + --> examples/needless_pass_by_value.rs:40:18 | 40 | fn test_match(x: Option>, y: Option>) { | ^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D needless-pass-by-value` implied by `-D warnings` help: consider taking a reference instead | fn test_match(x: &Option>, y: Option>) { | match *x { error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:53:24 + --> examples/needless_pass_by_value.rs:53:24 | 53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ help: consider taking a reference instead `&Wrapper` + | + = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:53:36 + --> examples/needless_pass_by_value.rs:53:36 | 53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ | + = note: `-D needless-pass-by-value` implied by `-D warnings` help: consider taking a reference instead | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) { | let Wrapper(s) = z; // moved @@ -58,3 +64,6 @@ help: consider taking a reference instead error: aborting due to 7 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/needless_return.rs b/clippy_tests/examples/needless_return.rs similarity index 96% rename from tests/ui/needless_return.rs rename to clippy_tests/examples/needless_return.rs index d4c365ca510..403e5b8342e 100644 --- a/tests/ui/needless_return.rs +++ b/clippy_tests/examples/needless_return.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(needless_return)] +#![warn(needless_return)] fn test_end_of_fn() -> bool { if true { diff --git a/tests/ui/needless_return.stderr b/clippy_tests/examples/needless_return.stderr similarity index 55% rename from tests/ui/needless_return.stderr rename to clippy_tests/examples/needless_return.stderr index f4e386281f7..c45961fa46d 100644 --- a/tests/ui/needless_return.stderr +++ b/clippy_tests/examples/needless_return.stderr @@ -1,56 +1,69 @@ error: unneeded return statement - --> $DIR/needless_return.rs:11:5 + --> examples/needless_return.rs:11:5 | 11 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` | -note: lint level defined here - --> $DIR/needless_return.rs:4:9 - | -4 | #![deny(needless_return)] - | ^^^^^^^^^^^^^^^ + = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:15:5 + --> examples/needless_return.rs:15:5 | 15 | return true | ^^^^^^^^^^^ help: remove `return` as shown: `true` + | + = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:20:9 + --> examples/needless_return.rs:20:9 | 20 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | + = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:22:9 + --> examples/needless_return.rs:22:9 | 22 | return false; | ^^^^^^^^^^^^^ help: remove `return` as shown: `false` + | + = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:28:17 + --> examples/needless_return.rs:28:17 | 28 | true => return false, | ^^^^^^^^^^^^ help: remove `return` as shown: `false` + | + = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:30:13 + --> examples/needless_return.rs:30:13 | 30 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | + = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:37:9 + --> examples/needless_return.rs:37:9 | 37 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | + = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:39:16 + --> examples/needless_return.rs:39:16 | 39 | let _ = || return true; | ^^^^^^^^^^^ help: remove `return` as shown: `true` + | + = note: `-D needless-return` 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. diff --git a/tests/ui/needless_update.rs b/clippy_tests/examples/needless_update.rs similarity index 90% rename from tests/ui/needless_update.rs rename to clippy_tests/examples/needless_update.rs index a8eb232f060..99876121ae7 100644 --- a/tests/ui/needless_update.rs +++ b/clippy_tests/examples/needless_update.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(needless_update)] +#![warn(needless_update)] #![allow(no_effect)] struct S { diff --git a/tests/ui/needless_update.stderr b/clippy_tests/examples/needless_update.stderr similarity index 52% rename from tests/ui/needless_update.stderr rename to clippy_tests/examples/needless_update.stderr index ab1441508d4..ffca315bf64 100644 --- a/tests/ui/needless_update.stderr +++ b/clippy_tests/examples/needless_update.stderr @@ -1,14 +1,13 @@ error: struct update has no effect, all the fields in the struct have already been specified - --> $DIR/needless_update.rs:16:23 + --> examples/needless_update.rs:16:23 | 16 | S { a: 1, b: 1, ..base }; | ^^^^ | -note: lint level defined here - --> $DIR/needless_update.rs:4:9 - | -4 | #![deny(needless_update)] - | ^^^^^^^^^^^^^^^ + = note: `-D needless-update` 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. diff --git a/tests/ui/neg_multiply.rs b/clippy_tests/examples/neg_multiply.rs similarity index 95% rename from tests/ui/neg_multiply.rs rename to clippy_tests/examples/neg_multiply.rs index 9abbd417803..75dc7c381fd 100644 --- a/tests/ui/neg_multiply.rs +++ b/clippy_tests/examples/neg_multiply.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(neg_multiply)] +#![warn(neg_multiply)] #![allow(no_effect, unnecessary_operation)] use std::ops::Mul; diff --git a/clippy_tests/examples/neg_multiply.stderr b/clippy_tests/examples/neg_multiply.stderr new file mode 100644 index 00000000000..945613a47d3 --- /dev/null +++ b/clippy_tests/examples/neg_multiply.stderr @@ -0,0 +1,21 @@ +error: Negation by multiplying with -1 + --> examples/neg_multiply.rs:30:5 + | +30 | x * -1; + | ^^^^^^ + | + = note: `-D neg-multiply` implied by `-D warnings` + +error: Negation by multiplying with -1 + --> examples/neg_multiply.rs:32:5 + | +32 | -1 * x; + | ^^^^^^ + | + = note: `-D neg-multiply` 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. diff --git a/tests/ui/never_loop.rs b/clippy_tests/examples/never_loop.rs similarity index 95% rename from tests/ui/never_loop.rs rename to clippy_tests/examples/never_loop.rs index 087f1a1e6af..90dae2134d5 100644 --- a/tests/ui/never_loop.rs +++ b/clippy_tests/examples/never_loop.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(never_loop)] +#![warn(never_loop)] #![allow(dead_code, unused)] fn main() { diff --git a/tests/ui/never_loop.stderr b/clippy_tests/examples/never_loop.stderr similarity index 62% rename from tests/ui/never_loop.stderr rename to clippy_tests/examples/never_loop.stderr index 6f465716e5c..dcfdf559bcb 100644 --- a/tests/ui/never_loop.stderr +++ b/clippy_tests/examples/never_loop.stderr @@ -1,5 +1,5 @@ error: this loop never actually loops - --> $DIR/never_loop.rs:8:5 + --> examples/never_loop.rs:8:5 | 8 | / loop { 9 | | println!("This is only ever printed once"); @@ -7,14 +7,10 @@ error: this loop never actually loops 11 | | } | |_____^ | -note: lint level defined here - --> $DIR/never_loop.rs:4:9 - | -4 | #![deny(never_loop)] - | ^^^^^^^^^^ + = note: `-D never-loop` implied by `-D warnings` error: this loop never actually loops - --> $DIR/never_loop.rs:21:5 + --> examples/never_loop.rs:21:5 | 21 | / loop { 22 | | loop { @@ -24,15 +20,22 @@ error: this loop never actually loops 26 | | break; 27 | | } | |_____^ + | + = note: `-D never-loop` implied by `-D warnings` error: this loop never actually loops - --> $DIR/never_loop.rs:22:9 + --> examples/never_loop.rs:22:9 | 22 | / loop { 23 | | // another one 24 | | break; 25 | | } | |_________^ + | + = note: `-D never-loop` 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. diff --git a/tests/ui/new_without_default.rs b/clippy_tests/examples/new_without_default.rs similarity index 95% rename from tests/ui/new_without_default.rs rename to clippy_tests/examples/new_without_default.rs index 1662e8072af..d4999f84e55 100644 --- a/tests/ui/new_without_default.rs +++ b/clippy_tests/examples/new_without_default.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(dead_code)] -#![deny(new_without_default, new_without_default_derive)] +#![warn(new_without_default, new_without_default_derive)] pub struct Foo; diff --git a/tests/ui/new_without_default.stderr b/clippy_tests/examples/new_without_default.stderr similarity index 61% rename from tests/ui/new_without_default.stderr rename to clippy_tests/examples/new_without_default.stderr index e529f6c8e2f..295abbec77b 100644 --- a/tests/ui/new_without_default.stderr +++ b/clippy_tests/examples/new_without_default.stderr @@ -1,37 +1,30 @@ error: you should consider deriving a `Default` implementation for `Foo` - --> $DIR/new_without_default.rs:10:5 + --> examples/new_without_default.rs:10:5 | 10 | pub fn new() -> Foo { Foo } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/new_without_default.rs:5:30 - | -5 | #![deny(new_without_default, new_without_default_derive)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D new-without-default-derive` implied by `-D warnings` help: try this | #[derive(Default)] error: you should consider deriving a `Default` implementation for `Bar` - --> $DIR/new_without_default.rs:16:5 + --> examples/new_without_default.rs:16:5 | 16 | pub fn new() -> Self { Bar } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D new-without-default-derive` implied by `-D warnings` help: try this | #[derive(Default)] error: you should consider adding a `Default` implementation for `LtKo<'c>` - --> $DIR/new_without_default.rs:64:5 + --> examples/new_without_default.rs:64:5 | 64 | pub fn new() -> LtKo<'c> { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/new_without_default.rs:5:9 - | -5 | #![deny(new_without_default, new_without_default_derive)] - | ^^^^^^^^^^^^^^^^^^^ + = note: `-D new-without-default` implied by `-D warnings` help: try this | impl Default for LtKo<'c> { | fn default() -> Self { @@ -43,3 +36,6 @@ help: try this error: aborting due to 3 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/no_effect.rs b/clippy_tests/examples/no_effect.rs similarity index 97% rename from tests/ui/no_effect.rs rename to clippy_tests/examples/no_effect.rs index 6963e9b92ed..bef1fad4f69 100644 --- a/tests/ui/no_effect.rs +++ b/clippy_tests/examples/no_effect.rs @@ -1,7 +1,7 @@ #![feature(plugin, box_syntax, inclusive_range_syntax)] #![plugin(clippy)] -#![deny(no_effect, unnecessary_operation)] +#![warn(no_effect, unnecessary_operation)] #![allow(dead_code)] #![allow(path_statements)] #![allow(deref_addrof)] diff --git a/tests/ui/no_effect.stderr b/clippy_tests/examples/no_effect.stderr similarity index 52% rename from tests/ui/no_effect.stderr rename to clippy_tests/examples/no_effect.stderr index 0427fbf91f5..b37552e841f 100644 --- a/tests/ui/no_effect.stderr +++ b/clippy_tests/examples/no_effect.stderr @@ -1,278 +1,357 @@ error: statement with no effect - --> $DIR/no_effect.rs:34:5 + --> examples/no_effect.rs:34:5 | 34 | 0; | ^^ | -note: lint level defined here - --> $DIR/no_effect.rs:4:9 - | -4 | #![deny(no_effect, unnecessary_operation)] - | ^^^^^^^^^ + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:35:5 + --> examples/no_effect.rs:35:5 | 35 | s2; | ^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:36:5 + --> examples/no_effect.rs:36:5 | 36 | Unit; | ^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:37:5 + --> examples/no_effect.rs:37:5 | 37 | Tuple(0); | ^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:38:5 + --> examples/no_effect.rs:38:5 | 38 | Struct { field: 0 }; | ^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:39:5 + --> examples/no_effect.rs:39:5 | 39 | Struct { ..s }; | ^^^^^^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:40:5 + --> examples/no_effect.rs:40:5 | 40 | Union { a: 0 }; | ^^^^^^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:41:5 + --> examples/no_effect.rs:41:5 | 41 | Enum::Tuple(0); | ^^^^^^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:42:5 + --> examples/no_effect.rs:42:5 | 42 | Enum::Struct { field: 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:43:5 + --> examples/no_effect.rs:43:5 | 43 | 5 + 6; | ^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:44:5 + --> examples/no_effect.rs:44:5 | 44 | *&42; | ^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:45:5 + --> examples/no_effect.rs:45:5 | 45 | &6; | ^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:46:5 + --> examples/no_effect.rs:46:5 | 46 | (5, 6, 7); | ^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:47:5 + --> examples/no_effect.rs:47:5 | 47 | box 42; | ^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:48:5 + --> examples/no_effect.rs:48:5 | 48 | ..; | ^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:49:5 + --> examples/no_effect.rs:49:5 | 49 | 5..; | ^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:50:5 + --> examples/no_effect.rs:50:5 | 50 | ..5; | ^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:51:5 + --> examples/no_effect.rs:51:5 | 51 | 5..6; | ^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:52:5 + --> examples/no_effect.rs:52:5 | 52 | 5...6; | ^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:53:5 + --> examples/no_effect.rs:53:5 | 53 | [42, 55]; | ^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:54:5 + --> examples/no_effect.rs:54:5 | 54 | [42, 55][1]; | ^^^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:55:5 + --> examples/no_effect.rs:55:5 | 55 | (42, 55).1; | ^^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:56:5 + --> examples/no_effect.rs:56:5 | 56 | [42; 55]; | ^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:57:5 + --> examples/no_effect.rs:57:5 | 57 | [42; 55][13]; | ^^^^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> $DIR/no_effect.rs:59:5 + --> examples/no_effect.rs:59:5 | 59 | || x += 5; | ^^^^^^^^^^ + | + = note: `-D no-effect` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:65:5 + --> examples/no_effect.rs:65:5 | 65 | Tuple(get_number()); | ^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` | -note: lint level defined here - --> $DIR/no_effect.rs:4:20 - | -4 | #![deny(no_effect, unnecessary_operation)] - | ^^^^^^^^^^^^^^^^^^^^^ + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:66:5 + --> examples/no_effect.rs:66:5 | 66 | Struct { field: get_number() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:67:5 + --> examples/no_effect.rs:67:5 | 67 | Struct { ..get_struct() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_struct();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:68:5 + --> examples/no_effect.rs:68:5 | 68 | Enum::Tuple(get_number()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:69:5 + --> examples/no_effect.rs:69:5 | 69 | Enum::Struct { field: get_number() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:70:5 + --> examples/no_effect.rs:70:5 | 70 | 5 + get_number(); | ^^^^^^^^^^^^^^^^^ help: replace it with `5;get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:71:5 + --> examples/no_effect.rs:71:5 | 71 | *&get_number(); | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:72:5 + --> examples/no_effect.rs:72:5 | 72 | &get_number(); | ^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:73:5 + --> examples/no_effect.rs:73:5 | 73 | (5, 6, get_number()); | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with `5;6;get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:74:5 + --> examples/no_effect.rs:74:5 | 74 | box get_number(); | ^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:75:5 + --> examples/no_effect.rs:75:5 | 75 | get_number()..; | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:76:5 + --> examples/no_effect.rs:76:5 | 76 | ..get_number(); | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:77:5 + --> examples/no_effect.rs:77:5 | 77 | 5..get_number(); | ^^^^^^^^^^^^^^^^ help: replace it with `5;get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:78:5 + --> examples/no_effect.rs:78:5 | 78 | [42, get_number()]; | ^^^^^^^^^^^^^^^^^^^ help: replace it with `42;get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:79:5 + --> examples/no_effect.rs:79:5 | 79 | [42, 55][get_number() as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `[42, 55];get_number() as usize;` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:80:5 + --> examples/no_effect.rs:80:5 | 80 | (42, get_number()).1; | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with `42;get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:81:5 + --> examples/no_effect.rs:81:5 | 81 | [get_number(); 55]; | ^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:82:5 + --> examples/no_effect.rs:82:5 | 82 | [42; 55][get_number() as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `[42; 55];get_number() as usize;` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> $DIR/no_effect.rs:83:5 + --> examples/no_effect.rs:83:5 | 83 | {get_number()}; | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | + = note: `-D unnecessary-operation` implied by `-D warnings` error: aborting due to 44 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/non_expressive_names.rs b/clippy_tests/examples/non_expressive_names.rs similarity index 98% rename from tests/ui/non_expressive_names.rs rename to clippy_tests/examples/non_expressive_names.rs index 8f8c110b9da..f32dad2080f 100644 --- a/tests/ui/non_expressive_names.rs +++ b/clippy_tests/examples/non_expressive_names.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy,similar_names)] +#![warn(clippy,similar_names)] #![allow(unused)] diff --git a/tests/ui/non_expressive_names.stderr b/clippy_tests/examples/non_expressive_names.stderr similarity index 58% rename from tests/ui/non_expressive_names.stderr rename to clippy_tests/examples/non_expressive_names.stderr index 63fc607b802..ca8a42fda0d 100644 --- a/tests/ui/non_expressive_names.stderr +++ b/clippy_tests/examples/non_expressive_names.stderr @@ -1,148 +1,148 @@ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:18:9 + --> examples/non_expressive_names.rs:18:9 | 18 | let bpple: i32; | ^^^^^ | -note: lint level defined here - --> $DIR/non_expressive_names.rs:3:16 - | -3 | #![deny(clippy,similar_names)] - | ^^^^^^^^^^^^^ + = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> $DIR/non_expressive_names.rs:16:9 + --> examples/non_expressive_names.rs:16:9 | 16 | let apple: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `b_pple` - --> $DIR/non_expressive_names.rs:18:9 + --> examples/non_expressive_names.rs:18:9 | 18 | let bpple: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:20:9 + --> examples/non_expressive_names.rs:20:9 | 20 | let cpple: i32; | ^^^^^ | + = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> $DIR/non_expressive_names.rs:16:9 + --> examples/non_expressive_names.rs:16:9 | 16 | let apple: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `c_pple` - --> $DIR/non_expressive_names.rs:20:9 + --> examples/non_expressive_names.rs:20:9 | 20 | let cpple: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:45:9 + --> examples/non_expressive_names.rs:45:9 | 45 | let bluby: i32; | ^^^^^ | + = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> $DIR/non_expressive_names.rs:44:9 + --> examples/non_expressive_names.rs:44:9 | 44 | let blubx: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `blub_y` - --> $DIR/non_expressive_names.rs:45:9 + --> examples/non_expressive_names.rs:45:9 | 45 | let bluby: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:50:9 + --> examples/non_expressive_names.rs:50:9 | 50 | let coke: i32; | ^^^^ | + = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> $DIR/non_expressive_names.rs:48:9 + --> examples/non_expressive_names.rs:48:9 | 48 | let cake: i32; | ^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:68:9 + --> examples/non_expressive_names.rs:68:9 | 68 | let xyzeabc: i32; | ^^^^^^^ | + = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> $DIR/non_expressive_names.rs:66:9 + --> examples/non_expressive_names.rs:66:9 | 66 | let xyz1abc: i32; | ^^^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:72:9 + --> examples/non_expressive_names.rs:72:9 | 72 | let parsee: i32; | ^^^^^^ | + = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> $DIR/non_expressive_names.rs:70:9 + --> examples/non_expressive_names.rs:70:9 | 70 | let parser: i32; | ^^^^^^ help: separate the discriminating character by an underscore like: `parse_e` - --> $DIR/non_expressive_names.rs:72:9 + --> examples/non_expressive_names.rs:72:9 | 72 | let parsee: i32; | ^^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:86:16 + --> examples/non_expressive_names.rs:86:16 | 86 | bpple: sprang } = unimplemented!(); | ^^^^^^ | + = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> $DIR/non_expressive_names.rs:85:22 + --> examples/non_expressive_names.rs:85:22 | 85 | let Foo { apple: spring, | ^^^^^^ error: 5th binding whose name is just one char - --> $DIR/non_expressive_names.rs:120:17 + --> examples/non_expressive_names.rs:120:17 | 120 | let e: i32; | ^ | - = note: #[deny(many_single_char_names)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/non_expressive_names.rs:3:9 - | -3 | #![deny(clippy,similar_names)] - | ^^^^^^ + = note: `-D many-single-char-names` implied by `-D warnings` error: 5th binding whose name is just one char - --> $DIR/non_expressive_names.rs:123:17 + --> examples/non_expressive_names.rs:123:17 | 123 | let e: i32; | ^ | - = note: #[deny(many_single_char_names)] implied by #[deny(clippy)] + = note: `-D many-single-char-names` implied by `-D warnings` error: 6th binding whose name is just one char - --> $DIR/non_expressive_names.rs:124:17 + --> examples/non_expressive_names.rs:124:17 | 124 | let f: i32; | ^ | - = note: #[deny(many_single_char_names)] implied by #[deny(clippy)] + = note: `-D many-single-char-names` implied by `-D warnings` error: 5th binding whose name is just one char - --> $DIR/non_expressive_names.rs:129:13 + --> examples/non_expressive_names.rs:129:13 | 129 | e => panic!(), | ^ | - = note: #[deny(many_single_char_names)] implied by #[deny(clippy)] + = note: `-D many-single-char-names` 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. diff --git a/tests/ui/ok_if_let.rs b/clippy_tests/examples/ok_if_let.rs similarity index 92% rename from tests/ui/ok_if_let.rs rename to clippy_tests/examples/ok_if_let.rs index e8a55a552d4..dda38fec287 100644 --- a/tests/ui/ok_if_let.rs +++ b/clippy_tests/examples/ok_if_let.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(if_let_some_result)] +#![warn(if_let_some_result)] fn str_to_int(x: &str) -> i32 { if let Some(y) = x.parse().ok() { diff --git a/tests/ui/ok_if_let.stderr b/clippy_tests/examples/ok_if_let.stderr similarity index 61% rename from tests/ui/ok_if_let.stderr rename to clippy_tests/examples/ok_if_let.stderr index bf58e1281cf..9afc9f451ca 100644 --- a/tests/ui/ok_if_let.stderr +++ b/clippy_tests/examples/ok_if_let.stderr @@ -1,5 +1,5 @@ error: Matching on `Some` with `ok()` is redundant - --> $DIR/ok_if_let.rs:7:5 + --> examples/ok_if_let.rs:7:5 | 7 | / if let Some(y) = x.parse().ok() { 8 | | y @@ -8,12 +8,11 @@ error: Matching on `Some` with `ok()` is redundant 11 | | } | |_____^ | -note: lint level defined here - --> $DIR/ok_if_let.rs:4:9 - | -4 | #![deny(if_let_some_result)] - | ^^^^^^^^^^^^^^^^^^ + = note: `-D if-let-some-result` implied by `-D warnings` = help: Consider matching on `Ok(y)` and removing the call to `ok` instead error: aborting due to previous error +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/op_ref.rs b/clippy_tests/examples/op_ref.rs similarity index 100% rename from tests/ui/op_ref.rs rename to clippy_tests/examples/op_ref.rs diff --git a/clippy_tests/examples/op_ref.stderr b/clippy_tests/examples/op_ref.stderr new file mode 100644 index 00000000000..f9b31c7c82a --- /dev/null +++ b/clippy_tests/examples/op_ref.stderr @@ -0,0 +1,15 @@ +error: needlessly taken reference of both operands + --> examples/op_ref.rs:13:15 + | +13 | let foo = &5 - &6; + | ^^^^^^^ + | + = note: `-D op-ref` implied by `-D warnings` +help: use the values directly + | let foo = 5 - 6; + +error: aborting due to previous error + +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/open_options.rs b/clippy_tests/examples/open_options.rs similarity index 94% rename from tests/ui/open_options.rs rename to clippy_tests/examples/open_options.rs index e1ce69af76e..c409aa564f8 100644 --- a/tests/ui/open_options.rs +++ b/clippy_tests/examples/open_options.rs @@ -3,7 +3,7 @@ use std::fs::OpenOptions; #[allow(unused_must_use)] -#[deny(nonsensical_open_options)] +#[warn(nonsensical_open_options)] fn main() { OpenOptions::new().read(true).truncate(true).open("foo.txt"); OpenOptions::new().append(true).truncate(true).open("foo.txt"); diff --git a/tests/ui/open_options.stderr b/clippy_tests/examples/open_options.stderr similarity index 63% rename from tests/ui/open_options.stderr rename to clippy_tests/examples/open_options.stderr index 0f9779c2778..ae097db75f0 100644 --- a/tests/ui/open_options.stderr +++ b/clippy_tests/examples/open_options.stderr @@ -1,50 +1,61 @@ error: file opened with "truncate" and "read" - --> $DIR/open_options.rs:8:5 + --> examples/open_options.rs:8:5 | 8 | OpenOptions::new().read(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/open_options.rs:6:8 - | -6 | #[deny(nonsensical_open_options)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D nonsensical-open-options` implied by `-D warnings` error: file opened with "append" and "truncate" - --> $DIR/open_options.rs:9:5 + --> examples/open_options.rs:9:5 | 9 | OpenOptions::new().append(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "read" is called more than once - --> $DIR/open_options.rs:11:5 + --> examples/open_options.rs:11:5 | 11 | OpenOptions::new().read(true).read(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "create" is called more than once - --> $DIR/open_options.rs:12:5 + --> examples/open_options.rs:12:5 | 12 | OpenOptions::new().create(true).create(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "write" is called more than once - --> $DIR/open_options.rs:13:5 + --> examples/open_options.rs:13:5 | 13 | OpenOptions::new().write(true).write(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "append" is called more than once - --> $DIR/open_options.rs:14:5 + --> examples/open_options.rs:14:5 | 14 | OpenOptions::new().append(true).append(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "truncate" is called more than once - --> $DIR/open_options.rs:15:5 + --> examples/open_options.rs:15:5 | 15 | OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D nonsensical-open-options` 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. diff --git a/tests/ui/overflow_check_conditional.rs b/clippy_tests/examples/overflow_check_conditional.rs similarity index 92% rename from tests/ui/overflow_check_conditional.rs rename to clippy_tests/examples/overflow_check_conditional.rs index 51503003be4..a669f741f29 100644 --- a/tests/ui/overflow_check_conditional.rs +++ b/clippy_tests/examples/overflow_check_conditional.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(many_single_char_names)] -#![deny(overflow_check_conditional)] +#![warn(overflow_check_conditional)] fn main() { let a: u32 = 1; diff --git a/clippy_tests/examples/overflow_check_conditional.stderr b/clippy_tests/examples/overflow_check_conditional.stderr new file mode 100644 index 00000000000..26ef8f401b9 --- /dev/null +++ b/clippy_tests/examples/overflow_check_conditional.stderr @@ -0,0 +1,69 @@ +error: You are trying to use classic C overflow conditions that will fail in Rust. + --> examples/overflow_check_conditional.rs:11:5 + | +11 | if a + b < a { + | ^^^^^^^^^ + | + = note: `-D overflow-check-conditional` implied by `-D warnings` + +error: You are trying to use classic C overflow conditions that will fail in Rust. + --> examples/overflow_check_conditional.rs:14:5 + | +14 | if a > a + b { + | ^^^^^^^^^ + | + = note: `-D overflow-check-conditional` implied by `-D warnings` + +error: You are trying to use classic C overflow conditions that will fail in Rust. + --> examples/overflow_check_conditional.rs:17:5 + | +17 | if a + b < b { + | ^^^^^^^^^ + | + = note: `-D overflow-check-conditional` implied by `-D warnings` + +error: You are trying to use classic C overflow conditions that will fail in Rust. + --> examples/overflow_check_conditional.rs:20:5 + | +20 | if b > a + b { + | ^^^^^^^^^ + | + = note: `-D overflow-check-conditional` implied by `-D warnings` + +error: You are trying to use classic C underflow conditions that will fail in Rust. + --> examples/overflow_check_conditional.rs:23:5 + | +23 | if a - b > b { + | ^^^^^^^^^ + | + = note: `-D overflow-check-conditional` implied by `-D warnings` + +error: You are trying to use classic C underflow conditions that will fail in Rust. + --> examples/overflow_check_conditional.rs:26:5 + | +26 | if b < a - b { + | ^^^^^^^^^ + | + = note: `-D overflow-check-conditional` implied by `-D warnings` + +error: You are trying to use classic C underflow conditions that will fail in Rust. + --> examples/overflow_check_conditional.rs:29:5 + | +29 | if a - b > a { + | ^^^^^^^^^ + | + = note: `-D overflow-check-conditional` implied by `-D warnings` + +error: You are trying to use classic C underflow conditions that will fail in Rust. + --> examples/overflow_check_conditional.rs:32:5 + | +32 | if a < a - b { + | ^^^^^^^^^ + | + = note: `-D overflow-check-conditional` 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. diff --git a/tests/ui/panic.rs b/clippy_tests/examples/panic.rs similarity index 96% rename from tests/ui/panic.rs rename to clippy_tests/examples/panic.rs index 741c8090356..d1a099c1e66 100644 --- a/tests/ui/panic.rs +++ b/clippy_tests/examples/panic.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(panic_params)] +#![warn(panic_params)] fn missing() { if true { diff --git a/tests/ui/panic.stderr b/clippy_tests/examples/panic.stderr similarity index 63% rename from tests/ui/panic.stderr rename to clippy_tests/examples/panic.stderr index 451a5db6441..9973360cd9a 100644 --- a/tests/ui/panic.stderr +++ b/clippy_tests/examples/panic.stderr @@ -1,34 +1,38 @@ error: you probably are missing some parameter in your format string - --> $DIR/panic.rs:8:16 + --> examples/panic.rs:8:16 | 8 | panic!("{}"); | ^^^^ | -note: lint level defined here - --> $DIR/panic.rs:4:9 - | -4 | #![deny(panic_params)] - | ^^^^^^^^^^^^ + = note: `-D panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string - --> $DIR/panic.rs:10:16 + --> examples/panic.rs:10:16 | 10 | panic!("{:?}"); | ^^^^^^ + | + = note: `-D panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string - --> $DIR/panic.rs:12:23 + --> examples/panic.rs:12:23 | 12 | assert!(true, "here be missing values: {}"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string - --> $DIR/panic.rs:22:5 + --> examples/panic.rs:22:5 | 22 | assert!("foo bar".contains(&format!("foo {}", "bar"))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D panic-params` implied by `-D warnings` = note: this error originates in a macro outside of the current crate error: aborting due to 4 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/partialeq_ne_impl.rs b/clippy_tests/examples/partialeq_ne_impl.rs similarity index 91% rename from tests/ui/partialeq_ne_impl.rs rename to clippy_tests/examples/partialeq_ne_impl.rs index aadbd8d693a..41772700109 100644 --- a/tests/ui/partialeq_ne_impl.rs +++ b/clippy_tests/examples/partialeq_ne_impl.rs @@ -1,7 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(warnings)] #![allow(dead_code)] struct Foo; diff --git a/clippy_tests/examples/partialeq_ne_impl.stderr b/clippy_tests/examples/partialeq_ne_impl.stderr new file mode 100644 index 00000000000..4a3dc4ef0ca --- /dev/null +++ b/clippy_tests/examples/partialeq_ne_impl.stderr @@ -0,0 +1,13 @@ +error: re-implementing `PartialEq::ne` is unnecessary + --> examples/partialeq_ne_impl.rs:10:5 + | +10 | fn ne(&self, _: &Foo) -> bool { false } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D partialeq-ne-impl` 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. diff --git a/tests/ui/patterns.rs b/clippy_tests/examples/patterns.rs similarity index 93% rename from tests/ui/patterns.rs rename to clippy_tests/examples/patterns.rs index d4aa513ea06..793b2b111d6 100644 --- a/tests/ui/patterns.rs +++ b/clippy_tests/examples/patterns.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] #![allow(unused)] -#![deny(clippy)] +#![warn(clippy)] fn main() { let v = Some(true); diff --git a/clippy_tests/examples/patterns.stderr b/clippy_tests/examples/patterns.stderr new file mode 100644 index 00000000000..05d41324451 --- /dev/null +++ b/clippy_tests/examples/patterns.stderr @@ -0,0 +1,13 @@ +error: the `y @ _` pattern can be written as just `y` + --> examples/patterns.rs:10:9 + | +10 | y @ _ => (), + | ^^^^^ + | + = note: `-D redundant-pattern` 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. diff --git a/tests/ui/precedence.rs b/clippy_tests/examples/precedence.rs similarity index 95% rename from tests/ui/precedence.rs rename to clippy_tests/examples/precedence.rs index c37769d816e..c6865632cf7 100644 --- a/tests/ui/precedence.rs +++ b/clippy_tests/examples/precedence.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#[deny(precedence)] +#[warn(precedence)] #[allow(identity_op)] #[allow(eq_op)] fn main() { diff --git a/tests/ui/precedence.stderr b/clippy_tests/examples/precedence.stderr similarity index 62% rename from tests/ui/precedence.stderr rename to clippy_tests/examples/precedence.stderr index 6090be0ab0f..b164a91f3eb 100644 --- a/tests/ui/precedence.stderr +++ b/clippy_tests/examples/precedence.stderr @@ -1,62 +1,77 @@ error: operator precedence can trip the unwary - --> $DIR/precedence.rs:8:5 + --> examples/precedence.rs:8:5 | 8 | 1 << 2 + 3; | ^^^^^^^^^^ help: consider parenthesizing your expression `1 << (2 + 3)` | -note: lint level defined here - --> $DIR/precedence.rs:4:8 - | -4 | #[deny(precedence)] - | ^^^^^^^^^^ + = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:9:5 + --> examples/precedence.rs:9:5 | 9 | 1 + 2 << 3; | ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 2) << 3` + | + = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:10:5 + --> examples/precedence.rs:10:5 | 10 | 4 >> 1 + 1; | ^^^^^^^^^^ help: consider parenthesizing your expression `4 >> (1 + 1)` + | + = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:11:5 + --> examples/precedence.rs:11:5 | 11 | 1 + 3 >> 2; | ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 3) >> 2` + | + = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:12:5 + --> examples/precedence.rs:12:5 | 12 | 1 ^ 1 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression `1 ^ (1 - 1)` + | + = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:13:5 + --> examples/precedence.rs:13:5 | 13 | 3 | 2 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression `3 | (2 - 1)` + | + = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:14:5 + --> examples/precedence.rs:14:5 | 14 | 3 & 5 - 2; | ^^^^^^^^^ help: consider parenthesizing your expression `3 & (5 - 2)` + | + = note: `-D precedence` implied by `-D warnings` error: unary minus has lower precedence than method call - --> $DIR/precedence.rs:15:5 + --> examples/precedence.rs:15:5 | 15 | -1i32.abs(); | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1i32.abs())` + | + = note: `-D precedence` implied by `-D warnings` error: unary minus has lower precedence than method call - --> $DIR/precedence.rs:16:5 + --> examples/precedence.rs:16:5 | 16 | -1f32.abs(); | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1f32.abs())` + | + = note: `-D precedence` implied by `-D warnings` error: aborting due to 9 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/print.rs b/clippy_tests/examples/print.rs similarity index 94% rename from tests/ui/print.rs rename to clippy_tests/examples/print.rs index 7a53fef480d..f1fb3cba8c1 100644 --- a/tests/ui/print.rs +++ b/clippy_tests/examples/print.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(print_stdout, use_debug)] +#![warn(print_stdout, use_debug)] use std::fmt::{Debug, Display, Formatter, Result}; diff --git a/tests/ui/print.stderr b/clippy_tests/examples/print.stderr similarity index 54% rename from tests/ui/print.stderr rename to clippy_tests/examples/print.stderr index e21a49a7477..b46ee8a9c75 100644 --- a/tests/ui/print.stderr +++ b/clippy_tests/examples/print.stderr @@ -1,62 +1,69 @@ error: use of `Debug`-based formatting - --> $DIR/print.rs:12:27 + --> examples/print.rs:12:27 | 12 | write!(f, "{:?}", 43.1415) | ^^^^^^^ | -note: lint level defined here - --> $DIR/print.rs:3:23 - | -3 | #![deny(print_stdout, use_debug)] - | ^^^^^^^^^ + = note: `-D use-debug` implied by `-D warnings` error: use of `println!` - --> $DIR/print.rs:24:5 + --> examples/print.rs:24:5 | 24 | println!("Hello"); | ^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/print.rs:3:9 - | -3 | #![deny(print_stdout, use_debug)] - | ^^^^^^^^^^^^ + = note: `-D print-stdout` implied by `-D warnings` error: use of `print!` - --> $DIR/print.rs:25:5 + --> examples/print.rs:25:5 | 25 | print!("Hello"); | ^^^^^^^^^^^^^^^^ + | + = note: `-D print-stdout` implied by `-D warnings` error: use of `print!` - --> $DIR/print.rs:27:5 + --> examples/print.rs:27:5 | 27 | print!("Hello {}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D print-stdout` implied by `-D warnings` error: use of `print!` - --> $DIR/print.rs:29:5 + --> examples/print.rs:29:5 | 29 | print!("Hello {:?}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D print-stdout` implied by `-D warnings` error: use of `Debug`-based formatting - --> $DIR/print.rs:29:26 + --> examples/print.rs:29:26 | 29 | print!("Hello {:?}", "World"); | ^^^^^^^ + | + = note: `-D use-debug` implied by `-D warnings` error: use of `print!` - --> $DIR/print.rs:31:5 + --> examples/print.rs:31:5 | 31 | print!("Hello {:#?}", "#orld"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D print-stdout` implied by `-D warnings` error: use of `Debug`-based formatting - --> $DIR/print.rs:31:27 + --> examples/print.rs:31:27 | 31 | print!("Hello {:#?}", "#orld"); | ^^^^^^^ + | + = note: `-D use-debug` 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. diff --git a/tests/ui/print_with_newline.rs b/clippy_tests/examples/print_with_newline.rs similarity index 93% rename from tests/ui/print_with_newline.rs rename to clippy_tests/examples/print_with_newline.rs index 3e2b31a528f..d852e375ded 100644 --- a/tests/ui/print_with_newline.rs +++ b/clippy_tests/examples/print_with_newline.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(print_with_newline)] +#![warn(print_with_newline)] fn main() { print!("Hello\n"); diff --git a/clippy_tests/examples/print_with_newline.stderr b/clippy_tests/examples/print_with_newline.stderr new file mode 100644 index 00000000000..87932a1b27c --- /dev/null +++ b/clippy_tests/examples/print_with_newline.stderr @@ -0,0 +1,37 @@ +error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead + --> examples/print_with_newline.rs:6:5 + | +6 | print!("Hello\n"); + | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D print-with-newline` implied by `-D warnings` + +error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead + --> examples/print_with_newline.rs:7:5 + | +7 | print!("Hello {}\n", "world"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D print-with-newline` implied by `-D warnings` + +error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead + --> examples/print_with_newline.rs:8:5 + | +8 | print!("Hello {} {}\n\n", "world", "#2"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D print-with-newline` implied by `-D warnings` + +error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead + --> examples/print_with_newline.rs:9:5 + | +9 | print!("{}\n", 1265); + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D print-with-newline` 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. diff --git a/tests/ui/ptr_arg.rs b/clippy_tests/examples/ptr_arg.rs similarity index 96% rename from tests/ui/ptr_arg.rs rename to clippy_tests/examples/ptr_arg.rs index f262d2a8dba..5649bfec347 100644 --- a/tests/ui/ptr_arg.rs +++ b/clippy_tests/examples/ptr_arg.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] #![allow(unused)] -#![deny(ptr_arg)] +#![warn(ptr_arg)] fn do_vec(x: &Vec) { //Nothing here diff --git a/tests/ui/ptr_arg.stderr b/clippy_tests/examples/ptr_arg.stderr similarity index 66% rename from tests/ui/ptr_arg.stderr rename to clippy_tests/examples/ptr_arg.stderr index ce9c1e856fd..83a785b604b 100644 --- a/tests/ui/ptr_arg.stderr +++ b/clippy_tests/examples/ptr_arg.stderr @@ -1,26 +1,29 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. Consider changing the type to `&[...]` - --> $DIR/ptr_arg.rs:6:14 + --> examples/ptr_arg.rs:6:14 | 6 | fn do_vec(x: &Vec) { | ^^^^^^^^^ | -note: lint level defined here - --> $DIR/ptr_arg.rs:4:9 - | -4 | #![deny(ptr_arg)] - | ^^^^^^^ + = note: `-D ptr-arg` implied by `-D warnings` error: writing `&String` instead of `&str` involves a new object where a slice will do. Consider changing the type to `&str` - --> $DIR/ptr_arg.rs:14:14 + --> examples/ptr_arg.rs:14:14 | 14 | fn do_str(x: &String) { | ^^^^^^^ + | + = note: `-D ptr-arg` implied by `-D warnings` error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. Consider changing the type to `&[...]` - --> $DIR/ptr_arg.rs:27:18 + --> examples/ptr_arg.rs:27:18 | 27 | fn do_vec(x: &Vec); | ^^^^^^^^^ + | + = note: `-D ptr-arg` 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. diff --git a/tests/ui/range.rs b/clippy_tests/examples/range.rs similarity index 92% rename from tests/ui/range.rs rename to clippy_tests/examples/range.rs index 8e2bf6a7e69..0f648f8f876 100644 --- a/tests/ui/range.rs +++ b/clippy_tests/examples/range.rs @@ -8,7 +8,7 @@ impl NotARange { fn step_by(&self, _: u32) {} } -#[deny(range_step_by_zero, range_zip_with_len)] +#[warn(range_step_by_zero, range_zip_with_len)] fn main() { (0..1).step_by(0); // No warning for non-zero step diff --git a/tests/ui/range.stderr b/clippy_tests/examples/range.stderr similarity index 61% rename from tests/ui/range.stderr rename to clippy_tests/examples/range.stderr index 09e9f8a4751..fe8c5cfa9e8 100644 --- a/tests/ui/range.stderr +++ b/clippy_tests/examples/range.stderr @@ -1,44 +1,45 @@ error: Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` instead - --> $DIR/range.rs:13:5 + --> examples/range.rs:13:5 | 13 | (0..1).step_by(0); | ^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/range.rs:11:8 - | -11 | #[deny(range_step_by_zero, range_zip_with_len)] - | ^^^^^^^^^^^^^^^^^^ + = note: `-D range-step-by-zero` implied by `-D warnings` error: Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` instead - --> $DIR/range.rs:17:5 + --> examples/range.rs:17:5 | 17 | (1..).step_by(0); | ^^^^^^^^^^^^^^^^ + | + = note: `-D range-step-by-zero` implied by `-D warnings` error: Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` instead - --> $DIR/range.rs:18:5 + --> examples/range.rs:18:5 | 18 | (1...2).step_by(0); | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D range-step-by-zero` implied by `-D warnings` error: Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` instead - --> $DIR/range.rs:21:5 + --> examples/range.rs:21:5 | 21 | x.step_by(0); | ^^^^^^^^^^^^ + | + = note: `-D range-step-by-zero` implied by `-D warnings` error: It is more idiomatic to use v1.iter().enumerate() - --> $DIR/range.rs:29:14 + --> examples/range.rs:29:14 | 29 | let _x = v1.iter().zip(0..v1.len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/range.rs:11:28 - | -11 | #[deny(range_step_by_zero, range_zip_with_len)] - | ^^^^^^^^^^^^^^^^^^ + = note: `-D range-zip-with-len` 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. diff --git a/tests/ui/redundant_closure_call.rs b/clippy_tests/examples/redundant_closure_call.rs similarity index 78% rename from tests/ui/redundant_closure_call.rs rename to clippy_tests/examples/redundant_closure_call.rs index 30a8de4fd1c..2c079273b7b 100644 --- a/tests/ui/redundant_closure_call.rs +++ b/clippy_tests/examples/redundant_closure_call.rs @@ -1,13 +1,13 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(redundant_closure_call)] +#![warn(redundant_closure_call)] fn main() { let a = (|| 42)(); let mut i = 1; - let k = (|m| m+1)(i); + let mut k = (|m| m+1)(i); k = (|a,b| a*b)(1,5); diff --git a/clippy_tests/examples/redundant_closure_call.stderr b/clippy_tests/examples/redundant_closure_call.stderr new file mode 100644 index 00000000000..69244232b7c --- /dev/null +++ b/clippy_tests/examples/redundant_closure_call.stderr @@ -0,0 +1,45 @@ +error: Closure called just once immediately after it was declared + --> examples/redundant_closure_call.rs:15:2 + | +15 | i = closure(); + | ^^^^^^^^^^^^^ + | + = note: `-D redundant-closure-call` implied by `-D warnings` + +error: Closure called just once immediately after it was declared + --> examples/redundant_closure_call.rs:18:2 + | +18 | i = closure(3); + | ^^^^^^^^^^^^^^ + | + = note: `-D redundant-closure-call` implied by `-D warnings` + +error: Try not to call a closure in the expression where it is declared. + --> examples/redundant_closure_call.rs:7:10 + | +7 | let a = (|| 42)(); + | ^^^^^^^^^ help: Try doing something like: `42` + | + = note: `-D redundant-closure-call` implied by `-D warnings` + +error: Try not to call a closure in the expression where it is declared. + --> examples/redundant_closure_call.rs:10:14 + | +10 | let mut k = (|m| m+1)(i); + | ^^^^^^^^^^^^ + | + = note: `-D redundant-closure-call` implied by `-D warnings` + +error: Try not to call a closure in the expression where it is declared. + --> examples/redundant_closure_call.rs:12:6 + | +12 | k = (|a,b| a*b)(1,5); + | ^^^^^^^^^^^^^^^^ + | + = note: `-D redundant-closure-call` 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. diff --git a/tests/ui/reference.rs b/clippy_tests/examples/reference.rs similarity index 97% rename from tests/ui/reference.rs rename to clippy_tests/examples/reference.rs index 6928f16d10a..9451e19e336 100644 --- a/tests/ui/reference.rs +++ b/clippy_tests/examples/reference.rs @@ -11,7 +11,7 @@ fn get_reference(n : &usize) -> &usize { #[allow(many_single_char_names, double_parens)] #[allow(unused_variables)] -#[deny(deref_addrof)] +#[warn(deref_addrof)] fn main() { let a = 10; let aref = &a; diff --git a/tests/ui/reference.stderr b/clippy_tests/examples/reference.stderr similarity index 56% rename from tests/ui/reference.stderr rename to clippy_tests/examples/reference.stderr index b25f7737c79..d2f29c9779f 100644 --- a/tests/ui/reference.stderr +++ b/clippy_tests/examples/reference.stderr @@ -1,74 +1,93 @@ error: immediately dereferencing a reference - --> $DIR/reference.rs:19:13 + --> examples/reference.rs:19:13 | 19 | let b = *&a; | ^^^ help: try this `a` | -note: lint level defined here - --> $DIR/reference.rs:14:8 - | -14 | #[deny(deref_addrof)] - | ^^^^^^^^^^^^ + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:21:13 + --> examples/reference.rs:21:13 | 21 | let b = *&get_number(); | ^^^^^^^^^^^^^^ help: try this `get_number()` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:26:13 + --> examples/reference.rs:26:13 | 26 | let b = *&bytes[1..2][0]; | ^^^^^^^^^^^^^^^^ help: try this `bytes[1..2][0]` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:30:13 + --> examples/reference.rs:30:13 | 30 | let b = *&(a); | ^^^^^ help: try this `(a)` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:32:13 + --> examples/reference.rs:32:13 | 32 | let b = *(&a); | ^^^^^ help: try this `a` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:34:13 + --> examples/reference.rs:34:13 | 34 | let b = *((&a)); | ^^^^^^^ help: try this `a` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:36:13 + --> examples/reference.rs:36:13 | 36 | let b = *&&a; | ^^^^ help: try this `&a` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:38:14 + --> examples/reference.rs:38:14 | 38 | let b = **&aref; | ^^^^^^ help: try this `aref` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:42:14 + --> examples/reference.rs:42:14 | 42 | let b = **&&a; | ^^^^ help: try this `&a` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:46:17 + --> examples/reference.rs:46:17 | 46 | let y = *&mut x; | ^^^^^^^ help: try this `x` + | + = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:53:18 + --> examples/reference.rs:53:18 | 53 | let y = **&mut &mut x; | ^^^^^^^^^^^^ help: try this `&mut x` + | + = note: `-D deref-addrof` 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. diff --git a/tests/ui/regex.rs b/clippy_tests/examples/regex.rs similarity index 97% rename from tests/ui/regex.rs rename to clippy_tests/examples/regex.rs index 154fef54cea..56539c5468f 100644 --- a/tests/ui/regex.rs +++ b/clippy_tests/examples/regex.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(unused)] -#![deny(invalid_regex, trivial_regex, regex_macro)] +#![warn(invalid_regex, trivial_regex, regex_macro)] extern crate regex; diff --git a/clippy_tests/examples/regex.stderr b/clippy_tests/examples/regex.stderr new file mode 100644 index 00000000000..f5887d20bed --- /dev/null +++ b/clippy_tests/examples/regex.stderr @@ -0,0 +1,11 @@ +error[E0463]: can't find crate for `regex` + --> examples/regex.rs:7:1 + | +7 | extern crate regex; + | ^^^^^^^^^^^^^^^^^^^ can't find crate + +error: aborting due to previous error + +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/serde.rs b/clippy_tests/examples/serde.rs similarity index 97% rename from tests/ui/serde.rs rename to clippy_tests/examples/serde.rs index 8c4143b0dcf..61c691c01c1 100644 --- a/tests/ui/serde.rs +++ b/clippy_tests/examples/serde.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(serde_api_misuse)] +#![warn(serde_api_misuse)] #![allow(dead_code)] extern crate serde; diff --git a/clippy_tests/examples/serde.stderr b/clippy_tests/examples/serde.stderr new file mode 100644 index 00000000000..f7cd4bdbde4 --- /dev/null +++ b/clippy_tests/examples/serde.stderr @@ -0,0 +1,11 @@ +error[E0463]: can't find crate for `serde` + --> examples/serde.rs:6:1 + | +6 | extern crate serde; + | ^^^^^^^^^^^^^^^^^^^ can't find crate + +error: aborting due to previous error + +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/shadow.rs b/clippy_tests/examples/shadow.rs similarity index 95% rename from tests/ui/shadow.rs rename to clippy_tests/examples/shadow.rs index 5a2c9ba663e..e1f2ffacf49 100644 --- a/tests/ui/shadow.rs +++ b/clippy_tests/examples/shadow.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy, clippy_pedantic)] +#![warn(clippy, clippy_pedantic)] #![allow(unused_parens, unused_variables, missing_docs_in_private_items)] fn id(x: T) -> T { x } diff --git a/tests/ui/shadow.stderr b/clippy_tests/examples/shadow.stderr similarity index 56% rename from tests/ui/shadow.stderr rename to clippy_tests/examples/shadow.stderr index 212192a28da..179cd52d727 100644 --- a/tests/ui/shadow.stderr +++ b/clippy_tests/examples/shadow.stderr @@ -1,159 +1,147 @@ error: `x` is shadowed by itself in `&mut x` - --> $DIR/shadow.rs:13:9 + --> examples/shadow.rs:13:9 | 13 | let x = &mut x; | ^^^^^^^^^^ | - = note: #[deny(shadow_same)] implied by #[deny(clippy_pedantic)] -note: lint level defined here - --> $DIR/shadow.rs:4:17 - | -4 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^^^^^^^^^^ + = note: `-D shadow-same` implied by `-D warnings` note: previous binding is here - --> $DIR/shadow.rs:12:13 + --> examples/shadow.rs:12:13 | 12 | let mut x = 1; | ^ error: `x` is shadowed by itself in `{ x }` - --> $DIR/shadow.rs:14:9 + --> examples/shadow.rs:14:9 | 14 | let x = { x }; | ^^^^^^^^^ | - = note: #[deny(shadow_same)] implied by #[deny(clippy_pedantic)] + = note: `-D shadow-same` implied by `-D warnings` note: previous binding is here - --> $DIR/shadow.rs:13:9 + --> examples/shadow.rs:13:9 | 13 | let x = &mut x; | ^ error: `x` is shadowed by itself in `(&*x)` - --> $DIR/shadow.rs:15:9 + --> examples/shadow.rs:15:9 | 15 | let x = (&*x); | ^^^^^^^^^ | - = note: #[deny(shadow_same)] implied by #[deny(clippy_pedantic)] + = note: `-D shadow-same` implied by `-D warnings` note: previous binding is here - --> $DIR/shadow.rs:14:9 + --> examples/shadow.rs:14:9 | 14 | let x = { x }; | ^ error: `x` is shadowed by `{ *x + 1 }` which reuses the original value - --> $DIR/shadow.rs:16:9 + --> examples/shadow.rs:16:9 | 16 | let x = { *x + 1 }; | ^ | - = note: #[deny(shadow_reuse)] implied by #[deny(clippy_pedantic)] -note: lint level defined here - --> $DIR/shadow.rs:4:17 - | -4 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^^^^^^^^^^ + = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> $DIR/shadow.rs:16:13 + --> examples/shadow.rs:16:13 | 16 | let x = { *x + 1 }; | ^^^^^^^^^^ note: previous binding is here - --> $DIR/shadow.rs:15:9 + --> examples/shadow.rs:15:9 | 15 | let x = (&*x); | ^ error: `x` is shadowed by `id(x)` which reuses the original value - --> $DIR/shadow.rs:17:9 + --> examples/shadow.rs:17:9 | 17 | let x = id(x); | ^ | - = note: #[deny(shadow_reuse)] implied by #[deny(clippy_pedantic)] + = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> $DIR/shadow.rs:17:13 + --> examples/shadow.rs:17:13 | 17 | let x = id(x); | ^^^^^ note: previous binding is here - --> $DIR/shadow.rs:16:9 + --> examples/shadow.rs:16:9 | 16 | let x = { *x + 1 }; | ^ error: `x` is shadowed by `(1, x)` which reuses the original value - --> $DIR/shadow.rs:18:9 + --> examples/shadow.rs:18:9 | 18 | let x = (1, x); | ^ | - = note: #[deny(shadow_reuse)] implied by #[deny(clippy_pedantic)] + = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> $DIR/shadow.rs:18:13 + --> examples/shadow.rs:18:13 | 18 | let x = (1, x); | ^^^^^^ note: previous binding is here - --> $DIR/shadow.rs:17:9 + --> examples/shadow.rs:17:9 | 17 | let x = id(x); | ^ error: `x` is shadowed by `first(x)` which reuses the original value - --> $DIR/shadow.rs:19:9 + --> examples/shadow.rs:19:9 | 19 | let x = first(x); | ^ | - = note: #[deny(shadow_reuse)] implied by #[deny(clippy_pedantic)] + = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> $DIR/shadow.rs:19:13 + --> examples/shadow.rs:19:13 | 19 | let x = first(x); | ^^^^^^^^ note: previous binding is here - --> $DIR/shadow.rs:18:9 + --> examples/shadow.rs:18:9 | 18 | let x = (1, x); | ^ error: `x` is shadowed by `y` - --> $DIR/shadow.rs:21:9 + --> examples/shadow.rs:21:9 | 21 | let x = y; | ^ | - = note: #[deny(shadow_unrelated)] implied by #[deny(clippy_pedantic)] -note: lint level defined here - --> $DIR/shadow.rs:4:17 - | -4 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^^^^^^^^^^ + = note: `-D shadow-unrelated` implied by `-D warnings` note: initialization happens here - --> $DIR/shadow.rs:21:13 + --> examples/shadow.rs:21:13 | 21 | let x = y; | ^ note: previous binding is here - --> $DIR/shadow.rs:19:9 + --> examples/shadow.rs:19:9 | 19 | let x = first(x); | ^ error: `x` shadows a previous declaration - --> $DIR/shadow.rs:23:9 + --> examples/shadow.rs:23:9 | 23 | let x; | ^ | - = note: #[deny(shadow_unrelated)] implied by #[deny(clippy_pedantic)] + = note: `-D shadow-unrelated` implied by `-D warnings` note: previous binding is here - --> $DIR/shadow.rs:21:9 + --> examples/shadow.rs:21:9 | 21 | let x = y; | ^ error: aborting due to 9 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/short_circuit_statement.rs b/clippy_tests/examples/short_circuit_statement.rs similarity index 82% rename from tests/ui/short_circuit_statement.rs rename to clippy_tests/examples/short_circuit_statement.rs index c51bdcbe693..e783c6e5e69 100644 --- a/tests/ui/short_circuit_statement.rs +++ b/clippy_tests/examples/short_circuit_statement.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(short_circuit_statement)] +#![warn(short_circuit_statement)] fn main() { f() && g(); diff --git a/tests/ui/short_circuit_statement.stderr b/clippy_tests/examples/short_circuit_statement.stderr similarity index 57% rename from tests/ui/short_circuit_statement.stderr rename to clippy_tests/examples/short_circuit_statement.stderr index 60b7ca801ab..c2cd3cfb006 100644 --- a/tests/ui/short_circuit_statement.stderr +++ b/clippy_tests/examples/short_circuit_statement.stderr @@ -1,26 +1,29 @@ error: boolean short circuit operator in statement may be clearer using an explicit test - --> $DIR/short_circuit_statement.rs:7:5 + --> examples/short_circuit_statement.rs:7:5 | 7 | f() && g(); | ^^^^^^^^^^^ help: replace it with `if f() { g(); }` | -note: lint level defined here - --> $DIR/short_circuit_statement.rs:4:9 - | -4 | #![deny(short_circuit_statement)] - | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D short-circuit-statement` implied by `-D warnings` error: boolean short circuit operator in statement may be clearer using an explicit test - --> $DIR/short_circuit_statement.rs:8:5 + --> examples/short_circuit_statement.rs:8:5 | 8 | f() || g(); | ^^^^^^^^^^^ help: replace it with `if !f() { g(); }` + | + = note: `-D short-circuit-statement` implied by `-D warnings` error: boolean short circuit operator in statement may be clearer using an explicit test - --> $DIR/short_circuit_statement.rs:9:5 + --> examples/short_circuit_statement.rs:9:5 | 9 | 1 == 2 || g(); | ^^^^^^^^^^^^^^ help: replace it with `if !(1 == 2) { g(); }` + | + = note: `-D short-circuit-statement` 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. diff --git a/tests/ui/should_assert_eq.rs b/clippy_tests/examples/should_assert_eq.rs similarity index 95% rename from tests/ui/should_assert_eq.rs rename to clippy_tests/examples/should_assert_eq.rs index a5d11d907f8..ac5fca8dd0b 100644 --- a/tests/ui/should_assert_eq.rs +++ b/clippy_tests/examples/should_assert_eq.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(needless_pass_by_value)] -#![deny(should_assert_eq)] +#![warn(should_assert_eq)] #[derive(PartialEq, Eq)] struct NonDebug(i32); diff --git a/tests/ui/should_assert_eq.stderr b/clippy_tests/examples/should_assert_eq.stderr similarity index 64% rename from tests/ui/should_assert_eq.stderr rename to clippy_tests/examples/should_assert_eq.stderr index 3e5013fd3d8..10b6646501e 100644 --- a/tests/ui/should_assert_eq.stderr +++ b/clippy_tests/examples/should_assert_eq.stderr @@ -1,63 +1,68 @@ error: use `assert_eq` for better reporting - --> $DIR/should_assert_eq.rs:14:5 + --> examples/should_assert_eq.rs:14:5 | 14 | assert!(1 == 2); | ^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/should_assert_eq.rs:5:9 - | -5 | #![deny(should_assert_eq)] - | ^^^^^^^^^^^^^^^^ + = note: `-D should-assert-eq` implied by `-D warnings` = note: this error originates in a macro outside of the current crate error: use `assert_eq` for better reporting - --> $DIR/should_assert_eq.rs:15:5 + --> examples/should_assert_eq.rs:15:5 | 15 | assert!(Debug(1) == Debug(2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D should-assert-eq` implied by `-D warnings` = note: this error originates in a macro outside of the current crate error: use `assert_ne` for better reporting - --> $DIR/should_assert_eq.rs:17:5 + --> examples/should_assert_eq.rs:17:5 | 17 | assert!(Debug(1) != Debug(2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D should-assert-eq` implied by `-D warnings` = note: this error originates in a macro outside of the current crate error: use `debug_assert_eq` for better reporting - --> $DIR/should_assert_eq.rs:22:5 + --> examples/should_assert_eq.rs:22:5 | 22 | debug_assert!(4 == 5); | ^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D should-assert-eq` implied by `-D warnings` = note: this error originates in a macro outside of the current crate error: use `debug_assert_ne` for better reporting - --> $DIR/should_assert_eq.rs:23:5 + --> examples/should_assert_eq.rs:23:5 | 23 | debug_assert!(4 != 6); | ^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D should-assert-eq` implied by `-D warnings` = note: this error originates in a macro outside of the current crate error: use `assert_eq` for better reporting - --> $DIR/should_assert_eq.rs:27:5 + --> examples/should_assert_eq.rs:27:5 | 27 | assert!(x == y); | ^^^^^^^^^^^^^^^^ | + = note: `-D should-assert-eq` implied by `-D warnings` = note: this error originates in a macro outside of the current crate error: use `assert_ne` for better reporting - --> $DIR/should_assert_eq.rs:30:5 + --> examples/should_assert_eq.rs:30:5 | 30 | assert!(x != y); | ^^^^^^^^^^^^^^^^ | + = note: `-D should-assert-eq` implied by `-D warnings` = note: this error originates in a macro outside of the current crate error: aborting due to 7 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/strings.rs b/clippy_tests/examples/strings.rs similarity index 90% rename from tests/ui/strings.rs rename to clippy_tests/examples/strings.rs index b4aef1ba62c..1cb5619dd1d 100644 --- a/tests/ui/strings.rs +++ b/clippy_tests/examples/strings.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#[deny(string_add)] +#[warn(string_add)] #[allow(string_add_assign)] fn add_only() { // ignores assignment distinction let mut x = "".to_owned(); @@ -16,7 +16,7 @@ fn add_only() { // ignores assignment distinction assert_eq!(&x, &z); } -#[deny(string_add_assign)] +#[warn(string_add_assign)] fn add_assign_only() { let mut x = "".to_owned(); @@ -30,7 +30,7 @@ fn add_assign_only() { assert_eq!(&x, &z); } -#[deny(string_add, string_add_assign)] +#[warn(string_add, string_add_assign)] fn both() { let mut x = "".to_owned(); @@ -45,7 +45,7 @@ fn both() { } #[allow(dead_code, unused_variables)] -#[deny(string_lit_as_bytes)] +#[warn(string_lit_as_bytes)] fn str_lit_as_bytes() { let bs = "hello there".as_bytes(); diff --git a/tests/ui/strings.stderr b/clippy_tests/examples/strings.stderr similarity index 52% rename from tests/ui/strings.stderr rename to clippy_tests/examples/strings.stderr index 197d52a8781..5a883e5de1d 100644 --- a/tests/ui/strings.stderr +++ b/clippy_tests/examples/strings.stderr @@ -1,76 +1,61 @@ error: you added something to a string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:10:13 + --> examples/strings.rs:10:13 | 10 | x = x + "."; | ^^^^^^^ | -note: lint level defined here - --> $DIR/strings.rs:4:8 - | -4 | #[deny(string_add)] - | ^^^^^^^^^^ + = note: `-D string-add` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:14:13 + --> examples/strings.rs:14:13 | 14 | let z = y + "..."; | ^^^^^^^^^ + | + = note: `-D string-add` implied by `-D warnings` error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:24:9 + --> examples/strings.rs:24:9 | 24 | x = x + "."; | ^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/strings.rs:19:8 - | -19 | #[deny(string_add_assign)] - | ^^^^^^^^^^^^^^^^^ + = note: `-D string-add-assign` implied by `-D warnings` error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:38:9 + --> examples/strings.rs:38:9 | 38 | x = x + "."; | ^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/strings.rs:33:20 - | -33 | #[deny(string_add, string_add_assign)] - | ^^^^^^^^^^^^^^^^^ + = note: `-D string-add-assign` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:42:13 + --> examples/strings.rs:42:13 | 42 | let z = y + "..."; | ^^^^^^^^^ | -note: lint level defined here - --> $DIR/strings.rs:33:8 - | -33 | #[deny(string_add, string_add_assign)] - | ^^^^^^^^^^ + = note: `-D string-add` implied by `-D warnings` error: calling `as_bytes()` on a string literal - --> $DIR/strings.rs:50:14 + --> examples/strings.rs:50:14 | 50 | let bs = "hello there".as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead `b"hello there"` | -note: lint level defined here - --> $DIR/strings.rs:48:8 - | -48 | #[deny(string_lit_as_bytes)] - | ^^^^^^^^^^^^^^^^^^^ + = note: `-D string-lit-as-bytes` implied by `-D warnings` -warning: manual implementation of an assign operation - --> $DIR/strings.rs:65:7 +error: manual implementation of an assign operation + --> examples/strings.rs:65:7 | 65 | ; x = x + 1; | ^^^^^^^^^ help: replace it with `x += 1` | - = note: #[warn(assign_op_pattern)] on by default + = note: `-D assign-op-pattern` implied by `-D warnings` -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/stutter.rs b/clippy_tests/examples/stutter.rs similarity index 91% rename from tests/ui/stutter.rs rename to clippy_tests/examples/stutter.rs index 922ab080d73..3fd410c08af 100644 --- a/tests/ui/stutter.rs +++ b/clippy_tests/examples/stutter.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(stutter)] +#![warn(stutter)] #![allow(dead_code)] mod foo { diff --git a/tests/ui/stutter.stderr b/clippy_tests/examples/stutter.stderr similarity index 55% rename from tests/ui/stutter.stderr rename to clippy_tests/examples/stutter.stderr index 03f4c7396b4..585c9342a10 100644 --- a/tests/ui/stutter.stderr +++ b/clippy_tests/examples/stutter.stderr @@ -1,32 +1,37 @@ error: item name starts with its containing module's name - --> $DIR/stutter.rs:8:5 + --> examples/stutter.rs:8:5 | 8 | pub fn foo_bar() {} | ^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/stutter.rs:3:9 - | -3 | #![deny(stutter)] - | ^^^^^^^ + = note: `-D stutter` implied by `-D warnings` error: item name ends with its containing module's name - --> $DIR/stutter.rs:9:5 + --> examples/stutter.rs:9:5 | 9 | pub fn bar_foo() {} | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D stutter` implied by `-D warnings` error: item name starts with its containing module's name - --> $DIR/stutter.rs:10:5 + --> examples/stutter.rs:10:5 | 10 | pub struct FooCake {} | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D stutter` implied by `-D warnings` error: item name ends with its containing module's name - --> $DIR/stutter.rs:11:5 + --> examples/stutter.rs:11:5 | 11 | pub enum CakeFoo {} | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D stutter` 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. diff --git a/tests/ui/swap.rs b/clippy_tests/examples/swap.rs similarity index 97% rename from tests/ui/swap.rs rename to clippy_tests/examples/swap.rs index 0c23af966eb..abcafac4b9d 100644 --- a/tests/ui/swap.rs +++ b/clippy_tests/examples/swap.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(blacklisted_name, unused_assignments)] struct Foo(u32); diff --git a/tests/ui/swap.stderr b/clippy_tests/examples/swap.stderr similarity index 67% rename from tests/ui/swap.stderr rename to clippy_tests/examples/swap.stderr index a6a0e8bbae9..23fd7688a6e 100644 --- a/tests/ui/swap.stderr +++ b/clippy_tests/examples/swap.stderr @@ -1,40 +1,35 @@ error: this looks like you are swapping elements of `foo` manually - --> $DIR/swap.rs:11:5 + --> examples/swap.rs:11:5 | 11 | / let temp = foo[0]; 12 | | foo[0] = foo[1]; 13 | | foo[1] = temp; | |_________________^ help: try `foo.swap(0, 1)` | - = note: #[deny(manual_swap)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/swap.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ + = note: `-D manual-swap` implied by `-D warnings` error: this looks like you are swapping elements of `foo` manually - --> $DIR/swap.rs:20:5 + --> examples/swap.rs:20:5 | 20 | / let temp = foo[0]; 21 | | foo[0] = foo[1]; 22 | | foo[1] = temp; | |_________________^ help: try `foo.swap(0, 1)` | - = note: #[deny(manual_swap)] implied by #[deny(clippy)] + = note: `-D manual-swap` implied by `-D warnings` error: this looks like you are swapping elements of `foo` manually - --> $DIR/swap.rs:29:5 + --> examples/swap.rs:29:5 | 29 | / let temp = foo[0]; 30 | | foo[0] = foo[1]; 31 | | foo[1] = temp; | |_________________^ help: try `foo.swap(0, 1)` | - = note: #[deny(manual_swap)] implied by #[deny(clippy)] + = note: `-D manual-swap` implied by `-D warnings` error: this looks like you are swapping `a` and `b` manually - --> $DIR/swap.rs:47:7 + --> examples/swap.rs:47:7 | 47 | ; let t = a; | _______^ @@ -42,11 +37,11 @@ error: this looks like you are swapping `a` and `b` manually 49 | | b = t; | |_________^ help: try `std::mem::swap(&mut a, &mut b)` | - = note: #[deny(manual_swap)] implied by #[deny(clippy)] + = note: `-D manual-swap` implied by `-D warnings` = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping `c.0` and `a` manually - --> $DIR/swap.rs:56:7 + --> examples/swap.rs:56:7 | 56 | ; let t = c.0; | _______^ @@ -54,33 +49,31 @@ error: this looks like you are swapping `c.0` and `a` manually 58 | | a = t; | |_________^ help: try `std::mem::swap(&mut c.0, &mut a)` | - = note: #[deny(manual_swap)] implied by #[deny(clippy)] + = note: `-D manual-swap` implied by `-D warnings` = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `a` and `b` - --> $DIR/swap.rs:44:5 + --> examples/swap.rs:44:5 | 44 | / a = b; 45 | | b = a; | |_________^ help: try `std::mem::swap(&mut a, &mut b)` | - = note: #[deny(almost_swapped)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/swap.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ + = note: `-D almost-swapped` implied by `-D warnings` = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `c.0` and `a` - --> $DIR/swap.rs:53:5 + --> examples/swap.rs:53:5 | 53 | / c.0 = a; 54 | | a = c.0; | |___________^ help: try `std::mem::swap(&mut c.0, &mut a)` | - = note: #[deny(almost_swapped)] implied by #[deny(clippy)] + = note: `-D almost-swapped` implied by `-D warnings` = note: or maybe you should use `std::mem::replace`? error: aborting due to 7 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/temporary_assignment.rs b/clippy_tests/examples/temporary_assignment.rs similarity index 94% rename from tests/ui/temporary_assignment.rs rename to clippy_tests/examples/temporary_assignment.rs index 752d897d014..4a12d38285c 100644 --- a/tests/ui/temporary_assignment.rs +++ b/clippy_tests/examples/temporary_assignment.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(temporary_assignment)] +#![warn(temporary_assignment)] use std::ops::{Deref, DerefMut}; diff --git a/clippy_tests/examples/temporary_assignment.stderr b/clippy_tests/examples/temporary_assignment.stderr new file mode 100644 index 00000000000..ad19e7fac5a --- /dev/null +++ b/clippy_tests/examples/temporary_assignment.stderr @@ -0,0 +1,21 @@ +error: assignment to temporary + --> examples/temporary_assignment.rs:29:5 + | +29 | Struct { field: 0 }.field = 1; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D temporary-assignment` implied by `-D warnings` + +error: assignment to temporary + --> examples/temporary_assignment.rs:30:5 + | +30 | (0, 0).0 = 1; + | ^^^^^^^^^^^^ + | + = note: `-D temporary-assignment` 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. diff --git a/tests/ui/toplevel_ref_arg.rs b/clippy_tests/examples/toplevel_ref_arg.rs similarity index 96% rename from tests/ui/toplevel_ref_arg.rs rename to clippy_tests/examples/toplevel_ref_arg.rs index 7df2f5c86b7..7be52580c6f 100644 --- a/tests/ui/toplevel_ref_arg.rs +++ b/clippy_tests/examples/toplevel_ref_arg.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(unused)] fn the_answer(ref mut x: u8) { diff --git a/tests/ui/toplevel_ref_arg.stderr b/clippy_tests/examples/toplevel_ref_arg.stderr similarity index 61% rename from tests/ui/toplevel_ref_arg.stderr rename to clippy_tests/examples/toplevel_ref_arg.stderr index 8e01e76897d..ae53f77c741 100644 --- a/tests/ui/toplevel_ref_arg.stderr +++ b/clippy_tests/examples/toplevel_ref_arg.stderr @@ -1,47 +1,45 @@ error: `ref` directly on a function argument is ignored. Consider using a reference type instead. - --> $DIR/toplevel_ref_arg.rs:7:15 + --> examples/toplevel_ref_arg.rs:7:15 | 7 | fn the_answer(ref mut x: u8) { | ^^^^^^^^^ | - = note: #[deny(toplevel_ref_arg)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/toplevel_ref_arg.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ + = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> $DIR/toplevel_ref_arg.rs:18:7 + --> examples/toplevel_ref_arg.rs:18:7 | 18 | let ref x = 1; | ----^^^^^----- help: try `let x = &1;` | - = note: #[deny(toplevel_ref_arg)] implied by #[deny(clippy)] + = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> $DIR/toplevel_ref_arg.rs:20:7 + --> examples/toplevel_ref_arg.rs:20:7 | 20 | let ref y: (&_, u8) = (&1, 2); | ----^^^^^--------------------- help: try `let y: &(&_, u8) = &(&1, 2);` | - = note: #[deny(toplevel_ref_arg)] implied by #[deny(clippy)] + = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> $DIR/toplevel_ref_arg.rs:22:7 + --> examples/toplevel_ref_arg.rs:22:7 | 22 | let ref z = 1 + 2; | ----^^^^^--------- help: try `let z = &(1 + 2);` | - = note: #[deny(toplevel_ref_arg)] implied by #[deny(clippy)] + = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> $DIR/toplevel_ref_arg.rs:24:7 + --> examples/toplevel_ref_arg.rs:24:7 | 24 | let ref mut z = 1 + 2; | ----^^^^^^^^^--------- help: try `let z = &mut (1 + 2);` | - = note: #[deny(toplevel_ref_arg)] implied by #[deny(clippy)] + = note: `-D toplevel-ref-arg` 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. diff --git a/tests/ui/unicode.rs b/clippy_tests/examples/unicode.rs similarity index 81% rename from tests/ui/unicode.rs rename to clippy_tests/examples/unicode.rs index 02605794539..55dd0862700 100644 --- a/tests/ui/unicode.rs +++ b/clippy_tests/examples/unicode.rs @@ -1,19 +1,19 @@ #![feature(plugin)] #![plugin(clippy)] -#[deny(zero_width_space)] +#[warn(zero_width_space)] fn zero() { print!("Here >​< is a ZWS, and ​another"); print!("This\u{200B}is\u{200B}fine"); } -#[deny(unicode_not_nfc)] +#[warn(unicode_not_nfc)] fn canon() { print!("̀àh?"); print!("a\u{0300}h?"); // also okay } -#[deny(non_ascii_literal)] +#[warn(non_ascii_literal)] fn uni() { print!("Üben!"); print!("\u{DC}ben!"); // this is okay diff --git a/tests/ui/unicode.stderr b/clippy_tests/examples/unicode.stderr similarity index 54% rename from tests/ui/unicode.stderr rename to clippy_tests/examples/unicode.stderr index 62ada6fcb1c..f9c0acbf33a 100644 --- a/tests/ui/unicode.stderr +++ b/clippy_tests/examples/unicode.stderr @@ -1,40 +1,35 @@ error: zero-width space detected - --> $DIR/unicode.rs:6:12 + --> examples/unicode.rs:6:12 | 6 | print!("Here >​< is a ZWS, and ​another"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(zero_width_space)] on by default + = note: `-D zero-width-space` implied by `-D warnings` = help: Consider replacing the string with: - ""Here >/u{200B}< is a ZWS, and /u{200B}another"" + ""Here >\u{200B}< is a ZWS, and \u{200B}another"" error: non-nfc unicode sequence detected - --> $DIR/unicode.rs:12:12 + --> examples/unicode.rs:12:12 | 12 | print!("̀àh?"); | ^^^^^^^ | -note: lint level defined here - --> $DIR/unicode.rs:10:8 - | -10 | #[deny(unicode_not_nfc)] - | ^^^^^^^^^^^^^^^ + = note: `-D unicode-not-nfc` implied by `-D warnings` = help: Consider replacing the string with: ""̀àh?"" error: literal non-ASCII character detected - --> $DIR/unicode.rs:18:12 + --> examples/unicode.rs:18:12 | 18 | print!("Üben!"); | ^^^^^^^ | -note: lint level defined here - --> $DIR/unicode.rs:16:8 - | -16 | #[deny(non_ascii_literal)] - | ^^^^^^^^^^^^^^^^^ + = note: `-D non-ascii-literal` implied by `-D warnings` = help: Consider replacing the string with: - ""/u{dc}ben!"" + ""\u{dc}ben!"" error: aborting due to 3 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/unit_cmp.rs b/clippy_tests/examples/unit_cmp.rs similarity index 94% rename from tests/ui/unit_cmp.rs rename to clippy_tests/examples/unit_cmp.rs index d5176a5eaca..ff57d2822cb 100644 --- a/tests/ui/unit_cmp.rs +++ b/clippy_tests/examples/unit_cmp.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(unit_cmp)] +#![warn(unit_cmp)] #![allow(no_effect, unnecessary_operation)] #[derive(PartialEq)] diff --git a/tests/ui/unit_cmp.stderr b/clippy_tests/examples/unit_cmp.stderr similarity index 57% rename from tests/ui/unit_cmp.stderr rename to clippy_tests/examples/unit_cmp.stderr index fa5f108fad8..2853cdd3d6b 100644 --- a/tests/ui/unit_cmp.stderr +++ b/clippy_tests/examples/unit_cmp.stderr @@ -1,20 +1,21 @@ error: ==-comparison of unit values detected. This will always be true - --> $DIR/unit_cmp.rs:16:8 + --> examples/unit_cmp.rs:16:8 | 16 | if { true; } == { false; } { | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/unit_cmp.rs:4:9 - | -4 | #![deny(unit_cmp)] - | ^^^^^^^^ + = note: `-D unit-cmp` implied by `-D warnings` error: >-comparison of unit values detected. This will always be false - --> $DIR/unit_cmp.rs:19:8 + --> examples/unit_cmp.rs:19:8 | 19 | if { true; } > { false; } { | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D unit-cmp` 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. diff --git a/tests/ui/unneeded_field_pattern.rs b/clippy_tests/examples/unneeded_field_pattern.rs similarity index 92% rename from tests/ui/unneeded_field_pattern.rs rename to clippy_tests/examples/unneeded_field_pattern.rs index 9c1661e99ce..c2f5b11e24c 100644 --- a/tests/ui/unneeded_field_pattern.rs +++ b/clippy_tests/examples/unneeded_field_pattern.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(unneeded_field_pattern)] +#![warn(unneeded_field_pattern)] #[allow(dead_code, unused)] struct Foo { diff --git a/tests/ui/unneeded_field_pattern.stderr b/clippy_tests/examples/unneeded_field_pattern.stderr similarity index 59% rename from tests/ui/unneeded_field_pattern.stderr rename to clippy_tests/examples/unneeded_field_pattern.stderr index fdf976fd519..2bd823f97ac 100644 --- a/tests/ui/unneeded_field_pattern.stderr +++ b/clippy_tests/examples/unneeded_field_pattern.stderr @@ -1,23 +1,23 @@ error: You matched a field with a wildcard pattern. Consider using `..` instead - --> $DIR/unneeded_field_pattern.rs:17:15 + --> examples/unneeded_field_pattern.rs:17:15 | 17 | Foo { a: _, b: 0, .. } => {} | ^^^^ | -note: lint level defined here - --> $DIR/unneeded_field_pattern.rs:4:9 - | -4 | #![deny(unneeded_field_pattern)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D unneeded-field-pattern` implied by `-D warnings` = help: Try with `Foo { b: 0, .. }` error: All the struct fields are matched to a wildcard pattern, consider using `..`. - --> $DIR/unneeded_field_pattern.rs:19:9 + --> examples/unneeded_field_pattern.rs:19:9 | 19 | Foo { a: _, b: _, c: _ } => {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `-D unneeded-field-pattern` implied by `-D warnings` = help: Try with `Foo { .. }` instead error: aborting due to 2 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/unsafe_removed_from_name.rs b/clippy_tests/examples/unsafe_removed_from_name.rs similarity index 95% rename from tests/ui/unsafe_removed_from_name.rs rename to clippy_tests/examples/unsafe_removed_from_name.rs index 98b9841c00a..8e90964da8c 100644 --- a/tests/ui/unsafe_removed_from_name.rs +++ b/clippy_tests/examples/unsafe_removed_from_name.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #![allow(unused_imports)] #![allow(dead_code)] -#![deny(unsafe_removed_from_name)] +#![warn(unsafe_removed_from_name)] use std::cell::{UnsafeCell as TotallySafeCell}; diff --git a/tests/ui/unsafe_removed_from_name.stderr b/clippy_tests/examples/unsafe_removed_from_name.stderr similarity index 60% rename from tests/ui/unsafe_removed_from_name.stderr rename to clippy_tests/examples/unsafe_removed_from_name.stderr index de34d88e503..5f4eb8e4b26 100644 --- a/tests/ui/unsafe_removed_from_name.stderr +++ b/clippy_tests/examples/unsafe_removed_from_name.stderr @@ -1,26 +1,29 @@ error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCell` - --> $DIR/unsafe_removed_from_name.rs:7:1 + --> examples/unsafe_removed_from_name.rs:7:1 | 7 | use std::cell::{UnsafeCell as TotallySafeCell}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/unsafe_removed_from_name.rs:5:9 - | -5 | #![deny(unsafe_removed_from_name)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D unsafe-removed-from-name` implied by `-D warnings` error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCellAgain` - --> $DIR/unsafe_removed_from_name.rs:9:1 + --> examples/unsafe_removed_from_name.rs:9:1 | 9 | use std::cell::UnsafeCell as TotallySafeCellAgain; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D unsafe-removed-from-name` implied by `-D warnings` error: removed "unsafe" from the name of `Unsafe` in use as `LieAboutModSafety` - --> $DIR/unsafe_removed_from_name.rs:23:1 + --> examples/unsafe_removed_from_name.rs:23:1 | 23 | use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D unsafe-removed-from-name` 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. diff --git a/tests/ui/unused_io_amount.rs b/clippy_tests/examples/unused_io_amount.rs similarity index 95% rename from tests/ui/unused_io_amount.rs rename to clippy_tests/examples/unused_io_amount.rs index 0ee9069a17c..9beec63a6f0 100644 --- a/tests/ui/unused_io_amount.rs +++ b/clippy_tests/examples/unused_io_amount.rs @@ -2,6 +2,7 @@ #![plugin(clippy)] #![allow(dead_code)] +#![warn(unused_io_amount)] use std::io; diff --git a/clippy_tests/examples/unused_io_amount.stderr b/clippy_tests/examples/unused_io_amount.stderr new file mode 100644 index 00000000000..5c455f5a94b --- /dev/null +++ b/clippy_tests/examples/unused_io_amount.stderr @@ -0,0 +1,55 @@ +error: handle written amount returned or use `Write::write_all` instead + --> examples/unused_io_amount.rs:11:5 + | +11 | try!(s.write(b"test")); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D unused-io-amount` implied by `-D warnings` + = note: this error originates in a macro outside of the current crate + +error: handle read amount returned or use `Read::read_exact` instead + --> examples/unused_io_amount.rs:13:5 + | +13 | try!(s.read(&mut buf)); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D unused-io-amount` implied by `-D warnings` + = note: this error originates in a macro outside of the current crate + +error: handle written amount returned or use `Write::write_all` instead + --> examples/unused_io_amount.rs:18:5 + | +18 | s.write(b"test")?; + | ^^^^^^^^^^^^^^^^^ + | + = note: `-D unused-io-amount` implied by `-D warnings` + +error: handle read amount returned or use `Read::read_exact` instead + --> examples/unused_io_amount.rs:20:5 + | +20 | s.read(&mut buf)?; + | ^^^^^^^^^^^^^^^^^ + | + = note: `-D unused-io-amount` implied by `-D warnings` + +error: handle written amount returned or use `Write::write_all` instead + --> examples/unused_io_amount.rs:25:5 + | +25 | s.write(b"test").unwrap(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D unused-io-amount` implied by `-D warnings` + +error: handle read amount returned or use `Read::read_exact` instead + --> examples/unused_io_amount.rs:27:5 + | +27 | s.read(&mut buf).unwrap(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D unused-io-amount` 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. diff --git a/tests/ui/unused_labels.rs b/clippy_tests/examples/unused_labels.rs similarity index 95% rename from tests/ui/unused_labels.rs rename to clippy_tests/examples/unused_labels.rs index 1eb067e9684..6d1e8c2a31c 100644 --- a/tests/ui/unused_labels.rs +++ b/clippy_tests/examples/unused_labels.rs @@ -2,7 +2,7 @@ #![feature(plugin)] #![allow(dead_code, items_after_statements, never_loop)] -#![deny(unused_label)] +#![warn(unused_label)] fn unused_label() { 'label: for i in 1..2 { diff --git a/tests/ui/unused_labels.stderr b/clippy_tests/examples/unused_labels.stderr similarity index 52% rename from tests/ui/unused_labels.stderr rename to clippy_tests/examples/unused_labels.stderr index 8dce245ecc0..85edc26498f 100644 --- a/tests/ui/unused_labels.stderr +++ b/clippy_tests/examples/unused_labels.stderr @@ -1,30 +1,33 @@ error: unused label `'label` - --> $DIR/unused_labels.rs:8:5 + --> examples/unused_labels.rs:8:5 | 8 | / 'label: for i in 1..2 { 9 | | if i > 4 { continue } 10 | | } | |_____^ | -note: lint level defined here - --> $DIR/unused_labels.rs:5:9 - | -5 | #![deny(unused_label)] - | ^^^^^^^^^^^^ + = note: `-D unused-label` implied by `-D warnings` error: unused label `'a` - --> $DIR/unused_labels.rs:21:5 + --> examples/unused_labels.rs:21:5 | 21 | 'a: loop { break } | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D unused-label` implied by `-D warnings` error: unused label `'same_label_in_two_fns` - --> $DIR/unused_labels.rs:32:5 + --> examples/unused_labels.rs:32:5 | 32 | / 'same_label_in_two_fns: loop { 33 | | let _ = 1; 34 | | } | |_____^ + | + = note: `-D unused-label` 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. diff --git a/tests/ui/unused_lt.rs b/clippy_tests/examples/unused_lt.rs similarity index 97% rename from tests/ui/unused_lt.rs rename to clippy_tests/examples/unused_lt.rs index b4462a87ab4..722e19e6217 100644 --- a/tests/ui/unused_lt.rs +++ b/clippy_tests/examples/unused_lt.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] #![allow(unused, dead_code, needless_lifetimes, needless_pass_by_value)] -#![deny(unused_lifetimes)] +#![warn(unused_lifetimes)] fn empty() { diff --git a/tests/ui/unused_lt.stderr b/clippy_tests/examples/unused_lt.stderr similarity index 53% rename from tests/ui/unused_lt.stderr rename to clippy_tests/examples/unused_lt.stderr index 1e13f4c80b4..1afe801bd26 100644 --- a/tests/ui/unused_lt.stderr +++ b/clippy_tests/examples/unused_lt.stderr @@ -1,26 +1,29 @@ error: this lifetime isn't used in the function definition - --> $DIR/unused_lt.rs:16:14 + --> examples/unused_lt.rs:16:14 | 16 | fn unused_lt<'a>(x: u8) { | ^^ | -note: lint level defined here - --> $DIR/unused_lt.rs:4:9 - | -4 | #![deny(unused_lifetimes)] - | ^^^^^^^^^^^^^^^^ + = note: `-D unused-lifetimes` implied by `-D warnings` error: this lifetime isn't used in the function definition - --> $DIR/unused_lt.rs:20:25 + --> examples/unused_lt.rs:20:25 | 20 | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) { | ^^ + | + = note: `-D unused-lifetimes` implied by `-D warnings` error: this lifetime isn't used in the function definition - --> $DIR/unused_lt.rs:50:10 + --> examples/unused_lt.rs:50:10 | 50 | fn x<'a>(&self) {} | ^^ + | + = note: `-D unused-lifetimes` 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. diff --git a/tests/ui/used_underscore_binding.rs b/clippy_tests/examples/used_underscore_binding.rs similarity index 97% rename from tests/ui/used_underscore_binding.rs rename to clippy_tests/examples/used_underscore_binding.rs index 21d91bab689..d8fc7c7cbca 100644 --- a/tests/ui/used_underscore_binding.rs +++ b/clippy_tests/examples/used_underscore_binding.rs @@ -1,9 +1,9 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(blacklisted_name)] -#![deny(used_underscore_binding)] +#![warn(used_underscore_binding)] macro_rules! test_macro { () => {{ diff --git a/tests/ui/used_underscore_binding.stderr b/clippy_tests/examples/used_underscore_binding.stderr similarity index 59% rename from tests/ui/used_underscore_binding.stderr rename to clippy_tests/examples/used_underscore_binding.stderr index f532b4c9022..4ec01d8b8c0 100644 --- a/tests/ui/used_underscore_binding.stderr +++ b/clippy_tests/examples/used_underscore_binding.stderr @@ -1,38 +1,45 @@ error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:17:5 + --> examples/used_underscore_binding.rs:17:5 | 17 | _foo + 1 | ^^^^ | -note: lint level defined here - --> $DIR/used_underscore_binding.rs:6:9 - | -6 | #![deny(used_underscore_binding)] - | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D used-underscore-binding` implied by `-D warnings` error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:22:20 + --> examples/used_underscore_binding.rs:22:20 | 22 | println!("{}", _foo); | ^^^^ + | + = note: `-D used-underscore-binding` implied by `-D warnings` error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:23:16 + --> examples/used_underscore_binding.rs:23:16 | 23 | assert_eq!(_foo, _foo); | ^^^^ + | + = note: `-D used-underscore-binding` implied by `-D warnings` error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:23:22 + --> examples/used_underscore_binding.rs:23:22 | 23 | assert_eq!(_foo, _foo); | ^^^^ + | + = note: `-D used-underscore-binding` implied by `-D warnings` error: used binding `_underscore_field` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:36:5 + --> examples/used_underscore_binding.rs:36:5 | 36 | s._underscore_field += 1; | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D used-underscore-binding` 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. diff --git a/tests/ui/useless_attribute.rs b/clippy_tests/examples/useless_attribute.rs similarity index 92% rename from tests/ui/useless_attribute.rs rename to clippy_tests/examples/useless_attribute.rs index 0e30048163f..332cc09cfea 100644 --- a/tests/ui/useless_attribute.rs +++ b/clippy_tests/examples/useless_attribute.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(useless_attribute)] +#![warn(useless_attribute)] #[allow(dead_code)] extern crate clippy_lints; diff --git a/clippy_tests/examples/useless_attribute.stderr b/clippy_tests/examples/useless_attribute.stderr new file mode 100644 index 00000000000..bd318601b31 --- /dev/null +++ b/clippy_tests/examples/useless_attribute.stderr @@ -0,0 +1,11 @@ +error[E0463]: can't find crate for `clippy_lints` + --> examples/useless_attribute.rs:6:1 + | +6 | extern crate clippy_lints; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate + +error: aborting due to previous error + +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/vec.rs b/clippy_tests/examples/vec.rs similarity index 97% rename from tests/ui/vec.rs rename to clippy_tests/examples/vec.rs index f86137622b6..1845b509af0 100644 --- a/tests/ui/vec.rs +++ b/clippy_tests/examples/vec.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(useless_vec)] +#![warn(useless_vec)] #[derive(Debug)] struct NonCopy; diff --git a/tests/ui/vec.stderr b/clippy_tests/examples/vec.stderr similarity index 59% rename from tests/ui/vec.stderr rename to clippy_tests/examples/vec.stderr index 5243d882baa..02cc6911d50 100644 --- a/tests/ui/vec.stderr +++ b/clippy_tests/examples/vec.stderr @@ -1,44 +1,53 @@ error: useless use of `vec!` - --> $DIR/vec.rs:24:14 + --> examples/vec.rs:24:14 | 24 | on_slice(&vec![]); | ^^^^^^^ help: you can use a slice directly `&[]` | -note: lint level defined here - --> $DIR/vec.rs:4:9 - | -4 | #![deny(useless_vec)] - | ^^^^^^^^^^^ + = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> $DIR/vec.rs:27:14 + --> examples/vec.rs:27:14 | 27 | on_slice(&vec![1, 2]); | ^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` + | + = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> $DIR/vec.rs:30:14 + --> examples/vec.rs:30:14 | 30 | on_slice(&vec ![1, 2]); | ^^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` + | + = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> $DIR/vec.rs:33:14 + --> examples/vec.rs:33:14 | 33 | on_slice(&vec!(1, 2)); | ^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` + | + = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> $DIR/vec.rs:36:14 + --> examples/vec.rs:36:14 | 36 | on_slice(&vec![1; 2]); | ^^^^^^^^^^^ help: you can use a slice directly `&[1; 2]` + | + = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> $DIR/vec.rs:49:14 + --> examples/vec.rs:49:14 | 49 | for a in vec![1, 2, 3] { | ^^^^^^^^^^^^^ help: you can use a slice directly `&[1, 2, 3]` + | + = note: `-D useless-vec` 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. diff --git a/tests/ui/while_loop.rs b/clippy_tests/examples/while_loop.rs similarity index 98% rename from tests/ui/while_loop.rs rename to clippy_tests/examples/while_loop.rs index ddf1d6413cd..42b9d75b084 100644 --- a/tests/ui/while_loop.rs +++ b/clippy_tests/examples/while_loop.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(while_let_loop, empty_loop, while_let_on_iterator)] +#![warn(while_let_loop, empty_loop, while_let_on_iterator)] #![allow(dead_code, never_loop, unused, cyclomatic_complexity)] fn main() { diff --git a/tests/ui/while_loop.stderr b/clippy_tests/examples/while_loop.stderr similarity index 71% rename from tests/ui/while_loop.stderr rename to clippy_tests/examples/while_loop.stderr index a942693b469..ae7675ad22d 100644 --- a/tests/ui/while_loop.stderr +++ b/clippy_tests/examples/while_loop.stderr @@ -1,5 +1,5 @@ error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:9:5 + --> examples/while_loop.rs:9:5 | 9 | / loop { 10 | | if let Some(_x) = y { @@ -10,14 +10,10 @@ error: this loop could be written as a `while let` loop 15 | | } | |_____^ help: try `while let Some(_x) = y { .. }` | -note: lint level defined here - --> $DIR/while_loop.rs:4:9 - | -4 | #![deny(while_let_loop, empty_loop, while_let_on_iterator)] - | ^^^^^^^^^^^^^^ + = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:22:5 + --> examples/while_loop.rs:22:5 | 22 | / loop { 23 | | match y { @@ -26,9 +22,11 @@ error: this loop could be written as a `while let` loop 26 | | }; 27 | | } | |_____^ help: try `while let Some(_x) = y { .. }` + | + = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:28:5 + --> examples/while_loop.rs:28:5 | 28 | / loop { 29 | | let x = match y { @@ -38,9 +36,11 @@ error: this loop could be written as a `while let` loop 34 | | let _str = "foo"; 35 | | } | |_____^ help: try `while let Some(x) = y { .. }` + | + = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:36:5 + --> examples/while_loop.rs:36:5 | 36 | / loop { 37 | | let x = match y { @@ -50,9 +50,11 @@ error: this loop could be written as a `while let` loop 42 | | { let _b = "foobar"; } 43 | | } | |_____^ help: try `while let Some(x) = y { .. }` + | + = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:58:5 + --> examples/while_loop.rs:58:5 | 58 | / loop { 59 | | let (e, l) = match "".split_whitespace().next() { @@ -62,37 +64,39 @@ error: this loop could be written as a `while let` loop 64 | | let _ = (e, l); 65 | | } | |_____^ help: try `while let Some(word) = "".split_whitespace().next() { .. }` + | + = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `for` loop - --> $DIR/while_loop.rs:68:5 + --> examples/while_loop.rs:68:5 | 68 | / while let Option::Some(x) = iter.next() { 69 | | println!("{}", x); 70 | | } | |_____^ help: try `for x in iter { .. }` | -note: lint level defined here - --> $DIR/while_loop.rs:4:37 - | -4 | #![deny(while_let_loop, empty_loop, while_let_on_iterator)] - | ^^^^^^^^^^^^^^^^^^^^^ + = note: `-D while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `for` loop - --> $DIR/while_loop.rs:73:5 + --> examples/while_loop.rs:73:5 | 73 | / while let Some(x) = iter.next() { 74 | | println!("{}", x); 75 | | } | |_____^ help: try `for x in iter { .. }` + | + = note: `-D while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `for` loop - --> $DIR/while_loop.rs:78:5 + --> examples/while_loop.rs:78:5 | 78 | while let Some(_) = iter.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `for _ in iter { .. }` + | + = note: `-D while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:118:5 + --> examples/while_loop.rs:118:5 | 118 | / loop { 119 | | let _ = match iter.next() { @@ -102,18 +106,19 @@ error: this loop could be written as a `while let` loop 123 | | loop {} 124 | | } | |_____^ help: try `while let Some(ele) = iter.next() { .. }` + | + = note: `-D while-let-loop` implied by `-D warnings` error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body. - --> $DIR/while_loop.rs:123:9 + --> examples/while_loop.rs:123:9 | 123 | loop {} | ^^^^^^^ | -note: lint level defined here - --> $DIR/while_loop.rs:4:25 - | -4 | #![deny(while_let_loop, empty_loop, while_let_on_iterator)] - | ^^^^^^^^^^ + = note: `-D empty-loop` implied by `-D warnings` error: aborting due to 10 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/wrong_macro_span.rs_ b/clippy_tests/examples/wrong_macro_span.rs_ similarity index 96% rename from tests/ui/wrong_macro_span.rs_ rename to clippy_tests/examples/wrong_macro_span.rs_ index 040615d067e..5bc9f0883bb 100644 --- a/tests/ui/wrong_macro_span.rs_ +++ b/clippy_tests/examples/wrong_macro_span.rs_ @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(clippy)] +#![warn(clippy)] #![allow(unused, if_let_redundant_pattern_matching)] fn main() { diff --git a/tests/ui/wrong_self_convention.rs b/clippy_tests/examples/wrong_self_convention.rs similarity index 94% rename from tests/ui/wrong_self_convention.rs rename to clippy_tests/examples/wrong_self_convention.rs index 8e81679aaab..0fbe4eff6d6 100644 --- a/tests/ui/wrong_self_convention.rs +++ b/clippy_tests/examples/wrong_self_convention.rs @@ -1,8 +1,8 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(wrong_self_convention)] -#![deny(wrong_pub_self_convention)] +#![warn(wrong_self_convention)] +#![warn(wrong_pub_self_convention)] #![allow(dead_code)] fn main() {} diff --git a/tests/ui/wrong_self_convention.stderr b/clippy_tests/examples/wrong_self_convention.stderr similarity index 58% rename from tests/ui/wrong_self_convention.stderr rename to clippy_tests/examples/wrong_self_convention.stderr index cbee5bd45a2..1d383b07804 100644 --- a/tests/ui/wrong_self_convention.stderr +++ b/clippy_tests/examples/wrong_self_convention.stderr @@ -1,80 +1,101 @@ error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:21:17 + --> examples/wrong_self_convention.rs:21:17 | 21 | fn from_i32(self) {} | ^^^^ | -note: lint level defined here - --> $DIR/wrong_self_convention.rs:4:9 - | -4 | #![deny(wrong_self_convention)] - | ^^^^^^^^^^^^^^^^^^^^^ + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:27:21 + --> examples/wrong_self_convention.rs:27:21 | 27 | pub fn from_i64(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:38:15 + --> examples/wrong_self_convention.rs:38:15 | 38 | fn as_i32(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:40:17 + --> examples/wrong_self_convention.rs:40:17 | 40 | fn into_i32(&self) {} | ^^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:42:15 + --> examples/wrong_self_convention.rs:42:15 | 42 | fn is_i32(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:44:15 + --> examples/wrong_self_convention.rs:44:15 | 44 | fn to_i32(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:46:17 + --> examples/wrong_self_convention.rs:46:17 | 46 | fn from_i32(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:48:19 + --> examples/wrong_self_convention.rs:48:19 | 48 | pub fn as_i64(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:49:21 + --> examples/wrong_self_convention.rs:49:21 | 49 | pub fn into_i64(&self) {} | ^^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:50:19 + --> examples/wrong_self_convention.rs:50:19 | 50 | pub fn is_i64(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:51:19 + --> examples/wrong_self_convention.rs:51:19 | 51 | pub fn to_i64(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:52:21 + --> examples/wrong_self_convention.rs:52:21 | 52 | pub fn from_i64(self) {} | ^^^^ + | + = note: `-D wrong-self-convention` 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. diff --git a/tests/ui/zero_div_zero.rs b/clippy_tests/examples/zero_div_zero.rs similarity index 93% rename from tests/ui/zero_div_zero.rs rename to clippy_tests/examples/zero_div_zero.rs index 22253476c23..af61e1c8429 100644 --- a/tests/ui/zero_div_zero.rs +++ b/clippy_tests/examples/zero_div_zero.rs @@ -2,7 +2,7 @@ #![plugin(clippy)] #[allow(unused_variables)] -#[deny(zero_divided_by_zero)] +#[warn(zero_divided_by_zero)] fn main() { let nan = 0.0 / 0.0; let f64_nan = 0.0 / 0.0f64; diff --git a/tests/ui/zero_div_zero.stderr b/clippy_tests/examples/zero_div_zero.stderr similarity index 55% rename from tests/ui/zero_div_zero.stderr rename to clippy_tests/examples/zero_div_zero.stderr index 4853c2dc70c..cc1e40fdb0e 100644 --- a/tests/ui/zero_div_zero.stderr +++ b/clippy_tests/examples/zero_div_zero.stderr @@ -1,71 +1,73 @@ -warning: equal expressions as operands to `/` - --> $DIR/zero_div_zero.rs:7:15 +error: equal expressions as operands to `/` + --> examples/zero_div_zero.rs:7:15 | 7 | let nan = 0.0 / 0.0; | ^^^^^^^^^ | - = note: #[warn(eq_op)] on by default + = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> $DIR/zero_div_zero.rs:7:15 + --> examples/zero_div_zero.rs:7:15 | 7 | let nan = 0.0 / 0.0; | ^^^^^^^^^ | -note: lint level defined here - --> $DIR/zero_div_zero.rs:5:8 - | -5 | #[deny(zero_divided_by_zero)] - | ^^^^^^^^^^^^^^^^^^^^ + = note: `-D zero-divided-by-zero` implied by `-D warnings` = help: Consider using `std::f32::NAN` if you would like a constant representing NaN -warning: equal expressions as operands to `/` - --> $DIR/zero_div_zero.rs:8:19 +error: equal expressions as operands to `/` + --> examples/zero_div_zero.rs:8:19 | 8 | let f64_nan = 0.0 / 0.0f64; | ^^^^^^^^^^^^ | - = note: #[warn(eq_op)] on by default + = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> $DIR/zero_div_zero.rs:8:19 + --> examples/zero_div_zero.rs:8:19 | 8 | let f64_nan = 0.0 / 0.0f64; | ^^^^^^^^^^^^ | + = note: `-D zero-divided-by-zero` implied by `-D warnings` = help: Consider using `std::f64::NAN` if you would like a constant representing NaN -warning: equal expressions as operands to `/` - --> $DIR/zero_div_zero.rs:9:25 +error: equal expressions as operands to `/` + --> examples/zero_div_zero.rs:9:25 | 9 | let other_f64_nan = 0.0f64 / 0.0; | ^^^^^^^^^^^^ | - = note: #[warn(eq_op)] on by default + = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> $DIR/zero_div_zero.rs:9:25 + --> examples/zero_div_zero.rs:9:25 | 9 | let other_f64_nan = 0.0f64 / 0.0; | ^^^^^^^^^^^^ | + = note: `-D zero-divided-by-zero` implied by `-D warnings` = help: Consider using `std::f64::NAN` if you would like a constant representing NaN -warning: equal expressions as operands to `/` - --> $DIR/zero_div_zero.rs:10:28 +error: equal expressions as operands to `/` + --> examples/zero_div_zero.rs:10:28 | 10 | let one_more_f64_nan = 0.0f64/0.0f64; | ^^^^^^^^^^^^^ | - = note: #[warn(eq_op)] on by default + = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> $DIR/zero_div_zero.rs:10:28 + --> examples/zero_div_zero.rs:10:28 | 10 | let one_more_f64_nan = 0.0f64/0.0f64; | ^^^^^^^^^^^^^ | + = note: `-D zero-divided-by-zero` implied by `-D warnings` = help: Consider using `std::f64::NAN` if you would like a constant representing NaN -error: aborting due to 4 previous errors +error: aborting due to 8 previous errors +error: Could not compile `clippy_tests`. + +To learn more, run the command again with --verbose. diff --git a/tests/ui/zero_ptr.rs b/clippy_tests/examples/zero_ptr.rs similarity index 100% rename from tests/ui/zero_ptr.rs rename to clippy_tests/examples/zero_ptr.rs diff --git a/clippy_tests/examples/zero_ptr.stderr b/clippy_tests/examples/zero_ptr.stderr new file mode 100644 index 00000000000..bf2b31f6427 --- /dev/null +++ b/clippy_tests/examples/zero_ptr.stderr @@ -0,0 +1,21 @@ +error: `0 as *const _` detected. Consider using `ptr::null()` + --> examples/zero_ptr.rs:6:13 + | +6 | let x = 0 as *const usize; + | ^^^^^^^^^^^^^^^^^ + | + = note: `-D zero-ptr` implied by `-D warnings` + +error: `0 as *mut _` detected. Consider using `ptr::null_mut()` + --> examples/zero_ptr.rs:7:13 + | +7 | let y = 0 as *mut f64; + | ^^^^^^^^^^^^^ + | + = note: `-D zero-ptr` 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. diff --git a/clippy_tests/src/lib.rs b/clippy_tests/src/lib.rs new file mode 100644 index 00000000000..cdfbe1aa562 --- /dev/null +++ b/clippy_tests/src/lib.rs @@ -0,0 +1,6 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + } +} diff --git a/tests/examples.rs b/tests/examples.rs new file mode 100644 index 00000000000..e1ec0ae75aa --- /dev/null +++ b/tests/examples.rs @@ -0,0 +1,31 @@ +#[macro_use] +extern crate duct; + +#[test] +fn compile_test() { + let mut error = false; + for file in std::fs::read_dir("clippy_tests/examples").unwrap() { + let file = file.unwrap().path(); + // only test *.rs files + if file.extension().map_or(true, |file| file != "rs") { + continue; + } + cmd!("touch", &file).run().unwrap(); + let output = file.with_extension("stderr"); + cmd!("cargo", "rustc", "-q", "--example", file.file_stem().unwrap(), "--", "-Dwarnings") + .unchecked() + .stderr(&output) + .env("CLIPPY_DISABLE_WIKI_LINKS", "true") + .dir("clippy_tests") + .run() + .unwrap(); + print!("testing {}... ", file.file_stem().unwrap().to_str().unwrap()); + if cmd!("git", "diff", "--exit-code", output).run().is_err() { + error = true; + println!("ERROR"); + } else { + println!("ok"); + } + } + assert!(!error, "A test failed"); +} diff --git a/tests/ui/arithmetic.stderr b/tests/ui/arithmetic.stderr deleted file mode 100644 index c94ba02698b..00000000000 --- a/tests/ui/arithmetic.stderr +++ /dev/null @@ -1,81 +0,0 @@ -error: integer arithmetic detected - --> $DIR/arithmetic.rs:8:5 - | -8 | 1 + i; - | ^^^^^ - | -note: lint level defined here - --> $DIR/arithmetic.rs:4:9 - | -4 | #![deny(integer_arithmetic, float_arithmetic)] - | ^^^^^^^^^^^^^^^^^^ - -error: integer arithmetic detected - --> $DIR/arithmetic.rs:9:5 - | -9 | i * 2; - | ^^^^^ - -error: integer arithmetic detected - --> $DIR/arithmetic.rs:10:5 - | -10 | / 1 % -11 | | i / 2; // no error, this is part of the expression in the preceding line - | |_________^ - -error: integer arithmetic detected - --> $DIR/arithmetic.rs:12:5 - | -12 | i - 2 + 2 - i; - | ^^^^^^^^^^^^^ - -error: integer arithmetic detected - --> $DIR/arithmetic.rs:13:5 - | -13 | -i; - | ^^ - -error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:23:5 - | -23 | f * 2.0; - | ^^^^^^^ - | -note: lint level defined here - --> $DIR/arithmetic.rs:4:29 - | -4 | #![deny(integer_arithmetic, float_arithmetic)] - | ^^^^^^^^^^^^^^^^ - -error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:25:5 - | -25 | 1.0 + f; - | ^^^^^^^ - -error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:26:5 - | -26 | f * 2.0; - | ^^^^^^^ - -error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:27:5 - | -27 | f / 2.0; - | ^^^^^^^ - -error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:28:5 - | -28 | f - 2.0 * 4.2; - | ^^^^^^^^^^^^^ - -error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:29:5 - | -29 | -f; - | ^^ - -error: aborting due to 11 previous errors - diff --git a/tests/ui/array_indexing.stderr b/tests/ui/array_indexing.stderr deleted file mode 100644 index 0650866ccdb..00000000000 --- a/tests/ui/array_indexing.stderr +++ /dev/null @@ -1,152 +0,0 @@ -error: const index is out of bounds - --> $DIR/array_indexing.rs:12:5 - | -12 | x[4]; - | ^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: const index is out of bounds - --> $DIR/array_indexing.rs:13:5 - | -13 | x[1 << 3]; - | ^^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:14:6 - | -14 | &x[1..5]; - | ^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:16:6 - | -16 | &x[0...4]; - | ^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:17:6 - | -17 | &x[...4]; - | ^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:21:6 - | -21 | &x[5..]; - | ^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:23:6 - | -23 | &x[..5]; - | ^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: indexing may panic - --> $DIR/array_indexing.rs:26:5 - | -26 | y[0]; - | ^^^^ - | -note: lint level defined here - --> $DIR/array_indexing.rs:4:9 - | -4 | #![deny(indexing_slicing)] - | ^^^^^^^^^^^^^^^^ - -error: slicing may panic - --> $DIR/array_indexing.rs:27:6 - | -27 | &y[1..2]; - | ^^^^^^^ - -error: slicing may panic - --> $DIR/array_indexing.rs:29:6 - | -29 | &y[0...4]; - | ^^^^^^^^ - -error: slicing may panic - --> $DIR/array_indexing.rs:30:6 - | -30 | &y[...4]; - | ^^^^^^^ - -error: const index is out of bounds - --> $DIR/array_indexing.rs:33:5 - | -33 | empty[0]; - | ^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:34:6 - | -34 | &empty[1..5]; - | ^^^^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:35:6 - | -35 | &empty[0...4]; - | ^^^^^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:36:6 - | -36 | &empty[...4]; - | ^^^^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:40:6 - | -40 | &empty[0...0]; - | ^^^^^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:41:6 - | -41 | &empty[...0]; - | ^^^^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:43:6 - | -43 | &empty[1..]; - | ^^^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: range is out of bounds - --> $DIR/array_indexing.rs:44:6 - | -44 | &empty[..4]; - | ^^^^^^^^^^ - | - = note: #[deny(out_of_bounds_indexing)] on by default - -error: aborting due to 19 previous errors - diff --git a/tests/ui/builtin-type-shadow.rs b/tests/ui/builtin-type-shadow.rs index bcf8a8dec71..a3609cfe104 100644 --- a/tests/ui/builtin-type-shadow.rs +++ b/tests/ui/builtin-type-shadow.rs @@ -1,6 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] -#![deny(builtin_type_shadow)] +#![warn(builtin_type_shadow)] fn foo(a: u32) -> u32 { 42 diff --git a/tests/ui/builtin-type-shadow.stderr b/tests/ui/builtin-type-shadow.stderr index 98cbd436686..269ff9a0eef 100644 --- a/tests/ui/builtin-type-shadow.stderr +++ b/tests/ui/builtin-type-shadow.stderr @@ -1,14 +1,10 @@ -error: This generic shadows the built-in type `u32` +warning: This generic shadows the built-in type `u32` --> $DIR/builtin-type-shadow.rs:5:8 | 5 | fn foo(a: u32) -> u32 { | ^^^ | -note: lint level defined here - --> $DIR/builtin-type-shadow.rs:3:9 - | -3 | #![deny(builtin_type_shadow)] - | ^^^^^^^^^^^^^^^^^^^ + = note: #[warn(builtin_type_shadow)] on by default error[E0308]: mismatched types --> $DIR/builtin-type-shadow.rs:6:5 diff --git a/tests/ui/conf_french_blacklisted_name.rs b/tests/ui/conf_french_blacklisted_name.rs index ccc53f0c07a..5bf1e896f5d 100644 --- a/tests/ui/conf_french_blacklisted_name.rs +++ b/tests/ui/conf_french_blacklisted_name.rs @@ -4,7 +4,7 @@ #![allow(dead_code)] #![allow(single_match)] #![allow(unused_variables)] -#![deny(blacklisted_name)] +#![warn(blacklisted_name)] fn test(toto: ()) {} diff --git a/tests/ui/conf_french_blacklisted_name.stderr b/tests/ui/conf_french_blacklisted_name.stderr index 244ba32c404..3d6926a9b88 100644 --- a/tests/ui/conf_french_blacklisted_name.stderr +++ b/tests/ui/conf_french_blacklisted_name.stderr @@ -1,50 +1,56 @@ -error: use of a blacklisted/placeholder name `toto` +warning: use of a blacklisted/placeholder name `toto` --> $DIR/conf_french_blacklisted_name.rs:9:9 | 9 | fn test(toto: ()) {} | ^^^^ | -note: lint level defined here - --> $DIR/conf_french_blacklisted_name.rs:7:9 - | -7 | #![deny(blacklisted_name)] - | ^^^^^^^^^^^^^^^^ + = note: #[warn(blacklisted_name)] on by default -error: use of a blacklisted/placeholder name `toto` +warning: use of a blacklisted/placeholder name `toto` --> $DIR/conf_french_blacklisted_name.rs:12:9 | 12 | let toto = 42; | ^^^^ + | + = note: #[warn(blacklisted_name)] on by default -error: use of a blacklisted/placeholder name `tata` +warning: use of a blacklisted/placeholder name `tata` --> $DIR/conf_french_blacklisted_name.rs:13:9 | 13 | let tata = 42; | ^^^^ + | + = note: #[warn(blacklisted_name)] on by default -error: use of a blacklisted/placeholder name `titi` +warning: use of a blacklisted/placeholder name `titi` --> $DIR/conf_french_blacklisted_name.rs:14:9 | 14 | let titi = 42; | ^^^^ + | + = note: #[warn(blacklisted_name)] on by default -error: use of a blacklisted/placeholder name `toto` +warning: use of a blacklisted/placeholder name `toto` --> $DIR/conf_french_blacklisted_name.rs:20:10 | 20 | (toto, Some(tata), titi @ Some(_)) => (), | ^^^^ + | + = note: #[warn(blacklisted_name)] on by default -error: use of a blacklisted/placeholder name `tata` +warning: use of a blacklisted/placeholder name `tata` --> $DIR/conf_french_blacklisted_name.rs:20:21 | 20 | (toto, Some(tata), titi @ Some(_)) => (), | ^^^^ + | + = note: #[warn(blacklisted_name)] on by default -error: use of a blacklisted/placeholder name `titi` +warning: use of a blacklisted/placeholder name `titi` --> $DIR/conf_french_blacklisted_name.rs:20:28 | 20 | (toto, Some(tata), titi @ Some(_)) => (), | ^^^^ - -error: aborting due to 7 previous errors + | + = note: #[warn(blacklisted_name)] on by default diff --git a/tests/ui/copies.stderr b/tests/ui/copies.stderr deleted file mode 100644 index c9ad01f335e..00000000000 --- a/tests/ui/copies.stderr +++ /dev/null @@ -1,479 +0,0 @@ -warning: This else block is redundant. - - --> $DIR/copies.rs:121:20 - | -121 | } else { - | ____________________^ -122 | | continue; -123 | | } - | |_____________^ - | - = note: #[warn(needless_continue)] on by default - = 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... - } - - -warning: This else block is redundant. - - --> $DIR/copies.rs:131:20 - | -131 | } else { - | ____________________^ -132 | | continue; -133 | | } - | |_____________^ - | - = note: #[warn(needless_continue)] on by default - = 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 `if` has identical blocks - --> $DIR/copies.rs:39:10 - | -39 | else { - | __________^ -40 | | Foo { bar: 42 }; -41 | | 0..10; -42 | | ..; -... | -46 | | foo(); -47 | | } - | |_____^ - | -note: lint level defined here - --> $DIR/copies.rs:27:8 - | -27 | #[deny(if_same_then_else)] - | ^^^^^^^^^^^^^^^^^ -note: same as this - --> $DIR/copies.rs:30:13 - | -30 | if true { - | _____________^ -31 | | Foo { bar: 42 }; -32 | | 0..10; -33 | | ..; -... | -37 | | foo(); -38 | | } - | |_____^ - -error: this `match` has identical arm bodies - --> $DIR/copies.rs:88:14 - | -88 | _ => { - | ______________^ -89 | | foo(); -90 | | let mut a = 42 + [23].len() as i32; -91 | | if true { -... | -95 | | a -96 | | } - | |_________^ - | -note: lint level defined here - --> $DIR/copies.rs:28:8 - | -28 | #[deny(match_same_arms)] - | ^^^^^^^^^^^^^^^ -note: same as this - --> $DIR/copies.rs:79:15 - | -79 | 42 => { - | _______________^ -80 | | foo(); -81 | | let mut a = 42 + [23].len() as i32; -82 | | if true { -... | -86 | | a -87 | | } - | |_________^ -note: `42` has the same arm body as the `_` wildcard, consider removing it` - --> $DIR/copies.rs:79:15 - | -79 | 42 => { - | _______________^ -80 | | foo(); -81 | | let mut a = 42 + [23].len() as i32; -82 | | if true { -... | -86 | | a -87 | | } - | |_________^ - -error: this `match` has identical arm bodies - --> $DIR/copies.rs:102:14 - | -102 | _ => 0, - | ^ - | -note: same as this - --> $DIR/copies.rs:100:19 - | -100 | Abc::A => 0, - | ^ -note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it` - --> $DIR/copies.rs:100:19 - | -100 | Abc::A => 0, - | ^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:112:10 - | -112 | else { - | __________^ -113 | | 42 -114 | | }; - | |_____^ - | -note: same as this - --> $DIR/copies.rs:109:21 - | -109 | let _ = if true { - | _____________________^ -110 | | 42 -111 | | } - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:126:10 - | -126 | else { - | __________^ -127 | | for _ in &[42] { -128 | | let foo: &Option<_> = &Some::(42); -129 | | if true { -... | -134 | | } -135 | | } - | |_____^ - | -note: same as this - --> $DIR/copies.rs:116:13 - | -116 | if true { - | _____________^ -117 | | for _ in &[42] { -118 | | let foo: &Option<_> = &Some::(42); -119 | | if true { -... | -124 | | } -125 | | } - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:148:10 - | -148 | else { - | __________^ -149 | | let bar = if true { -150 | | 42 -151 | | } -... | -157 | | bar + 1; -158 | | } - | |_____^ - | -note: same as this - --> $DIR/copies.rs:137:13 - | -137 | if true { - | _____________^ -138 | | let bar = if true { -139 | | 42 -140 | | } -... | -146 | | bar + 1; -147 | | } - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:171:19 - | -171 | else if foo() { - | ___________________^ -172 | | let _ = match 42 { -173 | | 42 => 1, -174 | | a if a > 0 => 2, -... | -177 | | }; -178 | | } - | |_____^ - | -note: same as this - --> $DIR/copies.rs:160:13 - | -160 | if true { - | _____________^ -161 | | let _ = match 42 { -162 | | 42 => 1, -163 | | a if a > 0 => 2, -... | -166 | | }; -167 | | } - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:183:10 - | -183 | else { - | __________^ -184 | | if let Some(a) = Some(42) {} -185 | | } - | |_____^ - | -note: same as this - --> $DIR/copies.rs:180:13 - | -180 | if true { - | _____________^ -181 | | if let Some(a) = Some(42) {} -182 | | } - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:190:10 - | -190 | else { - | __________^ -191 | | if let (1, .., 3) = (1, 2, 3) {} -192 | | } - | |_____^ - | -note: same as this - --> $DIR/copies.rs:187:13 - | -187 | if true { - | _____________^ -188 | | if let (1, .., 3) = (1, 2, 3) {} -189 | | } - | |_____^ - -error: this `match` has identical arm bodies - --> $DIR/copies.rs:245:15 - | -245 | 51 => foo(), - | ^^^^^ - | -note: same as this - --> $DIR/copies.rs:244:15 - | -244 | 42 => foo(), - | ^^^^^ -note: consider refactoring into `42 | 51` - --> $DIR/copies.rs:244:15 - | -244 | 42 => foo(), - | ^^^^^ - -error: this `match` has identical arm bodies - --> $DIR/copies.rs:251:17 - | -251 | None => 24, - | ^^ - | -note: same as this - --> $DIR/copies.rs:250:20 - | -250 | Some(_) => 24, - | ^^ -note: consider refactoring into `Some(_) | None` - --> $DIR/copies.rs:250:20 - | -250 | Some(_) => 24, - | ^^ - -error: this `match` has identical arm bodies - --> $DIR/copies.rs:273:28 - | -273 | (None, Some(a)) => bar(a), - | ^^^^^^ - | -note: same as this - --> $DIR/copies.rs:272:28 - | -272 | (Some(a), None) => bar(a), - | ^^^^^^ -note: consider refactoring into `(Some(a), None) | (None, Some(a))` - --> $DIR/copies.rs:272:28 - | -272 | (Some(a), None) => bar(a), - | ^^^^^^ - -error: this `match` has identical arm bodies - --> $DIR/copies.rs:279:26 - | -279 | (.., Some(a)) => bar(a), - | ^^^^^^ - | -note: same as this - --> $DIR/copies.rs:278:26 - | -278 | (Some(a), ..) => bar(a), - | ^^^^^^ -note: consider refactoring into `(Some(a), ..) | (.., Some(a))` - --> $DIR/copies.rs:278:26 - | -278 | (Some(a), ..) => bar(a), - | ^^^^^^ - -error: this `match` has identical arm bodies - --> $DIR/copies.rs:285:20 - | -285 | (.., 3) => 42, - | ^^ - | -note: same as this - --> $DIR/copies.rs:284:23 - | -284 | (1, .., 3) => 42, - | ^^ -note: consider refactoring into `(1, .., 3) | (.., 3)` - --> $DIR/copies.rs:284:23 - | -284 | (1, .., 3) => 42, - | ^^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:291:12 - | -291 | } else { - | ____________^ -292 | | 0.0 -293 | | }; - | |_____^ - | -note: same as this - --> $DIR/copies.rs:289:21 - | -289 | let _ = if true { - | _____________________^ -290 | | 0.0 -291 | | } else { - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:297:12 - | -297 | } else { - | ____________^ -298 | | -0.0 -299 | | }; - | |_____^ - | -note: same as this - --> $DIR/copies.rs:295:21 - | -295 | let _ = if true { - | _____________________^ -296 | | -0.0 -297 | | } else { - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:317:12 - | -317 | } else { - | ____________^ -318 | | std::f32::NAN -319 | | }; - | |_____^ - | -note: same as this - --> $DIR/copies.rs:315:21 - | -315 | let _ = if true { - | _____________________^ -316 | | std::f32::NAN -317 | | } else { - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:335:10 - | -335 | else { - | __________^ -336 | | try!(Ok("foo")); -337 | | } - | |_____^ - | -note: same as this - --> $DIR/copies.rs:332:13 - | -332 | if true { - | _____________^ -333 | | try!(Ok("foo")); -334 | | } - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:347:10 - | -347 | else { - | __________^ -348 | | let foo = ""; -349 | | return Ok(&foo[0..]); -350 | | } - | |_____^ - | -note: same as this - --> $DIR/copies.rs:339:13 - | -339 | if true { - | _____________^ -340 | | let foo = ""; -341 | | return Ok(&foo[0..]); -342 | | } - | |_____^ - -error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:361:13 - | -361 | else if b { - | ^ - | -note: lint level defined here - --> $DIR/copies.rs:353:8 - | -353 | #[deny(ifs_same_cond)] - | ^^^^^^^^^^^^^ -note: same as this - --> $DIR/copies.rs:359:8 - | -359 | if b { - | ^ - -error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:366:13 - | -366 | else if a == 1 { - | ^^^^^^ - | -note: same as this - --> $DIR/copies.rs:364:8 - | -364 | if a == 1 { - | ^^^^^^ - -error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:373:13 - | -373 | else if 2*a == 1 { - | ^^^^^^^^ - | -note: same as this - --> $DIR/copies.rs:369:8 - | -369 | if 2*a == 1 { - | ^^^^^^^^ - -error: aborting due to 22 previous errors - diff --git a/tests/ui/derive.stderr b/tests/ui/derive.stderr deleted file mode 100644 index 25d59bdb7da..00000000000 --- a/tests/ui/derive.stderr +++ /dev/null @@ -1,91 +0,0 @@ -error: you are deriving `Hash` but have implemented `PartialEq` explicitly - --> $DIR/derive.rs:18:10 - | -18 | #[derive(Hash)] - | ^^^^ - | - = note: #[deny(derive_hash_xor_eq)] implied by #[deny(warnings)] -note: lint level defined here - --> $DIR/derive.rs:6:9 - | -6 | #![deny(warnings)] - | ^^^^^^^^ -note: `PartialEq` implemented here - --> $DIR/derive.rs:21:1 - | -21 | / impl PartialEq for Bar { -22 | | fn eq(&self, _: &Bar) -> bool { true } -23 | | } - | |_^ - -error: you are deriving `Hash` but have implemented `PartialEq` explicitly - --> $DIR/derive.rs:25:10 - | -25 | #[derive(Hash)] - | ^^^^ - | - = note: #[deny(derive_hash_xor_eq)] implied by #[deny(warnings)] -note: `PartialEq` implemented here - --> $DIR/derive.rs:28:1 - | -28 | / impl PartialEq for Baz { -29 | | fn eq(&self, _: &Baz) -> bool { true } -30 | | } - | |_^ - -error: you are implementing `Hash` explicitly but have derived `PartialEq` - --> $DIR/derive.rs:35:1 - | -35 | / impl Hash for Bah { -36 | | fn hash(&self, _: &mut H) {} -37 | | } - | |_^ - | - = note: #[deny(derive_hash_xor_eq)] implied by #[deny(warnings)] -note: `PartialEq` implemented here - --> $DIR/derive.rs:32:10 - | -32 | #[derive(PartialEq)] - | ^^^^^^^^^ - -error: you are implementing `Clone` explicitly on a `Copy` type - --> $DIR/derive.rs:42:1 - | -42 | / impl Clone for Qux { -43 | | fn clone(&self) -> Self { Qux } -44 | | } - | |_^ - | - = note: #[deny(expl_impl_clone_on_copy)] implied by #[deny(warnings)] -note: lint level defined here - --> $DIR/derive.rs:6:9 - | -6 | #![deny(warnings)] - | ^^^^^^^^ -note: consider deriving `Clone` or removing `Copy` - --> $DIR/derive.rs:42:1 - | -42 | / impl Clone for Qux { -43 | | fn clone(&self) -> Self { Qux } -44 | | } - | |_^ - -error: you are implementing `Clone` explicitly on a `Copy` type - --> $DIR/derive.rs:66:1 - | -66 | / impl<'a> Clone for Lt<'a> { -67 | | fn clone(&self) -> Self { unimplemented!() } -68 | | } - | |_^ - | - = note: #[deny(expl_impl_clone_on_copy)] implied by #[deny(warnings)] -note: consider deriving `Clone` or removing `Copy` - --> $DIR/derive.rs:66:1 - | -66 | / impl<'a> Clone for Lt<'a> { -67 | | fn clone(&self) -> Self { unimplemented!() } -68 | | } - | |_^ - -error: aborting due to 5 previous errors - diff --git a/tests/ui/diverging_sub_expression.stderr b/tests/ui/diverging_sub_expression.stderr deleted file mode 100644 index 108c228fdc9..00000000000 --- a/tests/ui/diverging_sub_expression.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:18:10 - | -18 | b || diverge(); - | ^^^^^^^^^ - | -note: lint level defined here - --> $DIR/diverging_sub_expression.rs:3:9 - | -3 | #![deny(diverging_sub_expression)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:19:10 - | -19 | b || A.foo(); - | ^^^^^^^ - -error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:28:26 - | -28 | 6 => true || return, - | ^^^^^^ - -error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:29:26 - | -29 | 7 => true || continue, - | ^^^^^^^^ - -error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:32:26 - | -32 | 3 => true || diverge(), - | ^^^^^^^^^ - -error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:37:26 - | -37 | _ => true || break, - | ^^^^^ - -error: aborting due to 6 previous errors - diff --git a/tests/ui/double_neg.stderr b/tests/ui/double_neg.stderr deleted file mode 100644 index aeabbc8dfa9..00000000000 --- a/tests/ui/double_neg.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op - --> $DIR/double_neg.rs:9:5 - | -9 | --x; - | ^^^ - | -note: lint level defined here - --> $DIR/double_neg.rs:4:8 - | -4 | #[deny(double_neg)] - | ^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/double_parens.stderr b/tests/ui/double_parens.stderr deleted file mode 100644 index 1011ad1c014..00000000000 --- a/tests/ui/double_parens.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:16:5 - | -16 | ((0)) - | ^^^^^ - | -note: lint level defined here - --> $DIR/double_parens.rs:4:9 - | -4 | #![deny(double_parens)] - | ^^^^^^^^^^^^^ - -error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:20:14 - | -20 | dummy_fn((0)); - | ^^^ - -error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:24:20 - | -24 | x.dummy_method((0)); - | ^^^ - -error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:28:5 - | -28 | ((1, 2)) - | ^^^^^^^^ - -error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:32:5 - | -32 | (()) - | ^^^^ - -error: aborting due to 5 previous errors - diff --git a/tests/ui/enum_glob_use.stderr b/tests/ui/enum_glob_use.stderr deleted file mode 100644 index 657ab13ebbe..00000000000 --- a/tests/ui/enum_glob_use.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: don't use glob imports for enum variants - --> $DIR/enum_glob_use.rs:6:1 - | -6 | use std::cmp::Ordering::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[deny(enum_glob_use)] implied by #[deny(clippy_pedantic)] -note: lint level defined here - --> $DIR/enum_glob_use.rs:3:17 - | -3 | #![deny(clippy, clippy_pedantic)] - | ^^^^^^^^^^^^^^^ - -error: don't use glob imports for enum variants - --> $DIR/enum_glob_use.rs:12:1 - | -12 | use self::Enum::*; - | ^^^^^^^^^^^^^^^^^^ - | - = note: #[deny(enum_glob_use)] implied by #[deny(clippy_pedantic)] - -error: aborting due to 2 previous errors - diff --git a/tests/ui/escape_analysis.stderr b/tests/ui/escape_analysis.stderr deleted file mode 100644 index e3898e4b277..00000000000 --- a/tests/ui/escape_analysis.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error: local variable doesn't need to be boxed here - --> $DIR/escape_analysis.rs:33:9 - | -33 | let x = box A; - | ^ - | -note: lint level defined here - --> $DIR/escape_analysis.rs:5:9 - | -5 | #![deny(boxed_local)] - | ^^^^^^^^^^^ - -error: local variable doesn't need to be boxed here - --> $DIR/escape_analysis.rs:37:13 - | -37 | fn warn_arg(x: Box) { - | ^ - -error: local variable doesn't need to be boxed here - --> $DIR/escape_analysis.rs:49:9 - | -49 | let y = x; - | ^ - -error: local variable doesn't need to be boxed here - --> $DIR/escape_analysis.rs:54:9 - | -54 | let bz = box A; - | ^^ - -error: local variable doesn't need to be boxed here - --> $DIR/escape_analysis.rs:58:9 - | -58 | let bz = box A; - | ^^ - -error: local variable doesn't need to be boxed here - --> $DIR/escape_analysis.rs:88:9 - | -88 | let x = box A; - | ^ - -error: local variable doesn't need to be boxed here - --> $DIR/escape_analysis.rs:101:9 - | -101 | let x = box A; - | ^ - -error: local variable doesn't need to be boxed here - --> $DIR/escape_analysis.rs:130:12 - | -130 | pub fn new(_needs_name: Box>) -> () { - | ^^^^^^^^^^^ - -error: aborting due to 8 previous errors - diff --git a/tests/ui/format.stderr b/tests/ui/format.stderr deleted file mode 100644 index 51e0c5b6d63..00000000000 --- a/tests/ui/format.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: useless use of `format!` - --> $DIR/format.rs:6:5 - | -6 | format!("foo"); - | ^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/format.rs:3:9 - | -3 | #![deny(useless_format)] - | ^^^^^^^^^^^^^^ - -error: useless use of `format!` - --> $DIR/format.rs:8:5 - | -8 | format!("{}", "foo"); - | ^^^^^^^^^^^^^^^^^^^^^ - -error: useless use of `format!` - --> $DIR/format.rs:15:5 - | -15 | format!("{}", arg); - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors - diff --git a/tests/ui/modulo_one.stderr b/tests/ui/modulo_one.stderr deleted file mode 100644 index 2e5aef67574..00000000000 --- a/tests/ui/modulo_one.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: any number modulo 1 will be 0 - --> $DIR/modulo_one.rs:7:5 - | -7 | 10 % 1; - | ^^^^^^ - | -note: lint level defined here - --> $DIR/modulo_one.rs:3:9 - | -3 | #![deny(modulo_one)] - | ^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/needless_borrow.stderr b/tests/ui/needless_borrow.stderr deleted file mode 100644 index eab79e63bc4..00000000000 --- a/tests/ui/needless_borrow.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error: this expression borrows a reference that is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:13:15 - | -13 | let c = x(&&a); - | ^^^ - | - = note: #[deny(needless_borrow)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/needless_borrow.rs:8:8 - | -8 | #[deny(clippy)] - | ^^^^^^ - -error: this pattern creates a reference to a reference - --> $DIR/needless_borrow.rs:20:17 - | -20 | if let Some(ref cake) = Some(&5) {} - | ^^^^^^^^ - | - = note: #[deny(needless_borrow)] implied by #[deny(clippy)] - -error: this expression borrows a reference that is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:27:15 - | -27 | 46 => &&a, - | ^^^ - | - = note: #[deny(needless_borrow)] implied by #[deny(clippy)] - -warning: this pattern creates a reference to a reference - --> $DIR/needless_borrow.rs:50:31 - | -50 | let _ = v.iter().filter(|&ref a| a.is_empty()); - | ^^^^^ - | - = note: #[warn(needless_borrow)] on by default - -error: aborting due to 3 previous errors - diff --git a/tests/ui/needless_pass_by_value_proc_macro.rs b/tests/ui/needless_pass_by_value_proc_macro.rs index 8322cc40e8e..0d5bc4172d8 100644 --- a/tests/ui/needless_pass_by_value_proc_macro.rs +++ b/tests/ui/needless_pass_by_value_proc_macro.rs @@ -1,7 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] #![crate_type = "proc-macro"] -#![deny(needless_pass_by_value)] +#![warn(needless_pass_by_value)] extern crate proc_macro; diff --git a/tests/ui/neg_multiply.stderr b/tests/ui/neg_multiply.stderr deleted file mode 100644 index e65f11da16d..00000000000 --- a/tests/ui/neg_multiply.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: Negation by multiplying with -1 - --> $DIR/neg_multiply.rs:30:5 - | -30 | x * -1; - | ^^^^^^ - | -note: lint level defined here - --> $DIR/neg_multiply.rs:4:9 - | -4 | #![deny(neg_multiply)] - | ^^^^^^^^^^^^ - -error: Negation by multiplying with -1 - --> $DIR/neg_multiply.rs:32:5 - | -32 | -1 * x; - | ^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/op_ref.stderr b/tests/ui/op_ref.stderr deleted file mode 100644 index 5448429f164..00000000000 --- a/tests/ui/op_ref.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: needlessly taken reference of both operands - --> $DIR/op_ref.rs:13:15 - | -13 | let foo = &5 - &6; - | ^^^^^^^ - | - = note: #[warn(op_ref)] on by default -help: use the values directly - | let foo = 5 - 6; - diff --git a/tests/ui/overflow_check_conditional.stderr b/tests/ui/overflow_check_conditional.stderr deleted file mode 100644 index 8705f3d7203..00000000000 --- a/tests/ui/overflow_check_conditional.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error: You are trying to use classic C overflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:11:5 - | -11 | \tif a + b < a { - | \t ^^^^^^^^^ - | -note: lint level defined here - --> $DIR/overflow_check_conditional.rs:5:9 - | -5 | #![deny(overflow_check_conditional)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: You are trying to use classic C overflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:14:5 - | -14 | \tif a > a + b { - | \t ^^^^^^^^^ - -error: You are trying to use classic C overflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:17:5 - | -17 | \tif a + b < b { - | \t ^^^^^^^^^ - -error: You are trying to use classic C overflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:20:5 - | -20 | \tif b > a + b { - | \t ^^^^^^^^^ - -error: You are trying to use classic C underflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:23:5 - | -23 | \tif a - b > b { - | \t ^^^^^^^^^ - -error: You are trying to use classic C underflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:26:5 - | -26 | \tif b < a - b { - | \t ^^^^^^^^^ - -error: You are trying to use classic C underflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:29:5 - | -29 | \tif a - b > a { - | \t ^^^^^^^^^ - -error: You are trying to use classic C underflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:32:5 - | -32 | \tif a < a - b { - | \t ^^^^^^^^^ - -error: aborting due to 8 previous errors - diff --git a/tests/ui/partialeq_ne_impl.stderr b/tests/ui/partialeq_ne_impl.stderr deleted file mode 100644 index dd1e4099e4c..00000000000 --- a/tests/ui/partialeq_ne_impl.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: re-implementing `PartialEq::ne` is unnecessary - --> $DIR/partialeq_ne_impl.rs:11:5 - | -11 | fn ne(&self, _: &Foo) -> bool { false } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[deny(partialeq_ne_impl)] implied by #[deny(warnings)] -note: lint level defined here - --> $DIR/partialeq_ne_impl.rs:4:9 - | -4 | #![deny(warnings)] - | ^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/patterns.stderr b/tests/ui/patterns.stderr deleted file mode 100644 index 515ae4cae6e..00000000000 --- a/tests/ui/patterns.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: the `y @ _` pattern can be written as just `y` - --> $DIR/patterns.rs:10:9 - | -10 | y @ _ => (), - | ^^^^^ - | - = note: #[deny(redundant_pattern)] implied by #[deny(clippy)] -note: lint level defined here - --> $DIR/patterns.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/print_with_newline.stderr b/tests/ui/print_with_newline.stderr deleted file mode 100644 index 44beb530277..00000000000 --- a/tests/ui/print_with_newline.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> $DIR/print_with_newline.rs:6:5 - | -6 | print!("Hello/n"); - | ^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/print_with_newline.rs:3:9 - | -3 | #![deny(print_with_newline)] - | ^^^^^^^^^^^^^^^^^^ - -error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> $DIR/print_with_newline.rs:7:5 - | -7 | print!("Hello {}/n", "world"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> $DIR/print_with_newline.rs:8:5 - | -8 | print!("Hello {} {}/n/n", "world", "#2"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> $DIR/print_with_newline.rs:9:5 - | -9 | print!("{}/n", 1265); - | ^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors - diff --git a/tests/ui/redundant_closure_call.stderr b/tests/ui/redundant_closure_call.stderr deleted file mode 100644 index 591a48a1a38..00000000000 --- a/tests/ui/redundant_closure_call.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: Closure called just once immediately after it was declared - --> $DIR/redundant_closure_call.rs:15:2 - | -15 | \ti = closure(); - | \t^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/redundant_closure_call.rs:4:9 - | -4 | #![deny(redundant_closure_call)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: Closure called just once immediately after it was declared - --> $DIR/redundant_closure_call.rs:18:2 - | -18 | \ti = closure(3); - | \t^^^^^^^^^^^^^^ - -error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:7:10 - | -7 | \tlet a = (|| 42)(); - | \t ^^^^^^^^^ help: Try doing something like: `42` - -error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:10:10 - | -10 | \tlet k = (|m| m+1)(i); - | \t ^^^^^^^^^^^^ - -error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:12:6 - | -12 | \tk = (|a,b| a*b)(1,5); - | \t ^^^^^^^^^^^^^^^^ - -error: aborting due to 5 previous errors - diff --git a/tests/ui/regex.stderr b/tests/ui/regex.stderr deleted file mode 100644 index ad9e7ba4c75..00000000000 --- a/tests/ui/regex.stderr +++ /dev/null @@ -1,175 +0,0 @@ -error: regex syntax error: empty alternate - --> $DIR/regex.rs:16:45 - | -16 | let pipe_in_wrong_position = Regex::new("|"); - | ^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error: empty alternate - --> $DIR/regex.rs:17:60 - | -17 | let pipe_in_wrong_position_builder = RegexBuilder::new("|"); - | ^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error: invalid character class range - --> $DIR/regex.rs:18:40 - | -18 | let wrong_char_ranice = Regex::new("[z-a]"); - | ^^^^^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error: invalid character class range - --> $DIR/regex.rs:19:35 - | -19 | let some_unicode = Regex::new("[é-è]"); - | ^^^^^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error on position 0: unclosed parenthesis - --> $DIR/regex.rs:21:33 - | -21 | let some_regex = Regex::new(OPENING_PAREN); - | ^^^^^^^^^^^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error: empty alternate - --> $DIR/regex.rs:23:53 - | -23 | let binary_pipe_in_wrong_position = BRegex::new("|"); - | ^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error on position 0: unclosed parenthesis - --> $DIR/regex.rs:24:41 - | -24 | let some_binary_regex = BRegex::new(OPENING_PAREN); - | ^^^^^^^^^^^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error on position 0: unclosed parenthesis - --> $DIR/regex.rs:25:56 - | -25 | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN); - | ^^^^^^^^^^^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error on position 0: unclosed parenthesis - --> $DIR/regex.rs:40:9 - | -40 | OPENING_PAREN, - | ^^^^^^^^^^^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: regex syntax error on position 0: unclosed parenthesis - --> $DIR/regex.rs:44:9 - | -44 | OPENING_PAREN, - | ^^^^^^^^^^^^^ - | - = note: #[deny(invalid_regex)] on by default - -error: trivial regex - --> $DIR/regex.rs:50:33 - | -50 | let trivial_eq = Regex::new("^foobar$"); - | ^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/regex.rs:5:24 - | -5 | #![deny(invalid_regex, trivial_regex, regex_macro)] - | ^^^^^^^^^^^^^ - = help: consider using consider using `==` on `str`s - -error: trivial regex - --> $DIR/regex.rs:52:48 - | -52 | let trivial_eq_builder = RegexBuilder::new("^foobar$"); - | ^^^^^^^^^^ - | - = help: consider using consider using `==` on `str`s - -error: trivial regex - --> $DIR/regex.rs:54:42 - | -54 | let trivial_starts_with = Regex::new("^foobar"); - | ^^^^^^^^^ - | - = help: consider using consider using `str::starts_with` - -error: trivial regex - --> $DIR/regex.rs:56:40 - | -56 | let trivial_ends_with = Regex::new("foobar$"); - | ^^^^^^^^^ - | - = help: consider using consider using `str::ends_with` - -error: trivial regex - --> $DIR/regex.rs:58:39 - | -58 | let trivial_contains = Regex::new("foobar"); - | ^^^^^^^^ - | - = help: consider using consider using `str::contains` - -error: trivial regex - --> $DIR/regex.rs:60:39 - | -60 | let trivial_contains = Regex::new(NOT_A_REAL_REGEX); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using consider using `str::contains` - -error: trivial regex - --> $DIR/regex.rs:62:40 - | -62 | let trivial_backslash = Regex::new("a//.b"); - | ^^^^^^^ - | - = help: consider using consider using `str::contains` - -error: trivial regex - --> $DIR/regex.rs:65:36 - | -65 | let trivial_empty = Regex::new(""); - | ^^ - | - = help: consider using the regex is unlikely to be useful as it is - -error: trivial regex - --> $DIR/regex.rs:67:36 - | -67 | let trivial_empty = Regex::new("^"); - | ^^^ - | - = help: consider using the regex is unlikely to be useful as it is - -error: trivial regex - --> $DIR/regex.rs:69:36 - | -69 | let trivial_empty = Regex::new("^$"); - | ^^^^ - | - = help: consider using consider using `str::is_empty` - -error: trivial regex - --> $DIR/regex.rs:71:44 - | -71 | let binary_trivial_empty = BRegex::new("^$"); - | ^^^^ - | - = help: consider using consider using `str::is_empty` - -error: aborting due to 21 previous errors - diff --git a/tests/ui/serde.stderr b/tests/ui/serde.stderr deleted file mode 100644 index 8b7daae9909..00000000000 --- a/tests/ui/serde.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: you should not implement `visit_string` without also implementing `visit_str` - --> $DIR/serde.rs:39:5 - | -39 | / fn visit_string(self, _v: String) -> Result -40 | | where E: serde::de::Error, -41 | | { -42 | | unimplemented!() -43 | | } - | |_____^ - | -note: lint level defined here - --> $DIR/serde.rs:3:9 - | -3 | #![deny(serde_api_misuse)] - | ^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/temporary_assignment.stderr b/tests/ui/temporary_assignment.stderr deleted file mode 100644 index ea39d798e2d..00000000000 --- a/tests/ui/temporary_assignment.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: assignment to temporary - --> $DIR/temporary_assignment.rs:29:5 - | -29 | Struct { field: 0 }.field = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/temporary_assignment.rs:4:9 - | -4 | #![deny(temporary_assignment)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: assignment to temporary - --> $DIR/temporary_assignment.rs:30:5 - | -30 | (0, 0).0 = 1; - | ^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/transmute.rs b/tests/ui/transmute.rs index b70b846d32d..a83e5194736 100644 --- a/tests/ui/transmute.rs +++ b/tests/ui/transmute.rs @@ -17,7 +17,7 @@ fn my_vec() -> MyVec { } #[allow(needless_lifetimes)] -#[deny(useless_transmute)] +#[warn(useless_transmute)] unsafe fn _generic<'a, T, U: 'a>(t: &'a T) { let _: &'a T = core::intrinsics::transmute(t); @@ -30,7 +30,7 @@ unsafe fn _generic<'a, T, U: 'a>(t: &'a T) { let _: *const U = core::intrinsics::transmute(t); } -#[deny(transmute_ptr_to_ref)] +#[warn(transmute_ptr_to_ref)] unsafe fn _ptr_to_ref(p: *const T, m: *mut T, o: *const U, om: *mut U) { let _: &T = std::mem::transmute(p); let _: &T = &*p; @@ -54,7 +54,7 @@ unsafe fn _ptr_to_ref(p: *const T, m: *mut T, o: *const U, om: *mut U) { let _: &T = &*(om as *const T); } -#[deny(transmute_ptr_to_ref)] +#[warn(transmute_ptr_to_ref)] fn issue1231() { struct Foo<'a, T: 'a> { bar: &'a T, @@ -70,7 +70,7 @@ fn issue1231() { unsafe { std::mem::transmute::<_, Bar>(raw) }; } -#[deny(useless_transmute)] +#[warn(useless_transmute)] fn useless() { unsafe { let _: Vec = core::intrinsics::transmute(my_vec()); @@ -101,7 +101,7 @@ fn useless() { struct Usize(usize); -#[deny(crosspointer_transmute)] +#[warn(crosspointer_transmute)] fn crosspointer() { let mut int: Usize = Usize(0); let int_const_ptr: *const Usize = &int as *const Usize; diff --git a/tests/ui/transmute.stderr b/tests/ui/transmute.stderr index b2bce16abe0..b70e5e08830 100644 --- a/tests/ui/transmute.stderr +++ b/tests/ui/transmute.stderr @@ -1,182 +1,200 @@ -error: transmute from a type (`&'a T`) to itself +warning: transmute from a type (`&'a T`) to itself --> $DIR/transmute.rs:22:20 | 22 | let _: &'a T = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/transmute.rs:20:8 - | -20 | #[deny(useless_transmute)] - | ^^^^^^^^^^^^^^^^^ + = note: #[warn(useless_transmute)] on by default -error: transmute from a reference to a pointer +warning: transmute from a reference to a pointer --> $DIR/transmute.rs:26:23 | 26 | let _: *const T = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `t as *const T` + | + = note: #[warn(useless_transmute)] on by default -error: transmute from a reference to a pointer +warning: transmute from a reference to a pointer --> $DIR/transmute.rs:28:21 | 28 | let _: *mut T = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `t as *const T as *mut T` + | + = note: #[warn(useless_transmute)] on by default -error: transmute from a reference to a pointer +warning: transmute from a reference to a pointer --> $DIR/transmute.rs:30:23 | 30 | let _: *const U = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `t as *const T as *const U` + | + = note: #[warn(useless_transmute)] on by default -error: transmute from a pointer type (`*const T`) to a reference type (`&T`) +warning: transmute from a pointer type (`*const T`) to a reference type (`&T`) --> $DIR/transmute.rs:35:17 | 35 | let _: &T = std::mem::transmute(p); | ^^^^^^^^^^^^^^^^^^^^^^ help: try `&*p` | -note: lint level defined here - --> $DIR/transmute.rs:33:8 - | -33 | #[deny(transmute_ptr_to_ref)] - | ^^^^^^^^^^^^^^^^^^^^ + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) +warning: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) --> $DIR/transmute.rs:38:21 | 38 | let _: &mut T = std::mem::transmute(m); | ^^^^^^^^^^^^^^^^^^^^^^ help: try `&mut *m` + | + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*mut T`) to a reference type (`&T`) +warning: transmute from a pointer type (`*mut T`) to a reference type (`&T`) --> $DIR/transmute.rs:41:17 | 41 | let _: &T = std::mem::transmute(m); | ^^^^^^^^^^^^^^^^^^^^^^ help: try `&*m` + | + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) +warning: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) --> $DIR/transmute.rs:44:21 | 44 | let _: &mut T = std::mem::transmute(p as *mut T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `&mut *(p as *mut T)` + | + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*const U`) to a reference type (`&T`) +warning: transmute from a pointer type (`*const U`) to a reference type (`&T`) --> $DIR/transmute.rs:47:17 | 47 | let _: &T = std::mem::transmute(o); | ^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(o as *const T)` + | + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`) +warning: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`) --> $DIR/transmute.rs:50:21 | 50 | let _: &mut T = std::mem::transmute(om); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try `&mut *(om as *mut T)` + | + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*mut U`) to a reference type (`&T`) +warning: transmute from a pointer type (`*mut U`) to a reference type (`&T`) --> $DIR/transmute.rs:53:17 | 53 | let _: &T = std::mem::transmute(om); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(om as *const T)` + | + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`) +warning: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`) --> $DIR/transmute.rs:64:32 | 64 | let _: &Foo = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(raw as *const Foo<_>)` | -note: lint level defined here - --> $DIR/transmute.rs:57:8 - | -57 | #[deny(transmute_ptr_to_ref)] - | ^^^^^^^^^^^^^^^^^^^^ + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`) +warning: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`) --> $DIR/transmute.rs:66:33 | 66 | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(raw as *const Foo<&_>)` + | + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`) +warning: transmute from a pointer type (`*const i32`) to a reference type (`&u8`) --> $DIR/transmute.rs:70:14 | 70 | unsafe { std::mem::transmute::<_, Bar>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(raw as *const u8)` + | + = note: #[warn(transmute_ptr_to_ref)] on by default -error: transmute from a type (`std::vec::Vec`) to itself +warning: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:76:27 | 76 | let _: Vec = core::intrinsics::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/transmute.rs:73:8 - | -73 | #[deny(useless_transmute)] - | ^^^^^^^^^^^^^^^^^ + = note: #[warn(useless_transmute)] on by default -error: transmute from a type (`std::vec::Vec`) to itself +warning: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:78:27 | 78 | let _: Vec = core::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(useless_transmute)] on by default -error: transmute from a type (`std::vec::Vec`) to itself +warning: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:80:27 | 80 | let _: Vec = std::intrinsics::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(useless_transmute)] on by default -error: transmute from a type (`std::vec::Vec`) to itself +warning: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:82:27 | 82 | let _: Vec = std::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(useless_transmute)] on by default -error: transmute from a type (`std::vec::Vec`) to itself +warning: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:84:27 | 84 | let _: Vec = my_transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(useless_transmute)] on by default -error: transmute from an integer to a pointer +warning: transmute from an integer to a pointer --> $DIR/transmute.rs:92:31 | 92 | let _: *const usize = std::mem::transmute(5_isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `5_isize as *const usize` + | + = note: #[warn(useless_transmute)] on by default -error: transmute from an integer to a pointer +warning: transmute from an integer to a pointer --> $DIR/transmute.rs:96:31 | 96 | let _: *const usize = std::mem::transmute(1+1usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `(1+1usize) as *const usize` + | + = note: #[warn(useless_transmute)] on by default -error: transmute from a type (`*const Usize`) to the type that it points to (`Usize`) +warning: transmute from a type (`*const Usize`) to the type that it points to (`Usize`) --> $DIR/transmute.rs:111:24 | 111 | let _: Usize = core::intrinsics::transmute(int_const_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/transmute.rs:104:8 - | -104 | #[deny(crosspointer_transmute)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: #[warn(crosspointer_transmute)] on by default -error: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`) +warning: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`) --> $DIR/transmute.rs:113:24 | 113 | let _: Usize = core::intrinsics::transmute(int_mut_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(crosspointer_transmute)] on by default -error: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`) +warning: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`) --> $DIR/transmute.rs:115:31 | 115 | let _: *const Usize = core::intrinsics::transmute(my_int()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(crosspointer_transmute)] on by default -error: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`) +warning: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`) --> $DIR/transmute.rs:117:29 | 117 | let _: *mut Usize = core::intrinsics::transmute(my_int()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 25 previous errors + | + = note: #[warn(crosspointer_transmute)] on by default diff --git a/tests/ui/transmute_32bit.rs b/tests/ui/transmute_32bit.rs index f391b728ec5..4f9555297ff 100644 --- a/tests/ui/transmute_32bit.rs +++ b/tests/ui/transmute_32bit.rs @@ -2,7 +2,7 @@ #![feature(plugin)] #![plugin(clippy)] -#[deny(wrong_transmute)] +#[warn(wrong_transmute)] fn main() { unsafe { let _: *const usize = std::mem::transmute(6.0f32); diff --git a/tests/ui/transmute_64bit.rs b/tests/ui/transmute_64bit.rs index 4caa9d1f305..9be1e37b13e 100644 --- a/tests/ui/transmute_64bit.rs +++ b/tests/ui/transmute_64bit.rs @@ -3,7 +3,7 @@ #![feature(plugin)] #![plugin(clippy)] -#[deny(wrong_transmute)] +#[warn(wrong_transmute)] fn main() { unsafe { let _: *const usize = std::mem::transmute(6.0f64); diff --git a/tests/ui/transmute_64bit.stderr b/tests/ui/transmute_64bit.stderr index 3d06348b147..88160ed8c9e 100644 --- a/tests/ui/transmute_64bit.stderr +++ b/tests/ui/transmute_64bit.stderr @@ -1,20 +1,16 @@ -error: transmute from a `f64` to a pointer +warning: transmute from a `f64` to a pointer --> $DIR/transmute_64bit.rs:9:31 | 9 | let _: *const usize = std::mem::transmute(6.0f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/transmute_64bit.rs:6:8 - | -6 | #[deny(wrong_transmute)] - | ^^^^^^^^^^^^^^^ + = note: #[warn(wrong_transmute)] on by default -error: transmute from a `f64` to a pointer +warning: transmute from a `f64` to a pointer --> $DIR/transmute_64bit.rs:11:29 | 11 | let _: *mut usize = std::mem::transmute(6.0f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors + | + = note: #[warn(wrong_transmute)] on by default diff --git a/tests/ui/unused_io_amount.stderr b/tests/ui/unused_io_amount.stderr deleted file mode 100644 index 7a5643e831c..00000000000 --- a/tests/ui/unused_io_amount.stderr +++ /dev/null @@ -1,52 +0,0 @@ -error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:10:5 - | -10 | try!(s.write(b"test")); - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[deny(unused_io_amount)] on by default - = note: this error originates in a macro outside of the current crate - -error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:12:5 - | -12 | try!(s.read(&mut buf)); - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[deny(unused_io_amount)] on by default - = note: this error originates in a macro outside of the current crate - -error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:17:5 - | -17 | s.write(b"test")?; - | ^^^^^^^^^^^^^^^^^ - | - = note: #[deny(unused_io_amount)] on by default - -error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:19:5 - | -19 | s.read(&mut buf)?; - | ^^^^^^^^^^^^^^^^^ - | - = note: #[deny(unused_io_amount)] on by default - -error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:24:5 - | -24 | s.write(b"test").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[deny(unused_io_amount)] on by default - -error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:26:5 - | -26 | s.read(&mut buf).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[deny(unused_io_amount)] on by default - -error: aborting due to 6 previous errors - diff --git a/tests/ui/useless_attribute.stderr b/tests/ui/useless_attribute.stderr deleted file mode 100644 index 911321e5f74..00000000000 --- a/tests/ui/useless_attribute.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: useless lint attribute - --> $DIR/useless_attribute.rs:5:1 - | -5 | #[allow(dead_code)] - | ^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use `#![allow(dead_code)]` - | -note: lint level defined here - --> $DIR/useless_attribute.rs:3:9 - | -3 | #![deny(useless_attribute)] - | ^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/zero_ptr.stderr b/tests/ui/zero_ptr.stderr deleted file mode 100644 index e17a3bfb2bd..00000000000 --- a/tests/ui/zero_ptr.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: `0 as *const _` detected. Consider using `ptr::null()` - --> $DIR/zero_ptr.rs:6:13 - | -6 | let x = 0 as *const usize; - | ^^^^^^^^^^^^^^^^^ - | - = note: #[warn(zero_ptr)] on by default - -warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` - --> $DIR/zero_ptr.rs:7:13 - | -7 | let y = 0 as *mut f64; - | ^^^^^^^^^^^^^ - | - = note: #[warn(zero_ptr)] on by default -