diff --git a/.gitignore b/.gitignore index 2891bcf24eed..d25c1a08ee47 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ out # Generated by Cargo /target/ /clippy_lints/target/ -/clippy_tests/target/ # We don't pin yet Cargo.lock diff --git a/.travis.yml b/.travis.yml index a93790fd03d5..97c702f63dfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ sudo: false cache: cargo: true directories: - - clippy_tests/target + - target env: global: @@ -32,7 +32,7 @@ script: - cargo build --features debugging - cargo test --features debugging - mkdir -p ~/rust/cargo/bin - - cp clippy_tests/target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy + - cp target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy - PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy - cd clippy_lints && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd .. - cd clippy_workspace_tests && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd .. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0b3b48a2cf7f..71a54d85249a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,15 +39,10 @@ Compiling clippy can take almost a minute or more depending on your machine. You can set the environment flag `CARGO_INCREMENTAL=1` to cut down that time to almost a third on average, depending on the influence your change has. -Clippy uses its own version of UI tests. Run `cargo test examples` to run only the ui tests. -This will update all the `*.stderr` files in `clippy_tests/examples`. You need to check -the stderr files whether they look as you expected them and commit them together with your -changes. -When you want to test a new lint, just create a new file in `clippy_tests/examples` and -rerun `cargo test examples`. - -You can check just one example by running `cargo run --example example_name` inside the -`clippy_tests` directory. +Clippy uses UI tests. UI tests check that the output of the compiler is exactly as expected. +Of course there's little sense in writing the output yourself or copying it around. +Therefore you can simply run `tests/ui/update-all-references.sh` and check whether +the output looks as you expect with `git diff`. Commit all `*.stderr` files, too. Also please document your lint with a doc comment akin to the following: ```rust diff --git a/Cargo.toml b/Cargo.toml index 3b3a666eb610..8b9d6f01f634 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ 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" } @@ -47,3 +46,5 @@ serde = "1.0" [features] debugging = [] + +[workspace] diff --git a/appveyor.yml b/appveyor.yml index 6f9ead88b2a7..c17b12a33b38 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,7 +26,7 @@ test_script: - set RUST_BACKTRACE=1 - cargo build --features debugging - cargo test --features debugging - - copy clippy_tests\target\debug\cargo-clippy.exe C:\Users\appveyor\.cargo\bin\ + - copy target\debug\cargo-clippy.exe C:\Users\appveyor\.cargo\bin\ - cargo clippy -- -D clippy - cd clippy_lints && cargo clippy -- -D clippy && cd .. diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index a18548d986e7..a48ad5a9fdd0 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -14,7 +14,7 @@ repository = "https://github.com/Manishearth/rust-clippy" readme = "README.md" license = "MPL-2.0" keywords = ["clippy", "lint", "plugin"] -workspace = "../clippy_tests" +workspace = ".." [dependencies] itertools = "0.6.0" diff --git a/clippy_tests/Cargo.toml b/clippy_tests/Cargo.toml deleted file mode 100644 index 3ac4905285e4..000000000000 --- a/clippy_tests/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "clippy_tests" -version = "0.1.0" -authors = ["Oliver Schneider "] - -[dependencies] -clippy = { path = ".." } - -[workspace] diff --git a/clippy_tests/examples/absurd-extreme-comparisons.stdout b/clippy_tests/examples/absurd-extreme-comparisons.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/approx_const.stdout b/clippy_tests/examples/approx_const.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/arithmetic.stdout b/clippy_tests/examples/arithmetic.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/array_indexing.stdout b/clippy_tests/examples/array_indexing.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/assign_ops.stdout b/clippy_tests/examples/assign_ops.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/assign_ops2.stdout b/clippy_tests/examples/assign_ops2.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/attrs.stdout b/clippy_tests/examples/attrs.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/bit_masks.stdout b/clippy_tests/examples/bit_masks.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/blacklisted_name.stdout b/clippy_tests/examples/blacklisted_name.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/block_in_if_condition.stdout b/clippy_tests/examples/block_in_if_condition.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/bool_comparison.stdout b/clippy_tests/examples/bool_comparison.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/booleans.stdout b/clippy_tests/examples/booleans.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/borrow_box.stdout b/clippy_tests/examples/borrow_box.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/box_vec.stdout b/clippy_tests/examples/box_vec.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/cast.stdout b/clippy_tests/examples/cast.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/char_lit_as_u8.stdout b/clippy_tests/examples/char_lit_as_u8.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/cmp_nan.stdout b/clippy_tests/examples/cmp_nan.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/cmp_null.stdout b/clippy_tests/examples/cmp_null.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/cmp_owned.stdout b/clippy_tests/examples/cmp_owned.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/collapsible_if.stdout b/clippy_tests/examples/collapsible_if.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/complex_types.stdout b/clippy_tests/examples/complex_types.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/copies.stdout b/clippy_tests/examples/copies.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/cyclomatic_complexity.stdout b/clippy_tests/examples/cyclomatic_complexity.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/cyclomatic_complexity_attr_used.stdout b/clippy_tests/examples/cyclomatic_complexity_attr_used.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/derive.stdout b/clippy_tests/examples/derive.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/diverging_sub_expression.stdout b/clippy_tests/examples/diverging_sub_expression.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/dlist.stdout b/clippy_tests/examples/dlist.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/doc.stdout b/clippy_tests/examples/doc.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/double_neg.stdout b/clippy_tests/examples/double_neg.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/double_parens.stdout b/clippy_tests/examples/double_parens.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/drop_forget_copy.stdout b/clippy_tests/examples/drop_forget_copy.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/drop_forget_ref.stdout b/clippy_tests/examples/drop_forget_ref.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/duplicate_underscore_argument.stdout b/clippy_tests/examples/duplicate_underscore_argument.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/empty_enum.stdout b/clippy_tests/examples/empty_enum.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/entry.stdout b/clippy_tests/examples/entry.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/enum_glob_use.stdout b/clippy_tests/examples/enum_glob_use.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/enum_variants.stdout b/clippy_tests/examples/enum_variants.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/enums_clike.stdout b/clippy_tests/examples/enums_clike.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/eq_op.stdout b/clippy_tests/examples/eq_op.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/escape_analysis.stdout b/clippy_tests/examples/escape_analysis.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/eta.stdout b/clippy_tests/examples/eta.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/eval_order_dependence.stdout b/clippy_tests/examples/eval_order_dependence.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/filter_methods.stdout b/clippy_tests/examples/filter_methods.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/float_cmp.stdout b/clippy_tests/examples/float_cmp.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/for_loop.stdout b/clippy_tests/examples/for_loop.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/format.stdout b/clippy_tests/examples/format.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/formatting.stdout b/clippy_tests/examples/formatting.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/functions.stdout b/clippy_tests/examples/functions.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/identity_op.stdout b/clippy_tests/examples/identity_op.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/if_let_redundant_pattern_matching.stdout b/clippy_tests/examples/if_let_redundant_pattern_matching.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/if_not_else.stdout b/clippy_tests/examples/if_not_else.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/invalid_upcast_comparisons.stdout b/clippy_tests/examples/invalid_upcast_comparisons.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/item_after_statement.stdout b/clippy_tests/examples/item_after_statement.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/large_enum_variant.stdout b/clippy_tests/examples/large_enum_variant.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/len_zero.stdout b/clippy_tests/examples/len_zero.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/let_if_seq.stdout b/clippy_tests/examples/let_if_seq.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/let_return.stdout b/clippy_tests/examples/let_return.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/let_unit.stdout b/clippy_tests/examples/let_unit.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/lifetimes.stdout b/clippy_tests/examples/lifetimes.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/lint_pass.stdout b/clippy_tests/examples/lint_pass.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/literals.stdout b/clippy_tests/examples/literals.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/map_clone.stdout b/clippy_tests/examples/map_clone.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/matches.stdout b/clippy_tests/examples/matches.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/mem_forget.stdout b/clippy_tests/examples/mem_forget.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/methods.stdout b/clippy_tests/examples/methods.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/min_max.stdout b/clippy_tests/examples/min_max.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/missing-doc.stdout b/clippy_tests/examples/missing-doc.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/module_inception.stdout b/clippy_tests/examples/module_inception.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/modulo_one.stdout b/clippy_tests/examples/modulo_one.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/mut_from_ref.stdout b/clippy_tests/examples/mut_from_ref.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/mut_mut.stdout b/clippy_tests/examples/mut_mut.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/mut_reference.stdout b/clippy_tests/examples/mut_reference.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/mutex_atomic.stdout b/clippy_tests/examples/mutex_atomic.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/needless_bool.stdout b/clippy_tests/examples/needless_bool.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/needless_borrow.stdout b/clippy_tests/examples/needless_borrow.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/needless_continue.stdout b/clippy_tests/examples/needless_continue.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/needless_pass_by_value.stdout b/clippy_tests/examples/needless_pass_by_value.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/needless_return.stdout b/clippy_tests/examples/needless_return.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/needless_update.stdout b/clippy_tests/examples/needless_update.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/neg_multiply.stdout b/clippy_tests/examples/neg_multiply.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/never_loop.stdout b/clippy_tests/examples/never_loop.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/new_without_default.stdout b/clippy_tests/examples/new_without_default.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/no_effect.stdout b/clippy_tests/examples/no_effect.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/non_expressive_names.stdout b/clippy_tests/examples/non_expressive_names.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/ok_if_let.stdout b/clippy_tests/examples/ok_if_let.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/op_ref.stdout b/clippy_tests/examples/op_ref.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/open_options.stdout b/clippy_tests/examples/open_options.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/overflow_check_conditional.stdout b/clippy_tests/examples/overflow_check_conditional.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/panic.stdout b/clippy_tests/examples/panic.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/partialeq_ne_impl.stdout b/clippy_tests/examples/partialeq_ne_impl.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/patterns.stdout b/clippy_tests/examples/patterns.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/precedence.stdout b/clippy_tests/examples/precedence.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/print.stdout b/clippy_tests/examples/print.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/print_with_newline.stdout b/clippy_tests/examples/print_with_newline.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/ptr_arg.stdout b/clippy_tests/examples/ptr_arg.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/range.stdout b/clippy_tests/examples/range.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/redundant_closure_call.stderr b/clippy_tests/examples/redundant_closure_call.stderr deleted file mode 100644 index 0dc9672b15cc..000000000000 --- a/clippy_tests/examples/redundant_closure_call.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error: Closure called just once immediately after it was declared - --> 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 - --> redundant_closure_call.rs:18:2 - | -18 | i = closure(3); - | ^^^^^^^^^^^^^^ - -error: Try not to call a closure in the expression where it is declared. - --> redundant_closure_call.rs:7:10 - | -7 | let a = (|| 42)(); - | ^^^^^^^^^ help: Try doing something like: : `42` - -error: Try not to call a closure in the expression where it is declared. - --> redundant_closure_call.rs:10:14 - | -10 | let mut k = (|m| m+1)(i); - | ^^^^^^^^^^^^ - -error: Try not to call a closure in the expression where it is declared. - --> redundant_closure_call.rs:12:6 - | -12 | k = (|a,b| a*b)(1,5); - | ^^^^^^^^^^^^^^^^ - -error: aborting due to 5 previous errors - - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/redundant_closure_call.stdout b/clippy_tests/examples/redundant_closure_call.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/reference.stdout b/clippy_tests/examples/reference.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/regex.stderr b/clippy_tests/examples/regex.stderr deleted file mode 100644 index 0e52b317fc38..000000000000 --- a/clippy_tests/examples/regex.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error[E0463]: can't find crate for `regex` - --> regex.rs:7:1 - | -7 | extern crate regex; - | ^^^^^^^^^^^^^^^^^^^ can't find crate - -error: aborting due to previous error - - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/regex.stdout b/clippy_tests/examples/regex.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/serde.stderr b/clippy_tests/examples/serde.stderr deleted file mode 100644 index 306611e368bc..000000000000 --- a/clippy_tests/examples/serde.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error[E0463]: can't find crate for `serde` - --> serde.rs:6:1 - | -6 | extern crate serde; - | ^^^^^^^^^^^^^^^^^^^ can't find crate - -error: aborting due to previous error - - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/serde.stdout b/clippy_tests/examples/serde.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/shadow.stdout b/clippy_tests/examples/shadow.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/short_circuit_statement.stdout b/clippy_tests/examples/short_circuit_statement.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/should_assert_eq.stdout b/clippy_tests/examples/should_assert_eq.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/strings.stdout b/clippy_tests/examples/strings.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/stutter.stdout b/clippy_tests/examples/stutter.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/swap.stdout b/clippy_tests/examples/swap.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/temporary_assignment.stdout b/clippy_tests/examples/temporary_assignment.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/toplevel_ref_arg.stdout b/clippy_tests/examples/toplevel_ref_arg.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/unicode.stdout b/clippy_tests/examples/unicode.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/unit_cmp.stdout b/clippy_tests/examples/unit_cmp.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/unneeded_field_pattern.stdout b/clippy_tests/examples/unneeded_field_pattern.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/unsafe_removed_from_name.stdout b/clippy_tests/examples/unsafe_removed_from_name.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/unused_io_amount.stdout b/clippy_tests/examples/unused_io_amount.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/unused_labels.stdout b/clippy_tests/examples/unused_labels.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/unused_lt.stdout b/clippy_tests/examples/unused_lt.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/used_underscore_binding.stdout b/clippy_tests/examples/used_underscore_binding.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/useless_attribute.stderr b/clippy_tests/examples/useless_attribute.stderr deleted file mode 100644 index 98d159620185..000000000000 --- a/clippy_tests/examples/useless_attribute.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error[E0463]: can't find crate for `clippy_lints` - --> useless_attribute.rs:6:1 - | -6 | extern crate clippy_lints; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate - -error: aborting due to previous error - - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/useless_attribute.stdout b/clippy_tests/examples/useless_attribute.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/vec.stdout b/clippy_tests/examples/vec.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/while_loop.stdout b/clippy_tests/examples/while_loop.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/wrong_macro_span.rs_ b/clippy_tests/examples/wrong_macro_span.rs_ deleted file mode 100644 index 5bc9f0883bbe..000000000000 --- a/clippy_tests/examples/wrong_macro_span.rs_ +++ /dev/null @@ -1,26 +0,0 @@ -#![feature(plugin)] - -#![plugin(clippy)] -#![warn(clippy)] -#![allow(unused, if_let_redundant_pattern_matching)] - -fn main() { - #[derive(Debug)] - enum Foo { - A(String), - B, - } - - struct Thingy(Foo); - - macro_rules! issue_1404 { - ($idx:tt) => {{ - let thingy = Thingy(Foo::A("Foo".into())); - let t = &thingy; - - match t.$idx { Foo::A(ref val) => { println!("42"); }, _ => {} } - }} - } - - issue_1404!(0) -} diff --git a/clippy_tests/examples/wrong_self_convention.stdout b/clippy_tests/examples/wrong_self_convention.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/zero_div_zero.stdout b/clippy_tests/examples/zero_div_zero.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/examples/zero_ptr.stdout b/clippy_tests/examples/zero_ptr.stdout deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clippy_tests/src/lib.rs b/clippy_tests/src/lib.rs deleted file mode 100644 index cdfbe1aa5621..000000000000 --- a/clippy_tests/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - } -} diff --git a/tests/compile-test.rs b/tests/compile-test.rs index 4c154859c7cd..b09ce0e4ee85 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -7,14 +7,14 @@ fn run_mode(dir: &'static str, mode: &'static str) { let mut config = compiletest::default_config(); let cfg_mode = mode.parse().expect("Invalid mode"); - config.target_rustcflags = Some("-L clippy_tests/target/debug/ -L clippy_tests/target/debug/deps".to_owned()); + config.target_rustcflags = Some("-L target/debug/ -L target/debug/deps -Dwarnings".to_owned()); if let Ok(name) = var::<&str>("TESTNAME") { let s: String = name.to_owned(); config.filter = Some(s) } config.mode = cfg_mode; - config.build_base = PathBuf::from("clippy_tests/target/debug/test_build_base"); + config.build_base = PathBuf::from("target/debug/test_build_base"); config.src_base = PathBuf::from(format!("tests/{}", dir)); compiletest::run_tests(&config); diff --git a/tests/dogfood.rs b/tests/dogfood.rs index e6b8d6f7d6cc..83b2acf7d815 100644 --- a/tests/dogfood.rs +++ b/tests/dogfood.rs @@ -22,8 +22,8 @@ fn dogfood() { let cfg_mode = "run-fail".parse().expect("Invalid mode"); let mut s = String::new(); - s.push_str(" -L clippy_tests/target/debug/"); - s.push_str(" -L clippy_tests/target/debug/deps"); + s.push_str(" -L target/debug/"); + s.push_str(" -L target/debug/deps"); s.push_str(" -Zextra-plugins=clippy -Ltarget_recur/debug -Dwarnings -Dclippy_pedantic -Dclippy -Dclippy_internal"); config.target_rustcflags = Some(s); if let Ok(name) = var("TESTNAME") { diff --git a/tests/examples.rs b/tests/examples.rs deleted file mode 100644 index 44488f11c5c6..000000000000 --- a/tests/examples.rs +++ /dev/null @@ -1,51 +0,0 @@ -// FIXME: rustc doesn't generate expansion info for `cfg!` anymore -#![allow(logic_bug)] - -#[macro_use] -extern crate duct; - -use std::io::{BufRead, BufReader}; -use std::fs::File; - -#[test] -fn examples() { - 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; - } - print!("testing {}... ", file.file_stem().unwrap().to_str().unwrap()); - let skip = BufReader::new(File::open(&file).unwrap()).lines().any(|line| { - let line = line.as_ref().unwrap().trim(); - line == "// ignore-x86" && cfg!(target_pointer_width = "32") || - line == "// ignore-x86_64" && cfg!(target_pointer_width = "64") - }); - if skip { - println!("skipping"); - continue; - } - cmd!("touch", &file).run().unwrap(); - let stderr = file.with_extension("stderr"); - let stdout = file.with_extension("stdout"); - cmd!("cargo", "rustc", "-q", "--example", file.file_stem().unwrap(), "--", "-Dwarnings", - "-Zremap-path-prefix-from=examples/", "-Zremap-path-prefix-to=", - "-Zremap-path-prefix-from=examples\\", "-Zremap-path-prefix-to=" - ) - .unchecked() - .stdout(&stdout) - .stderr(&stderr) - .env("CLIPPY_DISABLE_WIKI_LINKS", "true") - .dir("clippy_tests") - .run() - .unwrap(); - if cmd!("git", "diff", "--exit-code", stderr).run().is_err() || cmd!("git", "diff", "--exit-code", stdout).run().is_err() { - error = true; - println!("ERROR"); - } else { - println!("ok"); - } - } - assert!(!error, "A test failed"); -} diff --git a/tests/run-pass/associated-constant-ice.rs b/tests/run-pass/associated-constant-ice.rs index a61cd93211d6..8fb55fa2272a 100644 --- a/tests/run-pass/associated-constant-ice.rs +++ b/tests/run-pass/associated-constant-ice.rs @@ -1,4 +1,3 @@ -#![feature(associated_consts)] #![feature(plugin)] #![plugin(clippy)] diff --git a/tests/run-pass/enum-glob-import-crate.rs b/tests/run-pass/enum-glob-import-crate.rs index 5b54698605a7..e08a00d26e2f 100644 --- a/tests/run-pass/enum-glob-import-crate.rs +++ b/tests/run-pass/enum-glob-import-crate.rs @@ -1,6 +1,7 @@ #![feature(plugin)] #![plugin(clippy)] #![deny(clippy)] +#![allow(unused_imports)] use std::*; diff --git a/tests/run-pass/needless_lifetimes_impl_trait.rs b/tests/run-pass/needless_lifetimes_impl_trait.rs index fab2fe626c3b..8edb444f936c 100644 --- a/tests/run-pass/needless_lifetimes_impl_trait.rs +++ b/tests/run-pass/needless_lifetimes_impl_trait.rs @@ -1,7 +1,8 @@ #![feature(plugin)] #![plugin(clippy)] #![feature(conservative_impl_trait)] -#![deny(needless_lifetime)] +#![deny(needless_lifetimes)] +#![allow(dead_code)] trait Foo {} diff --git a/tests/run-pass/regressions.rs b/tests/run-pass/regressions.rs index 6e8b6562f365..442b01d35f80 100644 --- a/tests/run-pass/regressions.rs +++ b/tests/run-pass/regressions.rs @@ -1,5 +1,6 @@ #![feature(plugin)] #![plugin(clippy)] +#![allow(blacklisted_name)] pub fn foo(bar: *const u8) { println!("{:#p}", bar); diff --git a/clippy_tests/examples/absurd-extreme-comparisons.rs b/tests/ui/absurd-extreme-comparisons.rs similarity index 100% rename from clippy_tests/examples/absurd-extreme-comparisons.rs rename to tests/ui/absurd-extreme-comparisons.rs diff --git a/clippy_tests/examples/absurd-extreme-comparisons.stderr b/tests/ui/absurd-extreme-comparisons.stderr similarity index 86% rename from clippy_tests/examples/absurd-extreme-comparisons.stderr rename to tests/ui/absurd-extreme-comparisons.stderr index 15b5f8fecc3f..2b1e9ad66feb 100644 --- a/clippy_tests/examples/absurd-extreme-comparisons.stderr +++ b/tests/ui/absurd-extreme-comparisons.stderr @@ -1,5 +1,5 @@ error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> absurd-extreme-comparisons.rs:10:5 + --> $DIR/absurd-extreme-comparisons.rs:10:5 | 10 | u <= 0; | ^^^^^^ @@ -8,7 +8,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:11:5 + --> $DIR/absurd-extreme-comparisons.rs:11:5 | 11 | u <= Z; | ^^^^^^ @@ -16,7 +16,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:12:5 + --> $DIR/absurd-extreme-comparisons.rs:12:5 | 12 | u < Z; | ^^^^^ @@ -24,7 +24,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:13:5 + --> $DIR/absurd-extreme-comparisons.rs:13:5 | 13 | Z >= u; | ^^^^^^ @@ -32,7 +32,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:14:5 + --> $DIR/absurd-extreme-comparisons.rs:14:5 | 14 | Z > u; | ^^^^^ @@ -40,7 +40,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:15:5 + --> $DIR/absurd-extreme-comparisons.rs:15:5 | 15 | u > std::u32::MAX; | ^^^^^^^^^^^^^^^^^ @@ -48,7 +48,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:16:5 + --> $DIR/absurd-extreme-comparisons.rs:16:5 | 16 | u >= std::u32::MAX; | ^^^^^^^^^^^^^^^^^^ @@ -56,7 +56,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:17:5 + --> $DIR/absurd-extreme-comparisons.rs:17:5 | 17 | std::u32::MAX < u; | ^^^^^^^^^^^^^^^^^ @@ -64,7 +64,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:18:5 + --> $DIR/absurd-extreme-comparisons.rs:18:5 | 18 | std::u32::MAX <= u; | ^^^^^^^^^^^^^^^^^^ @@ -72,7 +72,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:19:5 + --> $DIR/absurd-extreme-comparisons.rs:19:5 | 19 | 1-1 > u; | ^^^^^^^ @@ -80,7 +80,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:20:5 + --> $DIR/absurd-extreme-comparisons.rs:20:5 | 20 | u >= !0; | ^^^^^^^ @@ -88,7 +88,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:21:5 + --> $DIR/absurd-extreme-comparisons.rs:21:5 | 21 | u <= 12 - 2*6; | ^^^^^^^^^^^^^ @@ -96,7 +96,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:23:5 + --> $DIR/absurd-extreme-comparisons.rs:23:5 | 23 | i < -127 - 1; | ^^^^^^^^^^^^ @@ -104,7 +104,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:24:5 + --> $DIR/absurd-extreme-comparisons.rs:24:5 | 24 | std::i8::MAX >= i; | ^^^^^^^^^^^^^^^^^ @@ -112,7 +112,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:25:5 + --> $DIR/absurd-extreme-comparisons.rs:25:5 | 25 | 3-7 < std::i32::MIN; | ^^^^^^^^^^^^^^^^^^^ @@ -120,7 +120,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:27:5 + --> $DIR/absurd-extreme-comparisons.rs:27:5 | 27 | b >= true; | ^^^^^^^^^ @@ -128,7 +128,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> absurd-extreme-comparisons.rs:28:5 + --> $DIR/absurd-extreme-comparisons.rs:28:5 | 28 | false > b; | ^^^^^^^^^ @@ -136,7 +136,7 @@ error: this comparison involving the minimum or maximum element for this type co = help: because false is the minimum value for this type, this comparison is always false error: <-comparison of unit values detected. This will always be false - --> absurd-extreme-comparisons.rs:31:5 + --> $DIR/absurd-extreme-comparisons.rs:31:5 | 31 | () < {}; | ^^^^^^^ @@ -145,5 +145,3 @@ error: <-comparison of unit values detected. This will always be false error: aborting due to 18 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/approx_const.rs b/tests/ui/approx_const.rs similarity index 100% rename from clippy_tests/examples/approx_const.rs rename to tests/ui/approx_const.rs diff --git a/clippy_tests/examples/approx_const.stderr b/tests/ui/approx_const.stderr similarity index 84% rename from clippy_tests/examples/approx_const.stderr rename to tests/ui/approx_const.stderr index a223d88cb8ce..dda28433d7a9 100644 --- a/clippy_tests/examples/approx_const.stderr +++ b/tests/ui/approx_const.stderr @@ -1,5 +1,5 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly - --> approx_const.rs:7:16 + --> $DIR/approx_const.rs:7:16 | 7 | let my_e = 2.7182; | ^^^^^^ @@ -7,114 +7,112 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it dire = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly - --> approx_const.rs:8:20 + --> $DIR/approx_const.rs:8:20 | 8 | let almost_e = 2.718; | ^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_1_PI` found. Consider using it directly - --> approx_const.rs:11:24 + --> $DIR/approx_const.rs:11:24 | 11 | let my_1_frac_pi = 0.3183; | ^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly - --> approx_const.rs:14:28 + --> $DIR/approx_const.rs:14:28 | 14 | let my_frac_1_sqrt_2 = 0.70710678; | ^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly - --> approx_const.rs:15:32 + --> $DIR/approx_const.rs:15:32 | 15 | let almost_frac_1_sqrt_2 = 0.70711; | ^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_2_PI` found. Consider using it directly - --> approx_const.rs:18:24 + --> $DIR/approx_const.rs:18:24 | 18 | let my_frac_2_pi = 0.63661977; | ^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_2_SQRT_PI` found. Consider using it directly - --> approx_const.rs:21:27 + --> $DIR/approx_const.rs:21:27 | 21 | let my_frac_2_sq_pi = 1.128379; | ^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_2` found. Consider using it directly - --> approx_const.rs:24:24 + --> $DIR/approx_const.rs:24:24 | 24 | let my_frac_pi_2 = 1.57079632679; | ^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_3` found. Consider using it directly - --> approx_const.rs:27:24 + --> $DIR/approx_const.rs:27:24 | 27 | let my_frac_pi_3 = 1.04719755119; | ^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_4` found. Consider using it directly - --> approx_const.rs:30:24 + --> $DIR/approx_const.rs:30:24 | 30 | let my_frac_pi_4 = 0.785398163397; | ^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_6` found. Consider using it directly - --> approx_const.rs:33:24 + --> $DIR/approx_const.rs:33:24 | 33 | let my_frac_pi_6 = 0.523598775598; | ^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_8` found. Consider using it directly - --> approx_const.rs:36:24 + --> $DIR/approx_const.rs:36:24 | 36 | let my_frac_pi_8 = 0.3926990816987; | ^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::LN_10` found. Consider using it directly - --> approx_const.rs:39:20 + --> $DIR/approx_const.rs:39:20 | 39 | let my_ln_10 = 2.302585092994046; | ^^^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::LN_2` found. Consider using it directly - --> approx_const.rs:42:19 + --> $DIR/approx_const.rs:42:19 | 42 | let my_ln_2 = 0.6931471805599453; | ^^^^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::LOG10_E` found. Consider using it directly - --> approx_const.rs:45:22 + --> $DIR/approx_const.rs:45:22 | 45 | let my_log10_e = 0.43429448190325182; | ^^^^^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::LOG2_E` found. Consider using it directly - --> approx_const.rs:48:21 + --> $DIR/approx_const.rs:48:21 | 48 | let my_log2_e = 1.4426950408889634; | ^^^^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly - --> approx_const.rs:51:17 + --> $DIR/approx_const.rs:51:17 | 51 | let my_pi = 3.1415; | ^^^^^^ error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly - --> approx_const.rs:52:21 + --> $DIR/approx_const.rs:52:21 | 52 | let almost_pi = 3.14; | ^^^^ error: approximate value of `f{32, 64}::consts::SQRT_2` found. Consider using it directly - --> approx_const.rs:55:18 + --> $DIR/approx_const.rs:55:18 | 55 | let my_sq2 = 1.4142; | ^^^^^^ error: aborting due to 19 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/arithmetic.rs b/tests/ui/arithmetic.rs similarity index 100% rename from clippy_tests/examples/arithmetic.rs rename to tests/ui/arithmetic.rs diff --git a/clippy_tests/examples/arithmetic.stderr b/tests/ui/arithmetic.stderr similarity index 77% rename from clippy_tests/examples/arithmetic.stderr rename to tests/ui/arithmetic.stderr index 727b1da6e13e..ad4a02e21901 100644 --- a/clippy_tests/examples/arithmetic.stderr +++ b/tests/ui/arithmetic.stderr @@ -1,5 +1,5 @@ error: integer arithmetic detected - --> arithmetic.rs:8:5 + --> $DIR/arithmetic.rs:8:5 | 8 | 1 + i; | ^^^^^ @@ -7,32 +7,32 @@ error: integer arithmetic detected = note: `-D integer-arithmetic` implied by `-D warnings` error: integer arithmetic detected - --> arithmetic.rs:9:5 + --> $DIR/arithmetic.rs:9:5 | 9 | i * 2; | ^^^^^ error: integer arithmetic detected - --> arithmetic.rs:10:5 + --> $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 - --> arithmetic.rs:12:5 + --> $DIR/arithmetic.rs:12:5 | 12 | i - 2 + 2 - i; | ^^^^^^^^^^^^^ error: integer arithmetic detected - --> arithmetic.rs:13:5 + --> $DIR/arithmetic.rs:13:5 | 13 | -i; | ^^ error: floating-point arithmetic detected - --> arithmetic.rs:23:5 + --> $DIR/arithmetic.rs:23:5 | 23 | f * 2.0; | ^^^^^^^ @@ -40,36 +40,34 @@ error: floating-point arithmetic detected = note: `-D float-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected - --> arithmetic.rs:25:5 + --> $DIR/arithmetic.rs:25:5 | 25 | 1.0 + f; | ^^^^^^^ error: floating-point arithmetic detected - --> arithmetic.rs:26:5 + --> $DIR/arithmetic.rs:26:5 | 26 | f * 2.0; | ^^^^^^^ error: floating-point arithmetic detected - --> arithmetic.rs:27:5 + --> $DIR/arithmetic.rs:27:5 | 27 | f / 2.0; | ^^^^^^^ error: floating-point arithmetic detected - --> arithmetic.rs:28:5 + --> $DIR/arithmetic.rs:28:5 | 28 | f - 2.0 * 4.2; | ^^^^^^^^^^^^^ error: floating-point arithmetic detected - --> arithmetic.rs:29:5 + --> $DIR/arithmetic.rs:29:5 | 29 | -f; | ^^ error: aborting due to 11 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/array_indexing.rs b/tests/ui/array_indexing.rs similarity index 100% rename from clippy_tests/examples/array_indexing.rs rename to tests/ui/array_indexing.rs diff --git a/clippy_tests/examples/array_indexing.stderr b/tests/ui/array_indexing.stderr similarity index 71% rename from clippy_tests/examples/array_indexing.stderr rename to tests/ui/array_indexing.stderr index dc3bc634952d..ea95c3254606 100644 --- a/clippy_tests/examples/array_indexing.stderr +++ b/tests/ui/array_indexing.stderr @@ -1,5 +1,5 @@ error: const index is out of bounds - --> array_indexing.rs:12:5 + --> $DIR/array_indexing.rs:12:5 | 12 | x[4]; | ^^^^ @@ -7,43 +7,43 @@ error: const index is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: const index is out of bounds - --> array_indexing.rs:13:5 + --> $DIR/array_indexing.rs:13:5 | 13 | x[1 << 3]; | ^^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:14:6 + --> $DIR/array_indexing.rs:14:6 | 14 | &x[1..5]; | ^^^^^^^ error: range is out of bounds - --> array_indexing.rs:16:6 + --> $DIR/array_indexing.rs:16:6 | 16 | &x[0...4]; | ^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:17:6 + --> $DIR/array_indexing.rs:17:6 | 17 | &x[...4]; | ^^^^^^^ error: range is out of bounds - --> array_indexing.rs:21:6 + --> $DIR/array_indexing.rs:21:6 | 21 | &x[5..]; | ^^^^^^ error: range is out of bounds - --> array_indexing.rs:23:6 + --> $DIR/array_indexing.rs:23:6 | 23 | &x[..5]; | ^^^^^^ error: indexing may panic - --> array_indexing.rs:26:5 + --> $DIR/array_indexing.rs:26:5 | 26 | y[0]; | ^^^^ @@ -51,72 +51,70 @@ error: indexing may panic = note: `-D indexing-slicing` implied by `-D warnings` error: slicing may panic - --> array_indexing.rs:27:6 + --> $DIR/array_indexing.rs:27:6 | 27 | &y[1..2]; | ^^^^^^^ error: slicing may panic - --> array_indexing.rs:29:6 + --> $DIR/array_indexing.rs:29:6 | 29 | &y[0...4]; | ^^^^^^^^ error: slicing may panic - --> array_indexing.rs:30:6 + --> $DIR/array_indexing.rs:30:6 | 30 | &y[...4]; | ^^^^^^^ error: const index is out of bounds - --> array_indexing.rs:33:5 + --> $DIR/array_indexing.rs:33:5 | 33 | empty[0]; | ^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:34:6 + --> $DIR/array_indexing.rs:34:6 | 34 | &empty[1..5]; | ^^^^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:35:6 + --> $DIR/array_indexing.rs:35:6 | 35 | &empty[0...4]; | ^^^^^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:36:6 + --> $DIR/array_indexing.rs:36:6 | 36 | &empty[...4]; | ^^^^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:40:6 + --> $DIR/array_indexing.rs:40:6 | 40 | &empty[0...0]; | ^^^^^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:41:6 + --> $DIR/array_indexing.rs:41:6 | 41 | &empty[...0]; | ^^^^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:43:6 + --> $DIR/array_indexing.rs:43:6 | 43 | &empty[1..]; | ^^^^^^^^^^ error: range is out of bounds - --> array_indexing.rs:44:6 + --> $DIR/array_indexing.rs:44:6 | 44 | &empty[..4]; | ^^^^^^^^^^ error: aborting due to 19 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/assign_ops.rs b/tests/ui/assign_ops.rs similarity index 100% rename from clippy_tests/examples/assign_ops.rs rename to tests/ui/assign_ops.rs diff --git a/clippy_tests/examples/assign_ops.stderr b/tests/ui/assign_ops.stderr similarity index 81% rename from clippy_tests/examples/assign_ops.stderr rename to tests/ui/assign_ops.stderr index fd88ca612d2b..2123507e2ef6 100644 --- a/clippy_tests/examples/assign_ops.stderr +++ b/tests/ui/assign_ops.stderr @@ -1,5 +1,5 @@ error: assign operation detected - --> assign_ops.rs:8:5 + --> $DIR/assign_ops.rs:8:5 | 8 | i += 2; | ^^^^^^ help: replace it with: `i = i + 2` @@ -7,79 +7,79 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> assign_ops.rs:9:5 + --> $DIR/assign_ops.rs:9:5 | 9 | i += 2 + 17; | ^^^^^^^^^^^ help: replace it with: `i = i + 2 + 17` error: assign operation detected - --> assign_ops.rs:10:5 + --> $DIR/assign_ops.rs:10:5 | 10 | i -= 6; | ^^^^^^ help: replace it with: `i = i - 6` error: assign operation detected - --> assign_ops.rs:11:5 + --> $DIR/assign_ops.rs:11:5 | 11 | i -= 2 - 1; | ^^^^^^^^^^ help: replace it with: `i = i - (2 - 1)` error: assign operation detected - --> assign_ops.rs:12:5 + --> $DIR/assign_ops.rs:12:5 | 12 | i *= 5; | ^^^^^^ help: replace it with: `i = i * 5` error: assign operation detected - --> assign_ops.rs:13:5 + --> $DIR/assign_ops.rs:13:5 | 13 | i *= 1+5; | ^^^^^^^^ help: replace it with: `i = i * (1+5)` error: assign operation detected - --> assign_ops.rs:14:5 + --> $DIR/assign_ops.rs:14:5 | 14 | i /= 32; | ^^^^^^^ help: replace it with: `i = i / 32` error: assign operation detected - --> assign_ops.rs:15:5 + --> $DIR/assign_ops.rs:15:5 | 15 | i /= 32 | 5; | ^^^^^^^^^^^ help: replace it with: `i = i / (32 | 5)` error: assign operation detected - --> assign_ops.rs:16:5 + --> $DIR/assign_ops.rs:16:5 | 16 | i /= 32 / 5; | ^^^^^^^^^^^ help: replace it with: `i = i / (32 / 5)` error: assign operation detected - --> assign_ops.rs:17:5 + --> $DIR/assign_ops.rs:17:5 | 17 | i %= 42; | ^^^^^^^ help: replace it with: `i = i % 42` error: assign operation detected - --> assign_ops.rs:18:5 + --> $DIR/assign_ops.rs:18:5 | 18 | i >>= i; | ^^^^^^^ help: replace it with: `i = i >> i` error: assign operation detected - --> assign_ops.rs:19:5 + --> $DIR/assign_ops.rs:19:5 | 19 | i <<= 9 + 6 - 7; | ^^^^^^^^^^^^^^^ help: replace it with: `i = i << (9 + 6 - 7)` error: assign operation detected - --> assign_ops.rs:20:5 + --> $DIR/assign_ops.rs:20:5 | 20 | i += 1 << 5; | ^^^^^^^^^^^ help: replace it with: `i = i + (1 << 5)` error: manual implementation of an assign operation - --> assign_ops.rs:27:5 + --> $DIR/assign_ops.rs:27:5 | 27 | a = a + 1; | ^^^^^^^^^ help: replace it with: `a += 1` @@ -87,54 +87,52 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> assign_ops.rs:28:5 + --> $DIR/assign_ops.rs:28:5 | 28 | a = 1 + a; | ^^^^^^^^^ help: replace it with: `a += 1` error: manual implementation of an assign operation - --> assign_ops.rs:29:5 + --> $DIR/assign_ops.rs:29:5 | 29 | a = a - 1; | ^^^^^^^^^ help: replace it with: `a -= 1` error: manual implementation of an assign operation - --> assign_ops.rs:30:5 + --> $DIR/assign_ops.rs:30:5 | 30 | a = a * 99; | ^^^^^^^^^^ help: replace it with: `a *= 99` error: manual implementation of an assign operation - --> assign_ops.rs:31:5 + --> $DIR/assign_ops.rs:31:5 | 31 | a = 42 * a; | ^^^^^^^^^^ help: replace it with: `a *= 42` error: manual implementation of an assign operation - --> assign_ops.rs:32:5 + --> $DIR/assign_ops.rs:32:5 | 32 | a = a / 2; | ^^^^^^^^^ help: replace it with: `a /= 2` error: manual implementation of an assign operation - --> assign_ops.rs:33:5 + --> $DIR/assign_ops.rs:33:5 | 33 | a = a % 5; | ^^^^^^^^^ help: replace it with: `a %= 5` error: manual implementation of an assign operation - --> assign_ops.rs:34:5 + --> $DIR/assign_ops.rs:34:5 | 34 | a = a & 1; | ^^^^^^^^^ help: replace it with: `a &= 1` error: manual implementation of an assign operation - --> assign_ops.rs:40:5 + --> $DIR/assign_ops.rs:40:5 | 40 | s = s + "bla"; | ^^^^^^^^^^^^^ help: replace it with: `s += "bla"` error: aborting due to 22 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/assign_ops2.rs b/tests/ui/assign_ops2.rs similarity index 100% rename from clippy_tests/examples/assign_ops2.rs rename to tests/ui/assign_ops2.rs diff --git a/clippy_tests/examples/assign_ops2.stderr b/tests/ui/assign_ops2.stderr similarity index 83% rename from clippy_tests/examples/assign_ops2.stderr rename to tests/ui/assign_ops2.stderr index 2f7642100b27..0ff211259c03 100644 --- a/clippy_tests/examples/assign_ops2.stderr +++ b/tests/ui/assign_ops2.stderr @@ -1,5 +1,5 @@ error: variable appears on both sides of an assignment operation - --> assign_ops2.rs:8:5 + --> $DIR/assign_ops2.rs:8:5 | 8 | a += a + 1; | ^^^^^^^^^^ help: replace it with: `a += 1` @@ -7,48 +7,46 @@ error: variable appears on both sides of an assignment operation = note: `-D misrefactored-assign-op` implied by `-D warnings` error: variable appears on both sides of an assignment operation - --> assign_ops2.rs:9:5 + --> $DIR/assign_ops2.rs:9:5 | 9 | a += 1 + a; | ^^^^^^^^^^ help: replace it with: `a += 1` error: variable appears on both sides of an assignment operation - --> assign_ops2.rs:10:5 + --> $DIR/assign_ops2.rs:10:5 | 10 | a -= a - 1; | ^^^^^^^^^^ help: replace it with: `a -= 1` error: variable appears on both sides of an assignment operation - --> assign_ops2.rs:11:5 + --> $DIR/assign_ops2.rs:11:5 | 11 | a *= a * 99; | ^^^^^^^^^^^ help: replace it with: `a *= 99` error: variable appears on both sides of an assignment operation - --> assign_ops2.rs:12:5 + --> $DIR/assign_ops2.rs:12:5 | 12 | a *= 42 * a; | ^^^^^^^^^^^ help: replace it with: `a *= 42` error: variable appears on both sides of an assignment operation - --> assign_ops2.rs:13:5 + --> $DIR/assign_ops2.rs:13:5 | 13 | a /= a / 2; | ^^^^^^^^^^ help: replace it with: `a /= 2` error: variable appears on both sides of an assignment operation - --> assign_ops2.rs:14:5 + --> $DIR/assign_ops2.rs:14:5 | 14 | a %= a % 5; | ^^^^^^^^^^ help: replace it with: `a %= 5` error: variable appears on both sides of an assignment operation - --> assign_ops2.rs:15:5 + --> $DIR/assign_ops2.rs:15:5 | 15 | a &= a & 1; | ^^^^^^^^^^ help: replace it with: `a &= 1` error: aborting due to 8 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/attrs.rs b/tests/ui/attrs.rs similarity index 100% rename from clippy_tests/examples/attrs.rs rename to tests/ui/attrs.rs diff --git a/clippy_tests/examples/attrs.stderr b/tests/ui/attrs.stderr similarity index 83% rename from clippy_tests/examples/attrs.stderr rename to tests/ui/attrs.stderr index ce56b8e6e3c6..f743399a6069 100644 --- a/clippy_tests/examples/attrs.stderr +++ b/tests/ui/attrs.stderr @@ -1,5 +1,5 @@ error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea - --> attrs.rs:6:1 + --> $DIR/attrs.rs:6:1 | 6 | #[inline(always)] | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usuall = note: `-D inline-always` implied by `-D warnings` error: the since field must contain a semver-compliant version - --> attrs.rs:27:14 + --> $DIR/attrs.rs:27:14 | 27 | #[deprecated(since = "forever")] | ^^^^^^^^^^^^^^^^^ @@ -15,12 +15,10 @@ error: the since field must contain a semver-compliant version = note: `-D deprecated-semver` implied by `-D warnings` error: the since field must contain a semver-compliant version - --> attrs.rs:30:14 + --> $DIR/attrs.rs:30:14 | 30 | #[deprecated(since = "1")] | ^^^^^^^^^^^ error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/bit_masks.rs b/tests/ui/bit_masks.rs similarity index 100% rename from clippy_tests/examples/bit_masks.rs rename to tests/ui/bit_masks.rs diff --git a/clippy_tests/examples/bit_masks.stderr b/tests/ui/bit_masks.stderr similarity index 82% rename from clippy_tests/examples/bit_masks.stderr rename to tests/ui/bit_masks.stderr index 4c16ed3fec30..1284dd3321c4 100644 --- a/clippy_tests/examples/bit_masks.stderr +++ b/tests/ui/bit_masks.stderr @@ -1,5 +1,5 @@ error: &-masking with zero - --> bit_masks.rs:12:5 + --> $DIR/bit_masks.rs:12:5 | 12 | x & 0 == 0; | ^^^^^^^^^^ @@ -7,7 +7,7 @@ error: &-masking with zero = note: `-D bad-bit-mask` implied by `-D warnings` error: bit mask could be simplified with a call to `trailing_zeros` - --> bit_masks.rs:12:5 + --> $DIR/bit_masks.rs:12:5 | 12 | x & 0 == 0; | ^^^^^^^^^^ help: try: `x.trailing_zeros() > 0` @@ -15,73 +15,73 @@ error: bit mask could be simplified with a call to `trailing_zeros` = note: `-D verbose-bit-mask` implied by `-D warnings` error: bit mask could be simplified with a call to `trailing_zeros` - --> bit_masks.rs:14:5 + --> $DIR/bit_masks.rs:14:5 | 14 | x & 1 == 0; //ok, compared with zero | ^^^^^^^^^^ help: try: `x.trailing_zeros() > 1` error: incompatible bit mask: `_ & 2` can never be equal to `1` - --> bit_masks.rs:15:5 + --> $DIR/bit_masks.rs:15:5 | 15 | x & 2 == 1; | ^^^^^^^^^^ error: incompatible bit mask: `_ | 3` can never be equal to `2` - --> bit_masks.rs:19:5 + --> $DIR/bit_masks.rs:19:5 | 19 | x | 3 == 2; | ^^^^^^^^^^ error: incompatible bit mask: `_ & 1` will never be higher than `1` - --> bit_masks.rs:21:5 + --> $DIR/bit_masks.rs:21:5 | 21 | x & 1 > 1; | ^^^^^^^^^ error: incompatible bit mask: `_ | 2` will always be higher than `1` - --> bit_masks.rs:25:5 + --> $DIR/bit_masks.rs:25:5 | 25 | x | 2 > 1; | ^^^^^^^^^ error: incompatible bit mask: `_ & 7` can never be equal to `8` - --> bit_masks.rs:32:5 + --> $DIR/bit_masks.rs:32:5 | 32 | x & THREE_BITS == 8; | ^^^^^^^^^^^^^^^^^^^ error: incompatible bit mask: `_ | 7` will never be lower than `7` - --> bit_masks.rs:33:5 + --> $DIR/bit_masks.rs:33:5 | 33 | x | EVEN_MORE_REDIRECTION < 7; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: &-masking with zero - --> bit_masks.rs:35:5 + --> $DIR/bit_masks.rs:35:5 | 35 | 0 & x == 0; | ^^^^^^^^^^ error: incompatible bit mask: `_ | 2` will always be higher than `1` - --> bit_masks.rs:39:5 + --> $DIR/bit_masks.rs:39:5 | 39 | 1 < 2 | x; | ^^^^^^^^^ error: incompatible bit mask: `_ | 3` can never be equal to `2` - --> bit_masks.rs:40:5 + --> $DIR/bit_masks.rs:40:5 | 40 | 2 == 3 | x; | ^^^^^^^^^^ error: incompatible bit mask: `_ & 2` can never be equal to `1` - --> bit_masks.rs:41:5 + --> $DIR/bit_masks.rs:41:5 | 41 | 1 == x & 2; | ^^^^^^^^^^ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly - --> bit_masks.rs:52:5 + --> $DIR/bit_masks.rs:52:5 | 52 | x | 1 > 3; | ^^^^^^^^^ @@ -89,24 +89,22 @@ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared = 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 - --> bit_masks.rs:53:5 + --> $DIR/bit_masks.rs:53:5 | 53 | x | 1 < 4; | ^^^^^^^^^ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly - --> bit_masks.rs:54:5 + --> $DIR/bit_masks.rs:54:5 | 54 | x | 1 <= 3; | ^^^^^^^^^^ error: ineffective bit mask: `x | 1` compared to `8`, is the same as x compared directly - --> bit_masks.rs:55:5 + --> $DIR/bit_masks.rs:55:5 | 55 | x | 1 >= 8; | ^^^^^^^^^^ error: aborting due to 17 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/blacklisted_name.rs b/tests/ui/blacklisted_name.rs similarity index 100% rename from clippy_tests/examples/blacklisted_name.rs rename to tests/ui/blacklisted_name.rs diff --git a/clippy_tests/examples/blacklisted_name.stderr b/tests/ui/blacklisted_name.stderr similarity index 77% rename from clippy_tests/examples/blacklisted_name.stderr rename to tests/ui/blacklisted_name.stderr index b8ebf3d9f423..68fbe27a01ee 100644 --- a/clippy_tests/examples/blacklisted_name.stderr +++ b/tests/ui/blacklisted_name.stderr @@ -1,5 +1,5 @@ error: use of a blacklisted/placeholder name `foo` - --> blacklisted_name.rs:7:9 + --> $DIR/blacklisted_name.rs:7:9 | 7 | fn test(foo: ()) {} | ^^^ @@ -7,84 +7,82 @@ error: use of a blacklisted/placeholder name `foo` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `foo` - --> blacklisted_name.rs:10:9 + --> $DIR/blacklisted_name.rs:10:9 | 10 | let foo = 42; | ^^^ error: use of a blacklisted/placeholder name `bar` - --> blacklisted_name.rs:11:9 + --> $DIR/blacklisted_name.rs:11:9 | 11 | let bar = 42; | ^^^ error: use of a blacklisted/placeholder name `baz` - --> blacklisted_name.rs:12:9 + --> $DIR/blacklisted_name.rs:12:9 | 12 | let baz = 42; | ^^^ error: use of a blacklisted/placeholder name `foo` - --> blacklisted_name.rs:18:10 + --> $DIR/blacklisted_name.rs:18:10 | 18 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ error: use of a blacklisted/placeholder name `bar` - --> blacklisted_name.rs:18:20 + --> $DIR/blacklisted_name.rs:18:20 | 18 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ error: use of a blacklisted/placeholder name `baz` - --> blacklisted_name.rs:18:26 + --> $DIR/blacklisted_name.rs:18:26 | 18 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ error: use of a blacklisted/placeholder name `foo` - --> blacklisted_name.rs:23:19 + --> $DIR/blacklisted_name.rs:23:19 | 23 | fn issue_1647(mut foo: u8) { | ^^^ error: use of a blacklisted/placeholder name `bar` - --> blacklisted_name.rs:24:13 + --> $DIR/blacklisted_name.rs:24:13 | 24 | let mut bar = 0; | ^^^ error: use of a blacklisted/placeholder name `baz` - --> blacklisted_name.rs:25:21 + --> $DIR/blacklisted_name.rs:25:21 | 25 | if let Some(mut baz) = Some(42) {} | ^^^ error: use of a blacklisted/placeholder name `bar` - --> blacklisted_name.rs:29:13 + --> $DIR/blacklisted_name.rs:29:13 | 29 | let ref bar = 0; | ^^^ error: use of a blacklisted/placeholder name `baz` - --> blacklisted_name.rs:30:21 + --> $DIR/blacklisted_name.rs:30:21 | 30 | if let Some(ref baz) = Some(42) {} | ^^^ error: use of a blacklisted/placeholder name `bar` - --> blacklisted_name.rs:34:17 + --> $DIR/blacklisted_name.rs:34:17 | 34 | let ref mut bar = 0; | ^^^ error: use of a blacklisted/placeholder name `baz` - --> blacklisted_name.rs:35:25 + --> $DIR/blacklisted_name.rs:35:25 | 35 | if let Some(ref mut baz) = Some(42) {} | ^^^ error: aborting due to 14 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/block_in_if_condition.rs b/tests/ui/block_in_if_condition.rs similarity index 100% rename from clippy_tests/examples/block_in_if_condition.rs rename to tests/ui/block_in_if_condition.rs diff --git a/clippy_tests/examples/block_in_if_condition.stderr b/tests/ui/block_in_if_condition.stderr similarity index 86% rename from clippy_tests/examples/block_in_if_condition.stderr rename to tests/ui/block_in_if_condition.stderr index c7f403ac59e0..4b7d12598ecf 100644 --- a/clippy_tests/examples/block_in_if_condition.stderr +++ b/tests/ui/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' - --> block_in_if_condition.rs:30:8 + --> $DIR/block_in_if_condition.rs:30:8 | 30 | if { | ________^ @@ -19,7 +19,7 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste } ... error: omit braces around single expression condition - --> block_in_if_condition.rs:41:8 + --> $DIR/block_in_if_condition.rs:41:8 | 41 | if { true } { | ^^^^^^^^ @@ -31,19 +31,19 @@ error: omit braces around single expression condition } ... 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' - --> block_in_if_condition.rs:58:49 + --> $DIR/block_in_if_condition.rs:58:49 | 58 | if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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' - --> block_in_if_condition.rs:61:22 + --> $DIR/block_in_if_condition.rs:61:22 | 61 | if predicate(|x| { let target = 3; x == target }, v) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this boolean expression can be simplified - --> block_in_if_condition.rs:67:8 + --> $DIR/block_in_if_condition.rs:67:8 | 67 | if true && x == 3 { | ^^^^^^^^^^^^^^ help: try: `x == 3` @@ -52,5 +52,3 @@ error: this boolean expression can be simplified error: aborting due to 5 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/bool_comparison.rs b/tests/ui/bool_comparison.rs similarity index 100% rename from clippy_tests/examples/bool_comparison.rs rename to tests/ui/bool_comparison.rs diff --git a/clippy_tests/examples/bool_comparison.stderr b/tests/ui/bool_comparison.stderr similarity index 82% rename from clippy_tests/examples/bool_comparison.stderr rename to tests/ui/bool_comparison.stderr index 02b80cb965cc..4436980bc117 100644 --- a/clippy_tests/examples/bool_comparison.stderr +++ b/tests/ui/bool_comparison.stderr @@ -1,5 +1,5 @@ error: equality checks against true are unnecessary - --> bool_comparison.rs:7:8 + --> $DIR/bool_comparison.rs:7:8 | 7 | if x == true { "yes" } else { "no" }; | ^^^^^^^^^ help: try simplifying it as shown: `x` @@ -7,24 +7,22 @@ error: equality checks against true are unnecessary = note: `-D bool-comparison` implied by `-D warnings` error: equality checks against false can be replaced by a negation - --> bool_comparison.rs:8:8 + --> $DIR/bool_comparison.rs:8:8 | 8 | if x == false { "yes" } else { "no" }; | ^^^^^^^^^^ help: try simplifying it as shown: `!x` error: equality checks against true are unnecessary - --> bool_comparison.rs:9:8 + --> $DIR/bool_comparison.rs:9:8 | 9 | if true == x { "yes" } else { "no" }; | ^^^^^^^^^ help: try simplifying it as shown: `x` error: equality checks against false can be replaced by a negation - --> bool_comparison.rs:10:8 + --> $DIR/bool_comparison.rs:10:8 | 10 | if false == x { "yes" } else { "no" }; | ^^^^^^^^^^ help: try simplifying it as shown: `!x` error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/booleans.rs b/tests/ui/booleans.rs similarity index 100% rename from clippy_tests/examples/booleans.rs rename to tests/ui/booleans.rs diff --git a/clippy_tests/examples/booleans.stderr b/tests/ui/booleans.stderr similarity index 86% rename from clippy_tests/examples/booleans.stderr rename to tests/ui/booleans.stderr index 85cc80052058..a15267f22637 100644 --- a/clippy_tests/examples/booleans.stderr +++ b/tests/ui/booleans.stderr @@ -1,18 +1,18 @@ error: this boolean expression contains a logic bug - --> booleans.rs:12:13 + --> $DIR/booleans.rs:12:13 | 12 | let _ = a && b || a; | ^^^^^^^^^^^ help: it would look like the following: `a` | = note: `-D logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression - --> booleans.rs:12:18 + --> $DIR/booleans.rs:12:18 | 12 | let _ = a && b || a; | ^ error: this boolean expression can be simplified - --> booleans.rs:14:13 + --> $DIR/booleans.rs:14:13 | 14 | let _ = !true; | ^^^^^ help: try: `false` @@ -20,67 +20,67 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> booleans.rs:15:13 + --> $DIR/booleans.rs:15:13 | 15 | let _ = !false; | ^^^^^^ help: try: `true` error: this boolean expression can be simplified - --> booleans.rs:16:13 + --> $DIR/booleans.rs:16:13 | 16 | let _ = !!a; | ^^^ help: try: `a` error: this boolean expression contains a logic bug - --> booleans.rs:17:13 + --> $DIR/booleans.rs:17:13 | 17 | let _ = false && a; | ^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> booleans.rs:17:22 + --> $DIR/booleans.rs:17:22 | 17 | let _ = false && a; | ^ error: this boolean expression can be simplified - --> booleans.rs:18:13 + --> $DIR/booleans.rs:18:13 | 18 | let _ = false || a; | ^^^^^^^^^^ help: try: `a` error: this boolean expression contains a logic bug - --> booleans.rs:20:13 + --> $DIR/booleans.rs:20:13 | 20 | let _ = cfg!(you_shall_not_not_pass) && a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> booleans.rs:20:45 + --> $DIR/booleans.rs:20:45 | 20 | let _ = cfg!(you_shall_not_not_pass) && a; | ^ error: this boolean expression can be simplified - --> booleans.rs:23:13 + --> $DIR/booleans.rs:23:13 | 23 | let _ = !(!a && b); | ^^^^^^^^^^ help: try: `!b || a` error: this boolean expression contains a logic bug - --> booleans.rs:33:13 + --> $DIR/booleans.rs:33:13 | 33 | let _ = a == b && a != b; | ^^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> booleans.rs:33:13 + --> $DIR/booleans.rs:33:13 | 33 | let _ = a == b && a != b; | ^^^^^^ error: this boolean expression can be simplified - --> booleans.rs:34:13 + --> $DIR/booleans.rs:34:13 | 34 | let _ = a == b && c == 5 && a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -93,7 +93,7 @@ help: try | ^^^^^^^^^^^^^^^^^^^ error: this boolean expression can be simplified - --> booleans.rs:35:13 + --> $DIR/booleans.rs:35:13 | 35 | let _ = a == b && c == 5 && b == a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -106,31 +106,31 @@ help: try | ^^^^^^^^^^^^^^^^^^^ error: this boolean expression contains a logic bug - --> booleans.rs:36:13 + --> $DIR/booleans.rs:36:13 | 36 | let _ = a < b && a >= b; | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> booleans.rs:36:13 + --> $DIR/booleans.rs:36:13 | 36 | let _ = a < b && a >= b; | ^^^^^ error: this boolean expression contains a logic bug - --> booleans.rs:37:13 + --> $DIR/booleans.rs:37:13 | 37 | let _ = a > b && a <= b; | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> booleans.rs:37:13 + --> $DIR/booleans.rs:37:13 | 37 | let _ = a > b && a <= b; | ^^^^^ error: this boolean expression can be simplified - --> booleans.rs:39:13 + --> $DIR/booleans.rs:39:13 | 39 | let _ = a != b || !(a != b || c == d); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -144,5 +144,3 @@ help: try error: aborting due to 14 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/borrow_box.rs b/tests/ui/borrow_box.rs similarity index 100% rename from clippy_tests/examples/borrow_box.rs rename to tests/ui/borrow_box.rs diff --git a/clippy_tests/examples/borrow_box.stderr b/tests/ui/borrow_box.stderr similarity index 81% rename from clippy_tests/examples/borrow_box.stderr rename to tests/ui/borrow_box.stderr index e494bdd214ee..2cf0ea79626c 100644 --- a/clippy_tests/examples/borrow_box.stderr +++ b/tests/ui/borrow_box.stderr @@ -1,34 +1,32 @@ error: you seem to be trying to use `&Box`. Consider using just `&T` - --> borrow_box.rs:9:19 + --> $DIR/borrow_box.rs:9:19 | 9 | pub fn test1(foo: &mut Box) { | ^^^^^^^^^^^^^^ help: try: `&mut bool` | note: lint level defined here - --> borrow_box.rs:4:9 + --> $DIR/borrow_box.rs:4:9 | 4 | #![deny(borrowed_box)] | ^^^^^^^^^^^^ error: you seem to be trying to use `&Box`. Consider using just `&T` - --> borrow_box.rs:14:14 + --> $DIR/borrow_box.rs:14:14 | 14 | let foo: &Box; | ^^^^^^^^^^ help: try: `&bool` error: you seem to be trying to use `&Box`. Consider using just `&T` - --> borrow_box.rs:18:10 + --> $DIR/borrow_box.rs:18:10 | 18 | foo: &'a Box | ^^^^^^^^^^^^^ help: try: `&'a bool` error: you seem to be trying to use `&Box`. Consider using just `&T` - --> borrow_box.rs:22:17 + --> $DIR/borrow_box.rs:22:17 | 22 | fn test4(a: &Box); | ^^^^^^^^^^ help: try: `&bool` error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/box_vec.rs b/tests/ui/box_vec.rs similarity index 100% rename from clippy_tests/examples/box_vec.rs rename to tests/ui/box_vec.rs diff --git a/clippy_tests/examples/box_vec.stderr b/tests/ui/box_vec.stderr similarity index 81% rename from clippy_tests/examples/box_vec.stderr rename to tests/ui/box_vec.stderr index 0f5835345155..254d07713862 100644 --- a/clippy_tests/examples/box_vec.stderr +++ b/tests/ui/box_vec.stderr @@ -1,5 +1,5 @@ error: you seem to be trying to use `Box>`. Consider using just `Vec` - --> box_vec.rs:17:18 + --> $DIR/box_vec.rs:17:18 | 17 | pub fn test(foo: Box>) { | ^^^^^^^^^^^^^^ @@ -9,5 +9,3 @@ error: you seem to be trying to use `Box>`. Consider using just `Vec` error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/tests/ui/builtin-type-shadow.stderr b/tests/ui/builtin-type-shadow.stderr index 269ff9a0eef5..29eec0e1d6cc 100644 --- a/tests/ui/builtin-type-shadow.stderr +++ b/tests/ui/builtin-type-shadow.stderr @@ -1,10 +1,10 @@ -warning: This generic shadows the built-in type `u32` +error: This generic shadows the built-in type `u32` --> $DIR/builtin-type-shadow.rs:5:8 | 5 | fn foo(a: u32) -> u32 { | ^^^ | - = note: #[warn(builtin_type_shadow)] on by default + = note: `-D builtin-type-shadow` implied by `-D warnings` error[E0308]: mismatched types --> $DIR/builtin-type-shadow.rs:6:5 @@ -15,5 +15,5 @@ error[E0308]: mismatched types = note: expected type `u32` found type `{integer}` -error: aborting due to previous error +error: aborting due to 2 previous errors diff --git a/clippy_tests/examples/cast.rs b/tests/ui/cast.rs similarity index 100% rename from clippy_tests/examples/cast.rs rename to tests/ui/cast.rs diff --git a/clippy_tests/examples/cast.stderr b/tests/ui/cast.stderr similarity index 85% rename from clippy_tests/examples/cast.stderr rename to tests/ui/cast.stderr index 35a4bc02d93a..a2d6687ff60e 100644 --- a/clippy_tests/examples/cast.stderr +++ b/tests/ui/cast.stderr @@ -1,5 +1,5 @@ error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f32's mantissa is only 23 bits wide) - --> cast.rs:8:5 + --> $DIR/cast.rs:8:5 | 8 | 1i32 as f32; | ^^^^^^^^^^^ @@ -7,37 +7,37 @@ error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f = 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) - --> cast.rs:9:5 + --> $DIR/cast.rs:9:5 | 9 | 1i64 as f32; | ^^^^^^^^^^^ error: casting i64 to f64 causes a loss of precision (i64 is 64 bits wide, but f64's mantissa is only 52 bits wide) - --> cast.rs:10:5 + --> $DIR/cast.rs:10:5 | 10 | 1i64 as f64; | ^^^^^^^^^^^ error: casting u32 to f32 causes a loss of precision (u32 is 32 bits wide, but f32's mantissa is only 23 bits wide) - --> cast.rs:11:5 + --> $DIR/cast.rs:11:5 | 11 | 1u32 as f32; | ^^^^^^^^^^^ error: casting u64 to f32 causes a loss of precision (u64 is 64 bits wide, but f32's mantissa is only 23 bits wide) - --> cast.rs:12:5 + --> $DIR/cast.rs:12:5 | 12 | 1u64 as f32; | ^^^^^^^^^^^ error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f64's mantissa is only 52 bits wide) - --> cast.rs:13:5 + --> $DIR/cast.rs:13:5 | 13 | 1u64 as f64; | ^^^^^^^^^^^ error: casting f32 to i32 may truncate the value - --> cast.rs:17:5 + --> $DIR/cast.rs:17:5 | 17 | 1f32 as i32; | ^^^^^^^^^^^ @@ -45,13 +45,13 @@ error: casting f32 to i32 may truncate the value = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting f32 to u32 may truncate the value - --> cast.rs:18:5 + --> $DIR/cast.rs:18:5 | 18 | 1f32 as u32; | ^^^^^^^^^^^ error: casting f32 to u32 may lose the sign of the value - --> cast.rs:18:5 + --> $DIR/cast.rs:18:5 | 18 | 1f32 as u32; | ^^^^^^^^^^^ @@ -59,49 +59,49 @@ error: casting f32 to u32 may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting f64 to f32 may truncate the value - --> cast.rs:19:5 + --> $DIR/cast.rs:19:5 | 19 | 1f64 as f32; | ^^^^^^^^^^^ error: casting i32 to i8 may truncate the value - --> cast.rs:20:5 + --> $DIR/cast.rs:20:5 | 20 | 1i32 as i8; | ^^^^^^^^^^ error: casting i32 to u8 may lose the sign of the value - --> cast.rs:21:5 + --> $DIR/cast.rs:21:5 | 21 | 1i32 as u8; | ^^^^^^^^^^ error: casting i32 to u8 may truncate the value - --> cast.rs:21:5 + --> $DIR/cast.rs:21:5 | 21 | 1i32 as u8; | ^^^^^^^^^^ error: casting f64 to isize may truncate the value - --> cast.rs:22:5 + --> $DIR/cast.rs:22:5 | 22 | 1f64 as isize; | ^^^^^^^^^^^^^ error: casting f64 to usize may truncate the value - --> cast.rs:23:5 + --> $DIR/cast.rs:23:5 | 23 | 1f64 as usize; | ^^^^^^^^^^^^^ error: casting f64 to usize may lose the sign of the value - --> cast.rs:23:5 + --> $DIR/cast.rs:23:5 | 23 | 1f64 as usize; | ^^^^^^^^^^^^^ error: casting u8 to i8 may wrap around the value - --> cast.rs:25:5 + --> $DIR/cast.rs:25:5 | 25 | 1u8 as i8; | ^^^^^^^^^ @@ -109,157 +109,157 @@ error: casting u8 to i8 may wrap around the value = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting u16 to i16 may wrap around the value - --> cast.rs:26:5 + --> $DIR/cast.rs:26:5 | 26 | 1u16 as i16; | ^^^^^^^^^^^ error: casting u32 to i32 may wrap around the value - --> cast.rs:27:5 + --> $DIR/cast.rs:27:5 | 27 | 1u32 as i32; | ^^^^^^^^^^^ error: casting u64 to i64 may wrap around the value - --> cast.rs:28:5 + --> $DIR/cast.rs:28:5 | 28 | 1u64 as i64; | ^^^^^^^^^^^ error: casting usize to isize may wrap around the value - --> cast.rs:29:5 + --> $DIR/cast.rs:29:5 | 29 | 1usize as isize; | ^^^^^^^^^^^^^^^ error: casting i32 to u32 may lose the sign of the value - --> cast.rs:31:5 + --> $DIR/cast.rs:31:5 | 31 | 1i32 as u32; | ^^^^^^^^^^^ error: casting isize to usize may lose the sign of the value - --> cast.rs:32:5 + --> $DIR/cast.rs:32:5 | 32 | 1isize as usize; | ^^^^^^^^^^^^^^^ error: casting isize to i8 may truncate the value - --> cast.rs:35:5 + --> $DIR/cast.rs:35:5 | 35 | 1isize as i8; | ^^^^^^^^^^^^ 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) - --> cast.rs:36:5 + --> $DIR/cast.rs:36:5 | 36 | 1isize as f64; | ^^^^^^^^^^^^^ 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) - --> cast.rs:37:5 + --> $DIR/cast.rs:37:5 | 37 | 1usize as f64; | ^^^^^^^^^^^^^ 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) - --> cast.rs:38:5 + --> $DIR/cast.rs:38:5 | 38 | 1isize as f32; | ^^^^^^^^^^^^^ 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) - --> cast.rs:39:5 + --> $DIR/cast.rs:39:5 | 39 | 1usize as f32; | ^^^^^^^^^^^^^ error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers - --> cast.rs:40:5 + --> $DIR/cast.rs:40:5 | 40 | 1isize as i32; | ^^^^^^^^^^^^^ error: casting isize to u32 may lose the sign of the value - --> cast.rs:41:5 + --> $DIR/cast.rs:41:5 | 41 | 1isize as u32; | ^^^^^^^^^^^^^ error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers - --> cast.rs:41:5 + --> $DIR/cast.rs:41:5 | 41 | 1isize as u32; | ^^^^^^^^^^^^^ error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers - --> cast.rs:42:5 + --> $DIR/cast.rs:42:5 | 42 | 1usize as u32; | ^^^^^^^^^^^^^ error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers - --> cast.rs:43:5 + --> $DIR/cast.rs:43:5 | 43 | 1usize as i32; | ^^^^^^^^^^^^^ error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers - --> cast.rs:43:5 + --> $DIR/cast.rs:43:5 | 43 | 1usize as i32; | ^^^^^^^^^^^^^ error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers - --> cast.rs:45:5 + --> $DIR/cast.rs:45:5 | 45 | 1i64 as isize; | ^^^^^^^^^^^^^ error: casting i64 to usize may lose the sign of the value - --> cast.rs:46:5 + --> $DIR/cast.rs:46:5 | 46 | 1i64 as usize; | ^^^^^^^^^^^^^ error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers - --> cast.rs:46:5 + --> $DIR/cast.rs:46:5 | 46 | 1i64 as usize; | ^^^^^^^^^^^^^ error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers - --> cast.rs:47:5 + --> $DIR/cast.rs:47:5 | 47 | 1u64 as isize; | ^^^^^^^^^^^^^ error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers - --> cast.rs:47:5 + --> $DIR/cast.rs:47:5 | 47 | 1u64 as isize; | ^^^^^^^^^^^^^ error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers - --> cast.rs:48:5 + --> $DIR/cast.rs:48:5 | 48 | 1u64 as usize; | ^^^^^^^^^^^^^ error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers - --> cast.rs:49:5 + --> $DIR/cast.rs:49:5 | 49 | 1u32 as isize; | ^^^^^^^^^^^^^ error: casting i32 to usize may lose the sign of the value - --> cast.rs:52:5 + --> $DIR/cast.rs:52:5 | 52 | 1i32 as usize; | ^^^^^^^^^^^^^ error: casting to the same type is unnecessary (`i32` -> `i32`) - --> cast.rs:54:5 + --> $DIR/cast.rs:54:5 | 54 | 1i32 as i32; | ^^^^^^^^^^^ @@ -267,18 +267,16 @@ error: casting to the same type is unnecessary (`i32` -> `i32`) = note: `-D unnecessary-cast` implied by `-D warnings` error: casting to the same type is unnecessary (`f32` -> `f32`) - --> cast.rs:55:5 + --> $DIR/cast.rs:55:5 | 55 | 1f32 as f32; | ^^^^^^^^^^^ error: casting to the same type is unnecessary (`bool` -> `bool`) - --> cast.rs:56:5 + --> $DIR/cast.rs:56:5 | 56 | false as bool; | ^^^^^^^^^^^^^ error: aborting due to 45 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/char_lit_as_u8.rs b/tests/ui/char_lit_as_u8.rs similarity index 100% rename from clippy_tests/examples/char_lit_as_u8.rs rename to tests/ui/char_lit_as_u8.rs diff --git a/clippy_tests/examples/char_lit_as_u8.stderr b/tests/ui/char_lit_as_u8.stderr similarity index 79% rename from clippy_tests/examples/char_lit_as_u8.stderr rename to tests/ui/char_lit_as_u8.stderr index 32be93eb3b59..fcf038fe002d 100644 --- a/clippy_tests/examples/char_lit_as_u8.stderr +++ b/tests/ui/char_lit_as_u8.stderr @@ -1,5 +1,5 @@ error: casting character literal to u8. `char`s are 4 bytes wide in rust, so casting to u8 truncates them - --> char_lit_as_u8.rs:7:13 + --> $DIR/char_lit_as_u8.rs:7:13 | 7 | let c = 'a' as u8; | ^^^^^^^^^ @@ -10,5 +10,3 @@ error: casting character literal to u8. `char`s are 4 bytes wide in rust, so cas error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/cmp_nan.rs b/tests/ui/cmp_nan.rs similarity index 100% rename from clippy_tests/examples/cmp_nan.rs rename to tests/ui/cmp_nan.rs diff --git a/clippy_tests/examples/cmp_nan.stderr b/tests/ui/cmp_nan.stderr similarity index 84% rename from clippy_tests/examples/cmp_nan.stderr rename to tests/ui/cmp_nan.stderr index 8d4b3b457762..46f3d3d57e0c 100644 --- a/clippy_tests/examples/cmp_nan.stderr +++ b/tests/ui/cmp_nan.stderr @@ -1,5 +1,5 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:8:5 + --> $DIR/cmp_nan.rs:8:5 | 8 | x == std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ @@ -7,72 +7,70 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:9:5 + --> $DIR/cmp_nan.rs:9:5 | 9 | x != std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:10:5 + --> $DIR/cmp_nan.rs:10:5 | 10 | x < std::f32::NAN; | ^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:11:5 + --> $DIR/cmp_nan.rs:11:5 | 11 | x > std::f32::NAN; | ^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:12:5 + --> $DIR/cmp_nan.rs:12:5 | 12 | x <= std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:13:5 + --> $DIR/cmp_nan.rs:13:5 | 13 | x >= std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:16:5 + --> $DIR/cmp_nan.rs:16:5 | 16 | y == std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:17:5 + --> $DIR/cmp_nan.rs:17:5 | 17 | y != std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:18:5 + --> $DIR/cmp_nan.rs:18:5 | 18 | y < std::f64::NAN; | ^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:19:5 + --> $DIR/cmp_nan.rs:19:5 | 19 | y > std::f64::NAN; | ^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:20:5 + --> $DIR/cmp_nan.rs:20:5 | 20 | y <= std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> cmp_nan.rs:21:5 + --> $DIR/cmp_nan.rs:21:5 | 21 | y >= std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ error: aborting due to 12 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/cmp_null.rs b/tests/ui/cmp_null.rs similarity index 100% rename from clippy_tests/examples/cmp_null.rs rename to tests/ui/cmp_null.rs diff --git a/clippy_tests/examples/cmp_null.stderr b/tests/ui/cmp_null.stderr similarity index 79% rename from clippy_tests/examples/cmp_null.stderr rename to tests/ui/cmp_null.stderr index a4b6007758bb..481a4d0f9420 100644 --- a/clippy_tests/examples/cmp_null.stderr +++ b/tests/ui/cmp_null.stderr @@ -1,5 +1,5 @@ error: Comparing with null is better expressed by the .is_null() method - --> cmp_null.rs:11:8 + --> $DIR/cmp_null.rs:11:8 | 11 | if p == ptr::null() { | ^^^^^^^^^^^^^^^^ @@ -7,12 +7,10 @@ error: Comparing with null is better expressed by the .is_null() method = note: `-D cmp-null` implied by `-D warnings` error: Comparing with null is better expressed by the .is_null() method - --> cmp_null.rs:16:8 + --> $DIR/cmp_null.rs:16:8 | 16 | if m == ptr::null_mut() { | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/cmp_owned.rs b/tests/ui/cmp_owned.rs similarity index 100% rename from clippy_tests/examples/cmp_owned.rs rename to tests/ui/cmp_owned.rs diff --git a/clippy_tests/examples/cmp_owned.stderr b/tests/ui/cmp_owned.stderr similarity index 83% rename from clippy_tests/examples/cmp_owned.stderr rename to tests/ui/cmp_owned.stderr index 067f1e68c6eb..d40fb4b8add8 100644 --- a/clippy_tests/examples/cmp_owned.stderr +++ b/tests/ui/cmp_owned.stderr @@ -1,5 +1,5 @@ error: this creates an owned instance just for comparison - --> cmp_owned.rs:8:14 + --> $DIR/cmp_owned.rs:8:14 | 8 | x != "foo".to_string(); | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` @@ -7,36 +7,34 @@ error: this creates an owned instance just for comparison = note: `-D cmp-owned` implied by `-D warnings` error: this creates an owned instance just for comparison - --> cmp_owned.rs:10:9 + --> $DIR/cmp_owned.rs:10:9 | 10 | "foo".to_string() != x; | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison - --> cmp_owned.rs:17:10 + --> $DIR/cmp_owned.rs:17:10 | 17 | x != "foo".to_owned(); | ^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison - --> cmp_owned.rs:19:10 + --> $DIR/cmp_owned.rs:19:10 | 19 | x != String::from("foo"); | ^^^^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison - --> cmp_owned.rs:23:5 + --> $DIR/cmp_owned.rs:23:5 | 23 | Foo.to_owned() == Foo; | ^^^^^^^^^^^^^^ help: try: `Foo` error: this creates an owned instance just for comparison - --> cmp_owned.rs:30:9 + --> $DIR/cmp_owned.rs:30:9 | 30 | self.to_owned() == *other | ^^^^^^^^^^^^^^^ try calling implementing the comparison without allocating error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/collapsible_if.rs b/tests/ui/collapsible_if.rs similarity index 100% rename from clippy_tests/examples/collapsible_if.rs rename to tests/ui/collapsible_if.rs diff --git a/clippy_tests/examples/collapsible_if.stderr b/tests/ui/collapsible_if.stderr similarity index 91% rename from clippy_tests/examples/collapsible_if.stderr rename to tests/ui/collapsible_if.stderr index 88fdb7507089..940749d3f407 100644 --- a/clippy_tests/examples/collapsible_if.stderr +++ b/tests/ui/collapsible_if.stderr @@ -1,5 +1,5 @@ error: this if statement can be collapsed - --> collapsible_if.rs:8:5 + --> $DIR/collapsible_if.rs:8:5 | 8 | / if x == "hello" { 9 | | if y == "world" { @@ -17,7 +17,7 @@ help: try | error: this if statement can be collapsed - --> collapsible_if.rs:14:5 + --> $DIR/collapsible_if.rs:14:5 | 14 | / if x == "hello" || x == "world" { 15 | | if y == "world" || y == "hello" { @@ -34,7 +34,7 @@ help: try | error: this if statement can be collapsed - --> collapsible_if.rs:20:5 + --> $DIR/collapsible_if.rs:20:5 | 20 | / if x == "hello" && x == "world" { 21 | | if y == "world" || y == "hello" { @@ -51,7 +51,7 @@ help: try | error: this if statement can be collapsed - --> collapsible_if.rs:26:5 + --> $DIR/collapsible_if.rs:26:5 | 26 | / if x == "hello" || x == "world" { 27 | | if y == "world" && y == "hello" { @@ -68,7 +68,7 @@ help: try | error: this if statement can be collapsed - --> collapsible_if.rs:32:5 + --> $DIR/collapsible_if.rs:32:5 | 32 | / if x == "hello" && x == "world" { 33 | | if y == "world" && y == "hello" { @@ -85,7 +85,7 @@ help: try | error: this if statement can be collapsed - --> collapsible_if.rs:38:5 + --> $DIR/collapsible_if.rs:38:5 | 38 | / if 42 == 1337 { 39 | | if 'a' != 'A' { @@ -102,7 +102,7 @@ help: try | error: this `else { if .. }` block can be collapsed - --> collapsible_if.rs:47:12 + --> $DIR/collapsible_if.rs:47:12 | 47 | } else { | ____________^ @@ -120,7 +120,7 @@ help: try | error: this `else { if .. }` block can be collapsed - --> collapsible_if.rs:55:12 + --> $DIR/collapsible_if.rs:55:12 | 55 | } else { | ____________^ @@ -138,7 +138,7 @@ help: try | error: this `else { if .. }` block can be collapsed - --> collapsible_if.rs:63:12 + --> $DIR/collapsible_if.rs:63:12 | 63 | } else { | ____________^ @@ -161,7 +161,7 @@ help: try | error: this `else { if .. }` block can be collapsed - --> collapsible_if.rs:74:12 + --> $DIR/collapsible_if.rs:74:12 | 74 | } else { | ____________^ @@ -184,7 +184,7 @@ help: try | error: this `else { if .. }` block can be collapsed - --> collapsible_if.rs:85:12 + --> $DIR/collapsible_if.rs:85:12 | 85 | } else { | ____________^ @@ -207,7 +207,7 @@ help: try | error: this `else { if .. }` block can be collapsed - --> collapsible_if.rs:96:12 + --> $DIR/collapsible_if.rs:96:12 | 96 | } else { | ____________^ @@ -230,7 +230,7 @@ help: try | error: this `else { if .. }` block can be collapsed - --> collapsible_if.rs:107:12 + --> $DIR/collapsible_if.rs:107:12 | 107 | } else { | ____________^ @@ -254,5 +254,3 @@ help: try error: aborting due to 13 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/complex_types.rs b/tests/ui/complex_types.rs similarity index 100% rename from clippy_tests/examples/complex_types.rs rename to tests/ui/complex_types.rs diff --git a/clippy_tests/examples/complex_types.stderr b/tests/ui/complex_types.stderr similarity index 86% rename from clippy_tests/examples/complex_types.stderr rename to tests/ui/complex_types.stderr index bf1088abba1a..829a22c233f0 100644 --- a/clippy_tests/examples/complex_types.stderr +++ b/tests/ui/complex_types.stderr @@ -1,5 +1,5 @@ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:9:12 + --> $DIR/complex_types.rs:9:12 | 9 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,90 +7,88 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:10:12 + --> $DIR/complex_types.rs:10:12 | 10 | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:13:8 + --> $DIR/complex_types.rs:13:8 | 13 | f: Vec>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:16:11 + --> $DIR/complex_types.rs:16:11 | 16 | struct TS(Vec>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:19:11 + --> $DIR/complex_types.rs:19:11 | 19 | Tuple(Vec>>), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:20:17 + --> $DIR/complex_types.rs:20:17 | 20 | Struct { f: Vec>> }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:24:14 + --> $DIR/complex_types.rs:24:14 | 24 | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:25:30 + --> $DIR/complex_types.rs:25:30 | 25 | fn impl_method(&self, p: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:29:14 + --> $DIR/complex_types.rs:29:14 | 29 | const A: Vec>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:30:14 + --> $DIR/complex_types.rs:30:14 | 30 | type B = Vec>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:31:25 + --> $DIR/complex_types.rs:31:25 | 31 | fn method(&self, p: Vec>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:32:29 + --> $DIR/complex_types.rs:32:29 | 32 | fn def_method(&self, p: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:35:15 + --> $DIR/complex_types.rs:35:15 | 35 | fn test1() -> Vec>> { vec![] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:37:14 + --> $DIR/complex_types.rs:37:14 | 37 | fn test2(_x: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> complex_types.rs:40:13 + --> $DIR/complex_types.rs:40:13 | 40 | let _y: Vec>> = vec![]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 15 previous errors - -To learn more, run the command again with --verbose. diff --git a/tests/ui/conf_french_blacklisted_name.stderr b/tests/ui/conf_french_blacklisted_name.stderr index b6782ae4212e..b2b0f26b1405 100644 --- a/tests/ui/conf_french_blacklisted_name.stderr +++ b/tests/ui/conf_french_blacklisted_name.stderr @@ -1,44 +1,46 @@ -warning: use of a blacklisted/placeholder name `toto` +error: use of a blacklisted/placeholder name `toto` --> $DIR/conf_french_blacklisted_name.rs:9:9 | 9 | fn test(toto: ()) {} | ^^^^ | - = note: #[warn(blacklisted_name)] on by default + = note: `-D blacklisted-name` implied by `-D warnings` -warning: use of a blacklisted/placeholder name `toto` +error: use of a blacklisted/placeholder name `toto` --> $DIR/conf_french_blacklisted_name.rs:12:9 | 12 | let toto = 42; | ^^^^ -warning: use of a blacklisted/placeholder name `tata` +error: use of a blacklisted/placeholder name `tata` --> $DIR/conf_french_blacklisted_name.rs:13:9 | 13 | let tata = 42; | ^^^^ -warning: use of a blacklisted/placeholder name `titi` +error: use of a blacklisted/placeholder name `titi` --> $DIR/conf_french_blacklisted_name.rs:14:9 | 14 | let titi = 42; | ^^^^ -warning: use of a blacklisted/placeholder name `toto` +error: use of a blacklisted/placeholder name `toto` --> $DIR/conf_french_blacklisted_name.rs:20:10 | 20 | (toto, Some(tata), titi @ Some(_)) => (), | ^^^^ -warning: use of a blacklisted/placeholder name `tata` +error: use of a blacklisted/placeholder name `tata` --> $DIR/conf_french_blacklisted_name.rs:20:21 | 20 | (toto, Some(tata), titi @ Some(_)) => (), | ^^^^ -warning: use of a blacklisted/placeholder name `titi` +error: 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 + diff --git a/clippy_tests/examples/copies.rs b/tests/ui/copies.rs similarity index 100% rename from clippy_tests/examples/copies.rs rename to tests/ui/copies.rs diff --git a/clippy_tests/examples/copies.stderr b/tests/ui/copies.stderr similarity index 90% rename from clippy_tests/examples/copies.stderr rename to tests/ui/copies.stderr index 737a8b6d4129..bf9e8ed577d0 100644 --- a/clippy_tests/examples/copies.stderr +++ b/tests/ui/copies.stderr @@ -1,6 +1,6 @@ error: This else block is redundant. - --> copies.rs:121:20 + --> $DIR/copies.rs:121:20 | 121 | } else { | ____________________^ @@ -18,7 +18,7 @@ error: This else block is redundant. error: This else block is redundant. - --> copies.rs:131:20 + --> $DIR/copies.rs:131:20 | 131 | } else { | ____________________^ @@ -35,5 +35,3 @@ error: This else block is redundant. error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/cyclomatic_complexity.rs b/tests/ui/cyclomatic_complexity.rs similarity index 100% rename from clippy_tests/examples/cyclomatic_complexity.rs rename to tests/ui/cyclomatic_complexity.rs diff --git a/clippy_tests/examples/cyclomatic_complexity.stderr b/tests/ui/cyclomatic_complexity.stderr similarity index 87% rename from clippy_tests/examples/cyclomatic_complexity.stderr rename to tests/ui/cyclomatic_complexity.stderr index a217d5fd7b87..43676762d6c0 100644 --- a/clippy_tests/examples/cyclomatic_complexity.stderr +++ b/tests/ui/cyclomatic_complexity.stderr @@ -1,5 +1,5 @@ error: the function has a cyclomatic complexity of 28 - --> cyclomatic_complexity.rs:7:1 + --> $DIR/cyclomatic_complexity.rs:7:1 | 7 | / fn main() { 8 | | if true { @@ -14,7 +14,7 @@ error: the function has a cyclomatic complexity of 28 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 7 - --> cyclomatic_complexity.rs:92:1 + --> $DIR/cyclomatic_complexity.rs:92:1 | 92 | / fn kaboom() { 93 | | let n = 0; @@ -28,7 +28,7 @@ error: the function has a cyclomatic complexity of 7 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> cyclomatic_complexity.rs:138:1 + --> $DIR/cyclomatic_complexity.rs:138:1 | 138 | / fn lots_of_short_circuits() -> bool { 139 | | true && false && true && false && true && false && true @@ -38,7 +38,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> cyclomatic_complexity.rs:143:1 + --> $DIR/cyclomatic_complexity.rs:143:1 | 143 | / fn lots_of_short_circuits2() -> bool { 144 | | true || false || true || false || true || false || true @@ -48,7 +48,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> cyclomatic_complexity.rs:148:1 + --> $DIR/cyclomatic_complexity.rs:148:1 | 148 | / fn baa() { 149 | | let x = || match 99 { @@ -62,7 +62,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> cyclomatic_complexity.rs:149:13 + --> $DIR/cyclomatic_complexity.rs:149:13 | 149 | let x = || match 99 { | _____________^ @@ -77,7 +77,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> cyclomatic_complexity.rs:166:1 + --> $DIR/cyclomatic_complexity.rs:166:1 | 166 | / fn bar() { 167 | | match 99 { @@ -90,7 +90,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> cyclomatic_complexity.rs:185:1 + --> $DIR/cyclomatic_complexity.rs:185:1 | 185 | / fn barr() { 186 | | match 99 { @@ -104,7 +104,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> cyclomatic_complexity.rs:195:1 + --> $DIR/cyclomatic_complexity.rs:195:1 | 195 | / fn barr2() { 196 | | match 99 { @@ -118,7 +118,7 @@ error: the function has a cyclomatic complexity of 3 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> cyclomatic_complexity.rs:211:1 + --> $DIR/cyclomatic_complexity.rs:211:1 | 211 | / fn barrr() { 212 | | match 99 { @@ -132,7 +132,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> cyclomatic_complexity.rs:221:1 + --> $DIR/cyclomatic_complexity.rs:221:1 | 221 | / fn barrr2() { 222 | | match 99 { @@ -146,7 +146,7 @@ error: the function has a cyclomatic complexity of 3 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> cyclomatic_complexity.rs:237:1 + --> $DIR/cyclomatic_complexity.rs:237:1 | 237 | / fn barrrr() { 238 | | match 99 { @@ -160,7 +160,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> cyclomatic_complexity.rs:247:1 + --> $DIR/cyclomatic_complexity.rs:247:1 | 247 | / fn barrrr2() { 248 | | match 99 { @@ -174,7 +174,7 @@ error: the function has a cyclomatic complexity of 3 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> cyclomatic_complexity.rs:263:1 + --> $DIR/cyclomatic_complexity.rs:263:1 | 263 | / fn cake() { 264 | | if 4 == 5 { @@ -188,7 +188,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 4 - --> cyclomatic_complexity.rs:274:1 + --> $DIR/cyclomatic_complexity.rs:274:1 | 274 | / pub fn read_file(input_path: &str) -> String { 275 | | use std::fs::File; @@ -202,7 +202,7 @@ error: the function has a cyclomatic complexity of 4 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> cyclomatic_complexity.rs:305:1 + --> $DIR/cyclomatic_complexity.rs:305:1 | 305 | / fn void(void: Void) { 306 | | if true { @@ -215,7 +215,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> cyclomatic_complexity.rs:319:1 + --> $DIR/cyclomatic_complexity.rs:319:1 | 319 | / fn try() -> Result { 320 | | match 5 { @@ -228,7 +228,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> cyclomatic_complexity.rs:327:1 + --> $DIR/cyclomatic_complexity.rs:327:1 | 327 | / fn try_again() -> Result { 328 | | let _ = try!(Ok(42)); @@ -242,7 +242,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> cyclomatic_complexity.rs:343:1 + --> $DIR/cyclomatic_complexity.rs:343:1 | 343 | / fn early() -> Result { 344 | | return Ok(5); @@ -256,7 +256,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 8 - --> cyclomatic_complexity.rs:356:1 + --> $DIR/cyclomatic_complexity.rs:356:1 | 356 | / fn early_ret() -> i32 { 357 | | let a = if true { 42 } else { return 0; }; @@ -271,5 +271,3 @@ error: the function has a cyclomatic complexity of 8 error: aborting due to 20 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/cyclomatic_complexity_attr_used.rs b/tests/ui/cyclomatic_complexity_attr_used.rs similarity index 100% rename from clippy_tests/examples/cyclomatic_complexity_attr_used.rs rename to tests/ui/cyclomatic_complexity_attr_used.rs diff --git a/clippy_tests/examples/cyclomatic_complexity_attr_used.stderr b/tests/ui/cyclomatic_complexity_attr_used.stderr similarity index 80% rename from clippy_tests/examples/cyclomatic_complexity_attr_used.stderr rename to tests/ui/cyclomatic_complexity_attr_used.stderr index a5c5b813bf49..e671b34393b5 100644 --- a/clippy_tests/examples/cyclomatic_complexity_attr_used.stderr +++ b/tests/ui/cyclomatic_complexity_attr_used.stderr @@ -1,5 +1,5 @@ error: the function has a cyclomatic complexity of 3 - --> cyclomatic_complexity_attr_used.rs:11:1 + --> $DIR/cyclomatic_complexity_attr_used.rs:11:1 | 11 | / fn kaboom() { 12 | | if 42 == 43 { @@ -15,5 +15,3 @@ error: the function has a cyclomatic complexity of 3 error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/tests/run-pass/deprecated.rs b/tests/ui/deprecated.rs similarity index 100% rename from tests/run-pass/deprecated.rs rename to tests/ui/deprecated.rs diff --git a/tests/ui/deprecated.stderr b/tests/ui/deprecated.stderr new file mode 100644 index 000000000000..7d5d594cfa1c --- /dev/null +++ b/tests/ui/deprecated.stderr @@ -0,0 +1,28 @@ +error: lint str_to_string has been removed: using `str::to_string` is common even today and specialization will likely happen soon + --> $DIR/deprecated.rs:4:8 + | +4 | #[warn(str_to_string)] + | ^^^^^^^^^^^^^ + | + = note: `-D renamed-and-removed-lints` implied by `-D warnings` + +error: lint string_to_string has been removed: using `string::to_string` is common even today and specialization will likely happen soon + --> $DIR/deprecated.rs:6:8 + | +6 | #[warn(string_to_string)] + | ^^^^^^^^^^^^^^^^ + +error: lint unstable_as_slice has been removed: `Vec::as_slice` has been stabilized in 1.7 + --> $DIR/deprecated.rs:8:8 + | +8 | #[warn(unstable_as_slice)] + | ^^^^^^^^^^^^^^^^^ + +error: lint unstable_as_mut_slice has been removed: `Vec::as_mut_slice` has been stabilized in 1.7 + --> $DIR/deprecated.rs:10:8 + | +10 | #[warn(unstable_as_mut_slice)] + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/clippy_tests/examples/derive.rs b/tests/ui/derive.rs similarity index 100% rename from clippy_tests/examples/derive.rs rename to tests/ui/derive.rs diff --git a/clippy_tests/examples/derive.stderr b/tests/ui/derive.stderr similarity index 85% rename from clippy_tests/examples/derive.stderr rename to tests/ui/derive.stderr index b3640d879770..e34ba09bb813 100644 --- a/clippy_tests/examples/derive.stderr +++ b/tests/ui/derive.stderr @@ -1,12 +1,12 @@ error: you are deriving `Hash` but have implemented `PartialEq` explicitly - --> derive.rs:17:10 + --> $DIR/derive.rs:17:10 | 17 | #[derive(Hash)] | ^^^^ | = note: `-D derive-hash-xor-eq` implied by `-D warnings` note: `PartialEq` implemented here - --> derive.rs:20:1 + --> $DIR/derive.rs:20:1 | 20 | / impl PartialEq for Bar { 21 | | fn eq(&self, _: &Bar) -> bool { true } @@ -14,13 +14,13 @@ note: `PartialEq` implemented here | |_^ error: you are deriving `Hash` but have implemented `PartialEq` explicitly - --> derive.rs:24:10 + --> $DIR/derive.rs:24:10 | 24 | #[derive(Hash)] | ^^^^ | note: `PartialEq` implemented here - --> derive.rs:27:1 + --> $DIR/derive.rs:27:1 | 27 | / impl PartialEq for Baz { 28 | | fn eq(&self, _: &Baz) -> bool { true } @@ -28,7 +28,7 @@ note: `PartialEq` implemented here | |_^ error: you are implementing `Hash` explicitly but have derived `PartialEq` - --> derive.rs:34:1 + --> $DIR/derive.rs:34:1 | 34 | / impl Hash for Bah { 35 | | fn hash(&self, _: &mut H) {} @@ -36,13 +36,13 @@ error: you are implementing `Hash` explicitly but have derived `PartialEq` | |_^ | note: `PartialEq` implemented here - --> derive.rs:31:10 + --> $DIR/derive.rs:31:10 | 31 | #[derive(PartialEq)] | ^^^^^^^^^ error: you are implementing `Clone` explicitly on a `Copy` type - --> derive.rs:41:1 + --> $DIR/derive.rs:41:1 | 41 | / impl Clone for Qux { 42 | | fn clone(&self) -> Self { Qux } @@ -51,7 +51,7 @@ error: you are implementing `Clone` explicitly on a `Copy` type | = note: `-D expl-impl-clone-on-copy` implied by `-D warnings` note: consider deriving `Clone` or removing `Copy` - --> derive.rs:41:1 + --> $DIR/derive.rs:41:1 | 41 | / impl Clone for Qux { 42 | | fn clone(&self) -> Self { Qux } @@ -59,7 +59,7 @@ note: consider deriving `Clone` or removing `Copy` | |_^ error: you are implementing `Clone` explicitly on a `Copy` type - --> derive.rs:65:1 + --> $DIR/derive.rs:65:1 | 65 | / impl<'a> Clone for Lt<'a> { 66 | | fn clone(&self) -> Self { unimplemented!() } @@ -67,7 +67,7 @@ error: you are implementing `Clone` explicitly on a `Copy` type | |_^ | note: consider deriving `Clone` or removing `Copy` - --> derive.rs:65:1 + --> $DIR/derive.rs:65:1 | 65 | / impl<'a> Clone for Lt<'a> { 66 | | fn clone(&self) -> Self { unimplemented!() } @@ -76,5 +76,3 @@ note: consider deriving `Clone` or removing `Copy` error: aborting due to 5 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/diverging_sub_expression.rs b/tests/ui/diverging_sub_expression.rs similarity index 100% rename from clippy_tests/examples/diverging_sub_expression.rs rename to tests/ui/diverging_sub_expression.rs diff --git a/clippy_tests/examples/diverging_sub_expression.stderr b/tests/ui/diverging_sub_expression.stderr similarity index 71% rename from clippy_tests/examples/diverging_sub_expression.stderr rename to tests/ui/diverging_sub_expression.stderr index 0f2c169fcac3..0d7b1ca6fd66 100644 --- a/clippy_tests/examples/diverging_sub_expression.stderr +++ b/tests/ui/diverging_sub_expression.stderr @@ -1,5 +1,5 @@ error: sub-expression diverges - --> diverging_sub_expression.rs:18:10 + --> $DIR/diverging_sub_expression.rs:18:10 | 18 | b || diverge(); | ^^^^^^^^^ @@ -7,36 +7,34 @@ error: sub-expression diverges = note: `-D diverging-sub-expression` implied by `-D warnings` error: sub-expression diverges - --> diverging_sub_expression.rs:19:10 + --> $DIR/diverging_sub_expression.rs:19:10 | 19 | b || A.foo(); | ^^^^^^^ error: sub-expression diverges - --> diverging_sub_expression.rs:28:26 + --> $DIR/diverging_sub_expression.rs:28:26 | 28 | 6 => true || return, | ^^^^^^ error: sub-expression diverges - --> diverging_sub_expression.rs:29:26 + --> $DIR/diverging_sub_expression.rs:29:26 | 29 | 7 => true || continue, | ^^^^^^^^ error: sub-expression diverges - --> diverging_sub_expression.rs:32:26 + --> $DIR/diverging_sub_expression.rs:32:26 | 32 | 3 => true || diverge(), | ^^^^^^^^^ error: sub-expression diverges - --> diverging_sub_expression.rs:37:26 + --> $DIR/diverging_sub_expression.rs:37:26 | 37 | _ => true || break, | ^^^^^ error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/dlist.rs b/tests/ui/dlist.rs similarity index 100% rename from clippy_tests/examples/dlist.rs rename to tests/ui/dlist.rs diff --git a/clippy_tests/examples/dlist.stderr b/tests/ui/dlist.stderr similarity index 88% rename from clippy_tests/examples/dlist.stderr rename to tests/ui/dlist.stderr index 86a85816e046..de0422e17edd 100644 --- a/clippy_tests/examples/dlist.stderr +++ b/tests/ui/dlist.stderr @@ -1,5 +1,5 @@ error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> dlist.rs:12:16 + --> $DIR/dlist.rs:12:16 | 12 | type Baz = LinkedList; | ^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> dlist.rs:13:12 + --> $DIR/dlist.rs:13:12 | 13 | fn foo(LinkedList); | ^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> dlist.rs:14:24 + --> $DIR/dlist.rs:14:24 | 14 | const BAR : Option>; | ^^^^^^^^^^^^^^ @@ -24,7 +24,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> dlist.rs:25:15 + --> $DIR/dlist.rs:25:15 | 25 | fn foo(_: LinkedList) {} | ^^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> dlist.rs:28:39 + --> $DIR/dlist.rs:28:39 | 28 | pub fn test(my_favourite_linked_list: LinkedList) { | ^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> dlist.rs:32:29 + --> $DIR/dlist.rs:32:29 | 32 | pub fn test_ret() -> Option> { | ^^^^^^^^^^^^^^ @@ -49,5 +49,3 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/doc.rs b/tests/ui/doc.rs similarity index 100% rename from clippy_tests/examples/doc.rs rename to tests/ui/doc.rs diff --git a/clippy_tests/examples/doc.stderr b/tests/ui/doc.stderr similarity index 87% rename from clippy_tests/examples/doc.stderr rename to tests/ui/doc.stderr index 26d457a9c91f..c3146f17d088 100644 --- a/clippy_tests/examples/doc.stderr +++ b/tests/ui/doc.stderr @@ -1,5 +1,5 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation - --> doc.rs:1:29 + --> $DIR/doc.rs:1:29 | 1 | //! This file tests for the DOC_MARKDOWN lint | ^^^^^^^^^^^^ @@ -7,156 +7,154 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `foo_bar` between ticks in the documentation - --> doc.rs:8:9 + --> $DIR/doc.rs:8:9 | 8 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^ error: you should put `foo::bar` between ticks in the documentation - --> doc.rs:8:51 + --> $DIR/doc.rs:8:51 | 8 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^^ error: you should put `Foo::some_fun` between ticks in the documentation - --> doc.rs:9:84 + --> $DIR/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 | ^^^^^^^^^^^^^ error: you should put `a::global:path` between ticks in the documentation - --> doc.rs:11:15 + --> $DIR/doc.rs:11:15 | 11 | /// Here be ::a::global:path. | ^^^^^^^^^^^^^^ error: you should put `NotInCodeBlock` between ticks in the documentation - --> doc.rs:12:22 + --> $DIR/doc.rs:12:22 | 12 | /// That's not code ~NotInCodeBlock~. | ^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:13:5 + --> $DIR/doc.rs:13:5 | 13 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:27:5 + --> $DIR/doc.rs:27:5 | 27 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:34:5 + --> $DIR/doc.rs:34:5 | 34 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:48:5 + --> $DIR/doc.rs:48:5 | 48 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `link_with_underscores` between ticks in the documentation - --> doc.rs:52:22 + --> $DIR/doc.rs:52:22 | 52 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823. | ^^^^^^^^^^^^^^^^^^^^^ error: you should put `inline_link2` between ticks in the documentation - --> doc.rs:55:21 + --> $DIR/doc.rs:55:21 | 55 | /// It can also be [inline_link2]. | ^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:65:5 + --> $DIR/doc.rs:65:5 | 65 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> doc.rs:73:8 + --> $DIR/doc.rs:73:8 | 73 | /// ## CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> doc.rs:76:7 + --> $DIR/doc.rs:76:7 | 76 | /// # CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> doc.rs:78:22 + --> $DIR/doc.rs:78:22 | 78 | /// Not a title #897 CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:79:5 + --> $DIR/doc.rs:79:5 | 79 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:86:5 + --> $DIR/doc.rs:86:5 | 86 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:99:5 + --> $DIR/doc.rs:99:5 | 99 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `FooBar` between ticks in the documentation - --> doc.rs:110:42 + --> $DIR/doc.rs:110:42 | 110 | /** E.g. serialization of an empty list: FooBar | ^^^^^^ error: you should put `BarQuz` between ticks in the documentation - --> doc.rs:115:5 + --> $DIR/doc.rs:115:5 | 115 | And BarQuz too. | ^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:116:1 + --> $DIR/doc.rs:116:1 | 116 | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `FooBar` between ticks in the documentation - --> doc.rs:121:42 + --> $DIR/doc.rs:121:42 | 121 | /** E.g. serialization of an empty list: FooBar | ^^^^^^ error: you should put `BarQuz` between ticks in the documentation - --> doc.rs:126:5 + --> $DIR/doc.rs:126:5 | 126 | And BarQuz too. | ^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:127:1 + --> $DIR/doc.rs:127:1 | 127 | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> doc.rs:138:5 + --> $DIR/doc.rs:138:5 | 138 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 26 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/double_neg.rs b/tests/ui/double_neg.rs similarity index 100% rename from clippy_tests/examples/double_neg.rs rename to tests/ui/double_neg.rs diff --git a/clippy_tests/examples/double_neg.stderr b/tests/ui/double_neg.stderr similarity index 73% rename from clippy_tests/examples/double_neg.stderr rename to tests/ui/double_neg.stderr index f403e339483e..fd4da8820a24 100644 --- a/clippy_tests/examples/double_neg.stderr +++ b/tests/ui/double_neg.stderr @@ -1,5 +1,5 @@ error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op - --> double_neg.rs:9:5 + --> $DIR/double_neg.rs:9:5 | 9 | --x; | ^^^ @@ -8,5 +8,3 @@ error: `--x` could be misinterpreted as pre-decrement by C programmers, is usual error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/double_parens.rs b/tests/ui/double_parens.rs similarity index 100% rename from clippy_tests/examples/double_parens.rs rename to tests/ui/double_parens.rs diff --git a/clippy_tests/examples/double_parens.stderr b/tests/ui/double_parens.stderr similarity index 75% rename from clippy_tests/examples/double_parens.stderr rename to tests/ui/double_parens.stderr index d3a5e97602ef..a77b08528c49 100644 --- a/clippy_tests/examples/double_parens.stderr +++ b/tests/ui/double_parens.stderr @@ -1,5 +1,5 @@ error: Consider removing unnecessary double parentheses - --> double_parens.rs:16:5 + --> $DIR/double_parens.rs:16:5 | 16 | ((0)) | ^^^^^ @@ -7,30 +7,28 @@ error: Consider removing unnecessary double parentheses = note: `-D double-parens` implied by `-D warnings` error: Consider removing unnecessary double parentheses - --> double_parens.rs:20:14 + --> $DIR/double_parens.rs:20:14 | 20 | dummy_fn((0)); | ^^^ error: Consider removing unnecessary double parentheses - --> double_parens.rs:24:20 + --> $DIR/double_parens.rs:24:20 | 24 | x.dummy_method((0)); | ^^^ error: Consider removing unnecessary double parentheses - --> double_parens.rs:28:5 + --> $DIR/double_parens.rs:28:5 | 28 | ((1, 2)) | ^^^^^^^^ error: Consider removing unnecessary double parentheses - --> double_parens.rs:32:5 + --> $DIR/double_parens.rs:32:5 | 32 | (()) | ^^^^ error: aborting due to 5 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/drop_forget_copy.rs b/tests/ui/drop_forget_copy.rs similarity index 100% rename from clippy_tests/examples/drop_forget_copy.rs rename to tests/ui/drop_forget_copy.rs diff --git a/clippy_tests/examples/drop_forget_copy.stderr b/tests/ui/drop_forget_copy.stderr similarity index 78% rename from clippy_tests/examples/drop_forget_copy.stderr rename to tests/ui/drop_forget_copy.stderr index c2ae9aa5fc50..3ea7bf9735af 100644 --- a/clippy_tests/examples/drop_forget_copy.stderr +++ b/tests/ui/drop_forget_copy.stderr @@ -1,78 +1,76 @@ error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact. - --> drop_forget_copy.rs:33:5 + --> $DIR/drop_forget_copy.rs:33:5 | 33 | drop(s1); | ^^^^^^^^ | = note: `-D drop-copy` implied by `-D warnings` note: argument has type SomeStruct - --> drop_forget_copy.rs:33:10 + --> $DIR/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. - --> drop_forget_copy.rs:34:5 + --> $DIR/drop_forget_copy.rs:34:5 | 34 | drop(s2); | ^^^^^^^^ | note: argument has type SomeStruct - --> drop_forget_copy.rs:34:10 + --> $DIR/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. - --> drop_forget_copy.rs:36:5 + --> $DIR/drop_forget_copy.rs:36:5 | 36 | drop(s4); | ^^^^^^^^ | note: argument has type SomeStruct - --> drop_forget_copy.rs:36:10 + --> $DIR/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. - --> drop_forget_copy.rs:39:5 + --> $DIR/drop_forget_copy.rs:39:5 | 39 | forget(s1); | ^^^^^^^^^^ | = note: `-D forget-copy` implied by `-D warnings` note: argument has type SomeStruct - --> drop_forget_copy.rs:39:12 + --> $DIR/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. - --> drop_forget_copy.rs:40:5 + --> $DIR/drop_forget_copy.rs:40:5 | 40 | forget(s2); | ^^^^^^^^^^ | note: argument has type SomeStruct - --> drop_forget_copy.rs:40:12 + --> $DIR/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. - --> drop_forget_copy.rs:42:5 + --> $DIR/drop_forget_copy.rs:42:5 | 42 | forget(s4); | ^^^^^^^^^^ | note: argument has type SomeStruct - --> drop_forget_copy.rs:42:12 + --> $DIR/drop_forget_copy.rs:42:12 | 42 | forget(s4); | ^^ error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/drop_forget_ref.rs b/tests/ui/drop_forget_ref.rs similarity index 100% rename from clippy_tests/examples/drop_forget_ref.rs rename to tests/ui/drop_forget_ref.rs diff --git a/clippy_tests/examples/drop_forget_ref.stderr b/tests/ui/drop_forget_ref.stderr similarity index 80% rename from clippy_tests/examples/drop_forget_ref.stderr rename to tests/ui/drop_forget_ref.stderr index 4feda3cc73c5..1654fdd2861a 100644 --- a/clippy_tests/examples/drop_forget_ref.stderr +++ b/tests/ui/drop_forget_ref.stderr @@ -1,222 +1,220 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> drop_forget_ref.rs:12:5 + --> $DIR/drop_forget_ref.rs:12:5 | 12 | drop(&SomeStruct); | ^^^^^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> drop_forget_ref.rs:12:10 + --> $DIR/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. - --> drop_forget_ref.rs:13:5 + --> $DIR/drop_forget_ref.rs:13:5 | 13 | forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> drop_forget_ref.rs:13:12 + --> $DIR/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. - --> drop_forget_ref.rs:16:5 + --> $DIR/drop_forget_ref.rs:16:5 | 16 | drop(&owned1); | ^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> drop_forget_ref.rs:16:10 + --> $DIR/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. - --> drop_forget_ref.rs:17:5 + --> $DIR/drop_forget_ref.rs:17:5 | 17 | drop(&&owned1); | ^^^^^^^^^^^^^^ | note: argument has type &&SomeStruct - --> drop_forget_ref.rs:17:10 + --> $DIR/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. - --> drop_forget_ref.rs:18:5 + --> $DIR/drop_forget_ref.rs:18:5 | 18 | drop(&mut owned1); | ^^^^^^^^^^^^^^^^^ | note: argument has type &mut SomeStruct - --> drop_forget_ref.rs:18:10 + --> $DIR/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. - --> drop_forget_ref.rs:21:5 + --> $DIR/drop_forget_ref.rs:21:5 | 21 | forget(&owned2); | ^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> drop_forget_ref.rs:21:12 + --> $DIR/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. - --> drop_forget_ref.rs:22:5 + --> $DIR/drop_forget_ref.rs:22:5 | 22 | forget(&&owned2); | ^^^^^^^^^^^^^^^^ | note: argument has type &&SomeStruct - --> drop_forget_ref.rs:22:12 + --> $DIR/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. - --> drop_forget_ref.rs:23:5 + --> $DIR/drop_forget_ref.rs:23:5 | 23 | forget(&mut owned2); | ^^^^^^^^^^^^^^^^^^^ | note: argument has type &mut SomeStruct - --> drop_forget_ref.rs:23:12 + --> $DIR/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. - --> drop_forget_ref.rs:27:5 + --> $DIR/drop_forget_ref.rs:27:5 | 27 | drop(reference1); | ^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> drop_forget_ref.rs:27:10 + --> $DIR/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. - --> drop_forget_ref.rs:28:5 + --> $DIR/drop_forget_ref.rs:28:5 | 28 | forget(&*reference1); | ^^^^^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> drop_forget_ref.rs:28:12 + --> $DIR/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. - --> drop_forget_ref.rs:31:5 + --> $DIR/drop_forget_ref.rs:31:5 | 31 | drop(reference2); | ^^^^^^^^^^^^^^^^ | note: argument has type &mut SomeStruct - --> drop_forget_ref.rs:31:10 + --> $DIR/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. - --> drop_forget_ref.rs:33:5 + --> $DIR/drop_forget_ref.rs:33:5 | 33 | forget(reference3); | ^^^^^^^^^^^^^^^^^^ | note: argument has type &mut SomeStruct - --> drop_forget_ref.rs:33:12 + --> $DIR/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. - --> drop_forget_ref.rs:36:5 + --> $DIR/drop_forget_ref.rs:36:5 | 36 | drop(reference4); | ^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> drop_forget_ref.rs:36:10 + --> $DIR/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. - --> drop_forget_ref.rs:37:5 + --> $DIR/drop_forget_ref.rs:37:5 | 37 | forget(reference4); | ^^^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> drop_forget_ref.rs:37:12 + --> $DIR/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. - --> drop_forget_ref.rs:42:5 + --> $DIR/drop_forget_ref.rs:42:5 | 42 | drop(&val); | ^^^^^^^^^^ | note: argument has type &T - --> drop_forget_ref.rs:42:10 + --> $DIR/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. - --> drop_forget_ref.rs:48:5 + --> $DIR/drop_forget_ref.rs:48:5 | 48 | forget(&val); | ^^^^^^^^^^^^ | note: argument has type &T - --> drop_forget_ref.rs:48:12 + --> $DIR/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. - --> drop_forget_ref.rs:56:5 + --> $DIR/drop_forget_ref.rs:56:5 | 56 | std::mem::drop(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> drop_forget_ref.rs:56:20 + --> $DIR/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. - --> drop_forget_ref.rs:59:5 + --> $DIR/drop_forget_ref.rs:59:5 | 59 | std::mem::forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> drop_forget_ref.rs:59:22 + --> $DIR/drop_forget_ref.rs:59:22 | 59 | std::mem::forget(&SomeStruct); | ^^^^^^^^^^^ error: aborting due to 18 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/duplicate_underscore_argument.rs b/tests/ui/duplicate_underscore_argument.rs similarity index 100% rename from clippy_tests/examples/duplicate_underscore_argument.rs rename to tests/ui/duplicate_underscore_argument.rs diff --git a/clippy_tests/examples/duplicate_underscore_argument.stderr b/tests/ui/duplicate_underscore_argument.stderr similarity index 78% rename from clippy_tests/examples/duplicate_underscore_argument.stderr rename to tests/ui/duplicate_underscore_argument.stderr index 3cd8d5306ac3..c926f57f154f 100644 --- a/clippy_tests/examples/duplicate_underscore_argument.stderr +++ b/tests/ui/duplicate_underscore_argument.stderr @@ -1,5 +1,5 @@ error: `darth` already exists, having another argument having almost the same name makes code comprehension and documentation more difficult - --> duplicate_underscore_argument.rs:7:23 + --> $DIR/duplicate_underscore_argument.rs:7:23 | 7 | fn join_the_dark_side(darth: i32, _darth: i32) {} | ^^^^^ @@ -8,5 +8,3 @@ error: `darth` already exists, having another argument having almost the same na error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/empty_enum.rs b/tests/ui/empty_enum.rs similarity index 100% rename from clippy_tests/examples/empty_enum.rs rename to tests/ui/empty_enum.rs diff --git a/clippy_tests/examples/empty_enum.stderr b/tests/ui/empty_enum.stderr similarity index 73% rename from clippy_tests/examples/empty_enum.stderr rename to tests/ui/empty_enum.stderr index 74b4ae3d1b1a..ca377cee8221 100644 --- a/clippy_tests/examples/empty_enum.stderr +++ b/tests/ui/empty_enum.stderr @@ -1,17 +1,15 @@ error: enum with no variants - --> empty_enum.rs:7:1 + --> $DIR/empty_enum.rs:7:1 | 7 | enum Empty {} | ^^^^^^^^^^^^^ | = note: `-D empty-enum` implied by `-D warnings` help: consider using the uninhabited type `!` or a wrapper around it - --> empty_enum.rs:7:1 + --> $DIR/empty_enum.rs:7:1 | 7 | enum Empty {} | ^^^^^^^^^^^^^ error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/entry.rs b/tests/ui/entry.rs similarity index 100% rename from clippy_tests/examples/entry.rs rename to tests/ui/entry.rs diff --git a/clippy_tests/examples/entry.stderr b/tests/ui/entry.stderr similarity index 90% rename from clippy_tests/examples/entry.stderr rename to tests/ui/entry.stderr index dd29d5e14f25..09c4a8822802 100644 --- a/clippy_tests/examples/entry.stderr +++ b/tests/ui/entry.stderr @@ -1,5 +1,5 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` - --> entry.rs:13:5 + --> $DIR/entry.rs:13:5 | 13 | if !m.contains_key(&k) { m.insert(k, v); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k).or_insert(v)` @@ -7,42 +7,40 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` = note: `-D map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> entry.rs:17:5 + --> $DIR/entry.rs:17:5 | 17 | if !m.contains_key(&k) { foo(); m.insert(k, v); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> entry.rs:21:5 + --> $DIR/entry.rs:21:5 | 21 | if !m.contains_key(&k) { m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> entry.rs:25:5 + --> $DIR/entry.rs:25:5 | 25 | if m.contains_key(&k) { None } else { m.insert(k, v) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> entry.rs:29:5 + --> $DIR/entry.rs:29:5 | 29 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> entry.rs:33:5 + --> $DIR/entry.rs:33:5 | 33 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `BTreeMap` - --> entry.rs:37:5 + --> $DIR/entry.rs:37:5 | 37 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: aborting due to 7 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/enum_glob_use.rs b/tests/ui/enum_glob_use.rs similarity index 100% rename from clippy_tests/examples/enum_glob_use.rs rename to tests/ui/enum_glob_use.rs diff --git a/clippy_tests/examples/enum_glob_use.stderr b/tests/ui/enum_glob_use.stderr similarity index 74% rename from clippy_tests/examples/enum_glob_use.stderr rename to tests/ui/enum_glob_use.stderr index 8d0c5b346941..2d53618c1b18 100644 --- a/clippy_tests/examples/enum_glob_use.stderr +++ b/tests/ui/enum_glob_use.stderr @@ -1,5 +1,5 @@ error: don't use glob imports for enum variants - --> enum_glob_use.rs:6:1 + --> $DIR/enum_glob_use.rs:6:1 | 6 | use std::cmp::Ordering::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,12 +7,10 @@ error: don't use glob imports for enum variants = note: `-D enum-glob-use` implied by `-D warnings` error: don't use glob imports for enum variants - --> enum_glob_use.rs:12:1 + --> $DIR/enum_glob_use.rs:12:1 | 12 | use self::Enum::*; | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/enum_variants.rs b/tests/ui/enum_variants.rs similarity index 100% rename from clippy_tests/examples/enum_variants.rs rename to tests/ui/enum_variants.rs diff --git a/clippy_tests/examples/enum_variants.stderr b/tests/ui/enum_variants.stderr similarity index 86% rename from clippy_tests/examples/enum_variants.stderr rename to tests/ui/enum_variants.stderr index 853839270c0f..e33e29ec78e1 100644 --- a/clippy_tests/examples/enum_variants.stderr +++ b/tests/ui/enum_variants.stderr @@ -1,5 +1,5 @@ error: Variant name ends with the enum's name - --> enum_variants.rs:14:5 + --> $DIR/enum_variants.rs:14:5 | 14 | cFoo, | ^^^^ @@ -7,25 +7,25 @@ error: Variant name ends with the enum's name = note: `-D enum-variant-names` implied by `-D warnings` error: Variant name starts with the enum's name - --> enum_variants.rs:25:5 + --> $DIR/enum_variants.rs:25:5 | 25 | FoodGood, | ^^^^^^^^ error: Variant name starts with the enum's name - --> enum_variants.rs:26:5 + --> $DIR/enum_variants.rs:26:5 | 26 | FoodMiddle, | ^^^^^^^^^^ error: Variant name starts with the enum's name - --> enum_variants.rs:27:5 + --> $DIR/enum_variants.rs:27:5 | 27 | FoodBad, | ^^^^^^^ error: All variants have the same prefix: `Food` - --> enum_variants.rs:24:1 + --> $DIR/enum_variants.rs:24:1 | 24 | / enum Food { 25 | | FoodGood, @@ -37,7 +37,7 @@ error: All variants have the same prefix: `Food` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `CallType` - --> enum_variants.rs:34:1 + --> $DIR/enum_variants.rs:34:1 | 34 | / enum BadCallType { 35 | | CallTypeCall, @@ -49,7 +49,7 @@ error: All variants have the same prefix: `CallType` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `Constant` - --> enum_variants.rs:45:1 + --> $DIR/enum_variants.rs:45:1 | 45 | / enum Consts { 46 | | ConstantInt, @@ -61,7 +61,7 @@ error: All variants have the same prefix: `Constant` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `With` - --> enum_variants.rs:78:1 + --> $DIR/enum_variants.rs:78:1 | 78 | / enum Seallll { 79 | | WithOutCake, @@ -73,7 +73,7 @@ error: All variants have the same prefix: `With` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `Prefix` - --> enum_variants.rs:84:1 + --> $DIR/enum_variants.rs:84:1 | 84 | / enum NonCaps { 85 | | Prefix的, @@ -85,7 +85,7 @@ error: All variants have the same prefix: `Prefix` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `With` - --> enum_variants.rs:90:1 + --> $DIR/enum_variants.rs:90:1 | 90 | / pub enum PubSeall { 91 | | WithOutCake, @@ -99,5 +99,3 @@ error: All variants have the same prefix: `With` error: aborting due to 10 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/enums_clike.rs b/tests/ui/enums_clike.rs similarity index 100% rename from clippy_tests/examples/enums_clike.rs rename to tests/ui/enums_clike.rs diff --git a/clippy_tests/examples/enums_clike.stderr b/tests/ui/enums_clike.stderr similarity index 82% rename from clippy_tests/examples/enums_clike.stderr rename to tests/ui/enums_clike.stderr index ff61b2883c5a..d6a137c6fe4d 100644 --- a/clippy_tests/examples/enums_clike.stderr +++ b/tests/ui/enums_clike.stderr @@ -1,5 +1,5 @@ error: Clike enum variant discriminant is not portable to 32-bit targets - --> enums_clike.rs:10:5 + --> $DIR/enums_clike.rs:10:5 | 10 | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ @@ -7,48 +7,46 @@ error: Clike enum variant discriminant is not portable to 32-bit targets = note: `-D enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> enums_clike.rs:17:5 + --> $DIR/enums_clike.rs:17:5 | 17 | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> enums_clike.rs:20:5 + --> $DIR/enums_clike.rs:20:5 | 20 | A = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> enums_clike.rs:27:5 + --> $DIR/enums_clike.rs:27:5 | 27 | Z = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> enums_clike.rs:28:5 + --> $DIR/enums_clike.rs:28:5 | 28 | A = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> enums_clike.rs:30:5 + --> $DIR/enums_clike.rs:30:5 | 30 | C = (std::i32::MIN as isize) - 1, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> enums_clike.rs:36:5 + --> $DIR/enums_clike.rs:36:5 | 36 | Z = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> enums_clike.rs:37:5 + --> $DIR/enums_clike.rs:37:5 | 37 | A = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/eq_op.rs b/tests/ui/eq_op.rs similarity index 100% rename from clippy_tests/examples/eq_op.rs rename to tests/ui/eq_op.rs diff --git a/clippy_tests/examples/eq_op.stderr b/tests/ui/eq_op.stderr similarity index 82% rename from clippy_tests/examples/eq_op.stderr rename to tests/ui/eq_op.stderr index 87e0e88584ac..46c0ac108cda 100644 --- a/clippy_tests/examples/eq_op.stderr +++ b/tests/ui/eq_op.stderr @@ -1,5 +1,5 @@ error: this boolean expression can be simplified - --> eq_op.rs:37:5 + --> $DIR/eq_op.rs:37:5 | 37 | true && true; | ^^^^^^^^^^^^ help: try: `true` @@ -7,37 +7,37 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> eq_op.rs:39:5 + --> $DIR/eq_op.rs:39:5 | 39 | true || true; | ^^^^^^^^^^^^ help: try: `true` error: this boolean expression can be simplified - --> eq_op.rs:45:5 + --> $DIR/eq_op.rs:45:5 | 45 | a == b && b == a; | ^^^^^^^^^^^^^^^^ help: try: `a == b` error: this boolean expression can be simplified - --> eq_op.rs:46:5 + --> $DIR/eq_op.rs:46:5 | 46 | a != b && b != a; | ^^^^^^^^^^^^^^^^ help: try: `a != b` error: this boolean expression can be simplified - --> eq_op.rs:47:5 + --> $DIR/eq_op.rs:47:5 | 47 | a < b && b > a; | ^^^^^^^^^^^^^^ help: try: `a < b` error: this boolean expression can be simplified - --> eq_op.rs:48:5 + --> $DIR/eq_op.rs:48:5 | 48 | a <= b && b >= a; | ^^^^^^^^^^^^^^^^ help: try: `a <= b` error: equal expressions as operands to `==` - --> eq_op.rs:10:5 + --> $DIR/eq_op.rs:10:5 | 10 | 1 == 1; | ^^^^^^ @@ -45,157 +45,157 @@ error: equal expressions as operands to `==` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> eq_op.rs:11:5 + --> $DIR/eq_op.rs:11:5 | 11 | "no" == "no"; | ^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> eq_op.rs:13:5 + --> $DIR/eq_op.rs:13:5 | 13 | false != false; | ^^^^^^^^^^^^^^ error: equal expressions as operands to `<` - --> eq_op.rs:14:5 + --> $DIR/eq_op.rs:14:5 | 14 | 1.5 < 1.5; | ^^^^^^^^^ error: equal expressions as operands to `>=` - --> eq_op.rs:15:5 + --> $DIR/eq_op.rs:15:5 | 15 | 1u64 >= 1u64; | ^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> eq_op.rs:18:5 + --> $DIR/eq_op.rs:18:5 | 18 | (1 as u64) & (1 as u64); | ^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `^` - --> eq_op.rs:19:5 + --> $DIR/eq_op.rs:19:5 | 19 | 1 ^ ((((((1)))))); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `<` - --> eq_op.rs:22:5 + --> $DIR/eq_op.rs:22:5 | 22 | (-(2) < -(2)); | ^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> eq_op.rs:23:5 + --> $DIR/eq_op.rs:23:5 | 23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> eq_op.rs:23:6 + --> $DIR/eq_op.rs:23:6 | 23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> eq_op.rs:23:27 + --> $DIR/eq_op.rs:23:27 | 23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> eq_op.rs:24:5 + --> $DIR/eq_op.rs:24:5 | 24 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> eq_op.rs:27:5 + --> $DIR/eq_op.rs:27:5 | 27 | ([1] != [1]); | ^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> eq_op.rs:28:5 + --> $DIR/eq_op.rs:28:5 | 28 | ((1, 2) != (1, 2)); | ^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> eq_op.rs:32:5 + --> $DIR/eq_op.rs:32:5 | 32 | 1 + 1 == 2; | ^^^^^^^^^^ error: equal expressions as operands to `==` - --> eq_op.rs:33:5 + --> $DIR/eq_op.rs:33:5 | 33 | 1 - 1 == 0; | ^^^^^^^^^^ error: equal expressions as operands to `-` - --> eq_op.rs:33:5 + --> $DIR/eq_op.rs:33:5 | 33 | 1 - 1 == 0; | ^^^^^ error: equal expressions as operands to `-` - --> eq_op.rs:35:5 + --> $DIR/eq_op.rs:35:5 | 35 | 1 - 1; | ^^^^^ error: equal expressions as operands to `/` - --> eq_op.rs:36:5 + --> $DIR/eq_op.rs:36:5 | 36 | 1 / 1; | ^^^^^ error: equal expressions as operands to `&&` - --> eq_op.rs:37:5 + --> $DIR/eq_op.rs:37:5 | 37 | true && true; | ^^^^^^^^^^^^ error: equal expressions as operands to `||` - --> eq_op.rs:39:5 + --> $DIR/eq_op.rs:39:5 | 39 | true || true; | ^^^^^^^^^^^^ error: equal expressions as operands to `&&` - --> eq_op.rs:45:5 + --> $DIR/eq_op.rs:45:5 | 45 | a == b && b == a; | ^^^^^^^^^^^^^^^^ error: equal expressions as operands to `&&` - --> eq_op.rs:46:5 + --> $DIR/eq_op.rs:46:5 | 46 | a != b && b != a; | ^^^^^^^^^^^^^^^^ error: equal expressions as operands to `&&` - --> eq_op.rs:47:5 + --> $DIR/eq_op.rs:47:5 | 47 | a < b && b > a; | ^^^^^^^^^^^^^^ error: equal expressions as operands to `&&` - --> eq_op.rs:48:5 + --> $DIR/eq_op.rs:48:5 | 48 | a <= b && b >= a; | ^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> eq_op.rs:51:5 + --> $DIR/eq_op.rs:51:5 | 51 | a == a; | ^^^^^^ error: taken reference of right operand - --> eq_op.rs:89:13 + --> $DIR/eq_op.rs:89:13 | 89 | let z = x & &y; | ^^^^-- @@ -206,5 +206,3 @@ error: taken reference of right operand error: aborting due to 33 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/escape_analysis.rs b/tests/ui/escape_analysis.rs similarity index 100% rename from clippy_tests/examples/escape_analysis.rs rename to tests/ui/escape_analysis.rs diff --git a/clippy_tests/examples/escape_analysis.stderr b/tests/ui/escape_analysis.stderr similarity index 100% rename from clippy_tests/examples/escape_analysis.stderr rename to tests/ui/escape_analysis.stderr diff --git a/clippy_tests/examples/eta.rs b/tests/ui/eta.rs similarity index 100% rename from clippy_tests/examples/eta.rs rename to tests/ui/eta.rs diff --git a/clippy_tests/examples/eta.stderr b/tests/ui/eta.stderr similarity index 87% rename from clippy_tests/examples/eta.stderr rename to tests/ui/eta.stderr index e6600be3358d..88abbaa73438 100644 --- a/clippy_tests/examples/eta.stderr +++ b/tests/ui/eta.stderr @@ -1,5 +1,5 @@ error: redundant closure found - --> eta.rs:7:27 + --> $DIR/eta.rs:7:27 | 7 | let a = Some(1u8).map(|a| foo(a)); | ^^^^^^^^^^ help: remove closure as shown: `foo` @@ -7,19 +7,19 @@ error: redundant closure found = note: `-D redundant-closure` implied by `-D warnings` error: redundant closure found - --> eta.rs:8:10 + --> $DIR/eta.rs:8:10 | 8 | meta(|a| foo(a)); | ^^^^^^^^^^ help: remove closure as shown: `foo` error: redundant closure found - --> eta.rs:9:27 + --> $DIR/eta.rs:9:27 | 9 | let c = Some(1u8).map(|a| {1+2; foo}(a)); | ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}` error: this expression borrows a reference that is immediately dereferenced by the compiler - --> eta.rs:11:21 + --> $DIR/eta.rs:11:21 | 11 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted | ^^^ @@ -27,12 +27,10 @@ error: this expression borrows a reference that is immediately dereferenced by t = note: `-D needless-borrow` implied by `-D warnings` error: redundant closure found - --> eta.rs:18:27 + --> $DIR/eta.rs:18:27 | 18 | let e = Some(1u8).map(|a| generic(a)); | ^^^^^^^^^^^^^^ help: remove closure as shown: `generic` error: aborting due to 5 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/eval_order_dependence.rs b/tests/ui/eval_order_dependence.rs similarity index 100% rename from clippy_tests/examples/eval_order_dependence.rs rename to tests/ui/eval_order_dependence.rs diff --git a/clippy_tests/examples/eval_order_dependence.stderr b/tests/ui/eval_order_dependence.stderr similarity index 76% rename from clippy_tests/examples/eval_order_dependence.stderr rename to tests/ui/eval_order_dependence.stderr index 24e9f9740ca5..2e01a167c01b 100644 --- a/clippy_tests/examples/eval_order_dependence.stderr +++ b/tests/ui/eval_order_dependence.stderr @@ -1,53 +1,51 @@ error: unsequenced read of a variable - --> eval_order_dependence.rs:8:28 + --> $DIR/eval_order_dependence.rs:8:28 | 8 | let a = { x = 1; 1 } + x; | ^ | = note: `-D eval-order-dependence` implied by `-D warnings` note: whether read occurs before this write depends on evaluation order - --> eval_order_dependence.rs:8:15 + --> $DIR/eval_order_dependence.rs:8:15 | 8 | let a = { x = 1; 1 } + x; | ^^^^^ error: unsequenced read of a variable - --> eval_order_dependence.rs:11:5 + --> $DIR/eval_order_dependence.rs:11:5 | 11 | x += { x = 20; 2 }; | ^ | note: whether read occurs before this write depends on evaluation order - --> eval_order_dependence.rs:11:12 + --> $DIR/eval_order_dependence.rs:11:12 | 11 | x += { x = 20; 2 }; | ^^^^^^ error: unsequenced read of a variable - --> eval_order_dependence.rs:17:24 + --> $DIR/eval_order_dependence.rs:17:24 | 17 | let foo = Foo { a: x, .. { x = 6; base } }; | ^ | note: whether read occurs before this write depends on evaluation order - --> eval_order_dependence.rs:17:32 + --> $DIR/eval_order_dependence.rs:17:32 | 17 | let foo = Foo { a: x, .. { x = 6; base } }; | ^^^^^ error: unsequenced read of a variable - --> eval_order_dependence.rs:21:9 + --> $DIR/eval_order_dependence.rs:21:9 | 21 | x += { x = 20; 2 }; | ^ | note: whether read occurs before this write depends on evaluation order - --> eval_order_dependence.rs:21:16 + --> $DIR/eval_order_dependence.rs:21:16 | 21 | x += { x = 20; 2 }; | ^^^^^^ error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/filter_methods.rs b/tests/ui/filter_methods.rs similarity index 100% rename from clippy_tests/examples/filter_methods.rs rename to tests/ui/filter_methods.rs diff --git a/clippy_tests/examples/filter_methods.stderr b/tests/ui/filter_methods.stderr similarity index 91% rename from clippy_tests/examples/filter_methods.stderr rename to tests/ui/filter_methods.stderr index e46270b1c4f7..cec03a47bfde 100644 --- a/clippy_tests/examples/filter_methods.stderr +++ b/tests/ui/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. - --> filter_methods.rs:8:21 + --> $DIR/filter_methods.rs:8:21 | 8 | let _: Vec<_> = vec![5; 6].into_iter() | _____________________^ @@ -10,7 +10,7 @@ error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expre = 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. - --> filter_methods.rs:13:21 + --> $DIR/filter_methods.rs:13:21 | 13 | let _: Vec<_> = vec![5_i8; 6].into_iter() | _____________________^ @@ -19,7 +19,7 @@ error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly | |_______________________________________________________________^ 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. - --> filter_methods.rs:18:21 + --> $DIR/filter_methods.rs:18:21 | 18 | let _: Vec<_> = vec![5_i8; 6].into_iter() | _____________________^ @@ -28,7 +28,7 @@ error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinc | |_______________________________________________________________^ error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead. - --> filter_methods.rs:23:21 + --> $DIR/filter_methods.rs:23:21 | 23 | let _: Vec<_> = vec![5_i8; 6].into_iter() | _____________________^ @@ -38,5 +38,3 @@ error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly e error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/float_cmp.rs b/tests/ui/float_cmp.rs similarity index 100% rename from clippy_tests/examples/float_cmp.rs rename to tests/ui/float_cmp.rs diff --git a/clippy_tests/examples/float_cmp.stderr b/tests/ui/float_cmp.stderr similarity index 84% rename from clippy_tests/examples/float_cmp.stderr rename to tests/ui/float_cmp.stderr index 476c94c8a5ef..a764403d0397 100644 --- a/clippy_tests/examples/float_cmp.stderr +++ b/tests/ui/float_cmp.stderr @@ -1,101 +1,99 @@ error: strict comparison of f32 or f64 - --> float_cmp.rs:43:5 + --> $DIR/float_cmp.rs:43:5 | 43 | ONE == 1f32; | ^^^^^^^^^^^ help: consider comparing them within some error: `(ONE - 1f32).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> float_cmp.rs:43:5 + --> $DIR/float_cmp.rs:43:5 | 43 | ONE == 1f32; | ^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> float_cmp.rs:44:5 + --> $DIR/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: std::f32::EPSILON and std::f64::EPSILON are available. - --> float_cmp.rs:44:5 + --> $DIR/float_cmp.rs:44:5 | 44 | ONE == 1.0 + 0.0; | ^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> float_cmp.rs:45:5 + --> $DIR/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: std::f32::EPSILON and std::f64::EPSILON are available. - --> float_cmp.rs:45:5 + --> $DIR/float_cmp.rs:45:5 | 45 | ONE + ONE == ZERO + ONE + ONE; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> float_cmp.rs:46:5 + --> $DIR/float_cmp.rs:46:5 | 46 | ONE != 2.0; | ^^^^^^^^^^ help: consider comparing them within some error: `(ONE - 2.0).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> float_cmp.rs:46:5 + --> $DIR/float_cmp.rs:46:5 | 46 | ONE != 2.0; | ^^^^^^^^^^ error: strict comparison of f32 or f64 - --> float_cmp.rs:48:5 + --> $DIR/float_cmp.rs:48:5 | 48 | twice(ONE) != ONE; | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(ONE) - ONE).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> float_cmp.rs:48:5 + --> $DIR/float_cmp.rs:48:5 | 48 | twice(ONE) != ONE; | ^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> float_cmp.rs:49:5 + --> $DIR/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: std::f32::EPSILON and std::f64::EPSILON are available. - --> float_cmp.rs:49:5 + --> $DIR/float_cmp.rs:49:5 | 49 | ONE as f64 != 2.0; | ^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> float_cmp.rs:54:5 + --> $DIR/float_cmp.rs:54:5 | 54 | x == 1.0; | ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> float_cmp.rs:54:5 + --> $DIR/float_cmp.rs:54:5 | 54 | x == 1.0; | ^^^^^^^^ error: strict comparison of f32 or f64 - --> float_cmp.rs:57:5 + --> $DIR/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: std::f32::EPSILON and std::f64::EPSILON are available. - --> float_cmp.rs:57:5 + --> $DIR/float_cmp.rs:57:5 | 57 | twice(x) != twice(ONE as f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/for_loop.rs b/tests/ui/for_loop.rs similarity index 100% rename from clippy_tests/examples/for_loop.rs rename to tests/ui/for_loop.rs diff --git a/clippy_tests/examples/for_loop.stderr b/tests/ui/for_loop.stderr similarity index 90% rename from clippy_tests/examples/for_loop.stderr rename to tests/ui/for_loop.stderr index 5cf8e611f4da..f350547f6c3b 100644 --- a/clippy_tests/examples/for_loop.stderr +++ b/tests/ui/for_loop.stderr @@ -1,5 +1,5 @@ error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement. - --> for_loop.rs:17:14 + --> $DIR/for_loop.rs:17:14 | 17 | for x in option { | ^^^^^^ @@ -8,7 +8,7 @@ error: for loop over `option`, which is an `Option`. This is more readably writt = 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. - --> for_loop.rs:22:14 + --> $DIR/for_loop.rs:22:14 | 22 | for x in result { | ^^^^^^ @@ -17,7 +17,7 @@ error: for loop over `result`, which is a `Result`. This is more readably writte = 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. - --> for_loop.rs:26:14 + --> $DIR/for_loop.rs:26:14 | 26 | for x in option.ok_or("x not found") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is = 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 - --> for_loop.rs:31:5 + --> $DIR/for_loop.rs:31:5 | 31 | / for x in v.iter().next() { 32 | | println!("{}", x); @@ -35,7 +35,7 @@ error: you are iterating over `Iterator::next()` which is an Option; this will c = 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. - --> for_loop.rs:36:14 + --> $DIR/for_loop.rs:36:14 | 36 | for x in v.iter().next().and(Some(0)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This = 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. - --> for_loop.rs:40:14 + --> $DIR/for_loop.rs:40:14 | 40 | for x in v.iter().next().ok_or("x not found") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -51,7 +51,7 @@ error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result` = 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: this loop never actually loops - --> for_loop.rs:52:5 + --> $DIR/for_loop.rs:52:5 | 52 | / while let Some(x) = option { 53 | | println!("{}", x); @@ -62,7 +62,7 @@ error: this loop never actually loops = note: `-D never-loop` implied by `-D warnings` error: this loop never actually loops - --> for_loop.rs:58:5 + --> $DIR/for_loop.rs:58:5 | 58 | / while let Ok(x) = result { 59 | | println!("{}", x); @@ -71,7 +71,7 @@ error: this loop never actually loops | |_____^ error: the loop variable `i` is only used to index `vec`. - --> for_loop.rs:84:5 + --> $DIR/for_loop.rs:84:5 | 84 | / for i in 0..vec.len() { 85 | | println!("{}", vec[i]); @@ -85,7 +85,7 @@ help: consider using an iterator | ^^^^^^ error: unused variable: `i` - --> for_loop.rs:88:9 + --> $DIR/for_loop.rs:88:9 | 88 | for i in 0..vec.len() { | ^ @@ -93,7 +93,7 @@ error: unused variable: `i` = note: `-D unused-variables` implied by `-D warnings` error: the loop variable `i` is only used to index `vec`. - --> for_loop.rs:93:5 + --> $DIR/for_loop.rs:93:5 | 93 | for i in 0..vec.len() { let _ = vec[i]; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -104,7 +104,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `j` is only used to index `STATIC`. - --> for_loop.rs:96:5 + --> $DIR/for_loop.rs:96:5 | 96 | / for j in 0..4 { 97 | | println!("{:?}", STATIC[j]); @@ -117,7 +117,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `j` is only used to index `CONST`. - --> for_loop.rs:100:5 + --> $DIR/for_loop.rs:100:5 | 100 | / for j in 0..4 { 101 | | println!("{:?}", CONST[j]); @@ -130,7 +130,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `i` is used to index `vec` - --> for_loop.rs:104:5 + --> $DIR/for_loop.rs:104:5 | 104 | / for i in 0..vec.len() { 105 | | println!("{} {}", vec[i], i); @@ -143,7 +143,7 @@ help: consider using an iterator | ^^^^^^^^^^^ error: the loop variable `i` is only used to index `vec2`. - --> for_loop.rs:111:5 + --> $DIR/for_loop.rs:111:5 | 111 | / for i in 0..vec.len() { 112 | | println!("{}", vec2[i]); @@ -156,7 +156,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> for_loop.rs:115:5 + --> $DIR/for_loop.rs:115:5 | 115 | / for i in 5..vec.len() { 116 | | println!("{}", vec[i]); @@ -169,7 +169,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> for_loop.rs:119:5 + --> $DIR/for_loop.rs:119:5 | 119 | / for i in 0..MAX_LEN { 120 | | println!("{}", vec[i]); @@ -182,7 +182,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> for_loop.rs:123:5 + --> $DIR/for_loop.rs:123:5 | 123 | / for i in 0...MAX_LEN { 124 | | println!("{}", vec[i]); @@ -195,7 +195,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> for_loop.rs:127:5 + --> $DIR/for_loop.rs:127:5 | 127 | / for i in 5..10 { 128 | | println!("{}", vec[i]); @@ -208,7 +208,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> for_loop.rs:131:5 + --> $DIR/for_loop.rs:131:5 | 131 | / for i in 5...10 { 132 | | println!("{}", vec[i]); @@ -221,7 +221,7 @@ help: consider using an iterator | ^^^^^^ error: the loop variable `i` is used to index `vec` - --> for_loop.rs:135:5 + --> $DIR/for_loop.rs:135:5 | 135 | / for i in 5..vec.len() { 136 | | println!("{} {}", vec[i], i); @@ -234,7 +234,7 @@ help: consider using an iterator | ^^^^^^^^^^^ error: the loop variable `i` is used to index `vec` - --> for_loop.rs:139:5 + --> $DIR/for_loop.rs:139:5 | 139 | / for i in 5..10 { 140 | | println!("{} {}", vec[i], i); @@ -247,7 +247,7 @@ help: consider using an iterator | ^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> for_loop.rs:143:5 + --> $DIR/for_loop.rs:143:5 | 143 | / for i in 10..0 { 144 | | println!("{}", i); @@ -261,7 +261,7 @@ help: consider using the following if you are attempting to iterate over this ra | ^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> for_loop.rs:147:5 + --> $DIR/for_loop.rs:147:5 | 147 | / for i in 10...0 { 148 | | println!("{}", i); @@ -274,7 +274,7 @@ help: consider using the following if you are attempting to iterate over this ra | ^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> for_loop.rs:151:5 + --> $DIR/for_loop.rs:151:5 | 151 | / for i in MAX_LEN..0 { 152 | | println!("{}", i); @@ -287,7 +287,7 @@ help: consider using the following if you are attempting to iterate over this ra | ^^^^^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> for_loop.rs:155:5 + --> $DIR/for_loop.rs:155:5 | 155 | / for i in 5..5 { 156 | | println!("{}", i); @@ -295,7 +295,7 @@ error: this range is empty so this for loop will never run | |_____^ error: this range is empty so this for loop will never run - --> for_loop.rs:176:5 + --> $DIR/for_loop.rs:176:5 | 176 | / for i in 10..5+4 { 177 | | println!("{}", i); @@ -308,7 +308,7 @@ help: consider using the following if you are attempting to iterate over this ra | ^^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> for_loop.rs:180:5 + --> $DIR/for_loop.rs:180:5 | 180 | / for i in (5+2)..(3-1) { 181 | | println!("{}", i); @@ -321,7 +321,7 @@ help: consider using the following if you are attempting to iterate over this ra | ^^^^^^^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> for_loop.rs:184:5 + --> $DIR/for_loop.rs:184:5 | 184 | / for i in (5+2)..(8-1) { 185 | | println!("{}", i); @@ -329,7 +329,7 @@ error: this range is empty so this for loop will never run | |_____^ error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:203:15 + --> $DIR/for_loop.rs:203:15 | 203 | for _v in vec.iter() { } | ^^^^^^^^^^ help: to write this more concisely, try: `&vec` @@ -337,13 +337,13 @@ error: it is more idiomatic to loop over references to containers instead of usi = 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 - --> for_loop.rs:205:15 + --> $DIR/for_loop.rs:205:15 | 205 | for _v in vec.iter_mut() { } | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec` error: it is more idiomatic to loop over containers instead of using explicit iteration methods` - --> for_loop.rs:208:15 + --> $DIR/for_loop.rs:208:15 | 208 | for _v in out_vec.into_iter() { } | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec` @@ -351,73 +351,73 @@ error: it is more idiomatic to loop over containers instead of using explicit it = 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 - --> for_loop.rs:211:15 + --> $DIR/for_loop.rs:211:15 | 211 | for _v in array.into_iter() {} | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:216:15 + --> $DIR/for_loop.rs:216:15 | 216 | for _v in [1, 2, 3].iter() { } | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:220:15 + --> $DIR/for_loop.rs:220:15 | 220 | for _v in [0; 32].iter() {} | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:225:15 + --> $DIR/for_loop.rs:225:15 | 225 | for _v in ll.iter() { } | ^^^^^^^^^ help: to write this more concisely, try: `&ll` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:228:15 + --> $DIR/for_loop.rs:228:15 | 228 | for _v in vd.iter() { } | ^^^^^^^^^ help: to write this more concisely, try: `&vd` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:231:15 + --> $DIR/for_loop.rs:231:15 | 231 | for _v in bh.iter() { } | ^^^^^^^^^ help: to write this more concisely, try: `&bh` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:234:15 + --> $DIR/for_loop.rs:234:15 | 234 | for _v in hm.iter() { } | ^^^^^^^^^ help: to write this more concisely, try: `&hm` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:237:15 + --> $DIR/for_loop.rs:237:15 | 237 | for _v in bt.iter() { } | ^^^^^^^^^ help: to write this more concisely, try: `&bt` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:240:15 + --> $DIR/for_loop.rs:240:15 | 240 | for _v in hs.iter() { } | ^^^^^^^^^ help: to write this more concisely, try: `&hs` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> for_loop.rs:243:15 + --> $DIR/for_loop.rs:243:15 | 243 | for _v in bs.iter() { } | ^^^^^^^^^ help: to write this more concisely, try: `&bs` error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want - --> for_loop.rs:245:5 + --> $DIR/for_loop.rs:245:5 | 245 | for _v in vec.iter().next() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator - --> for_loop.rs:252:5 + --> $DIR/for_loop.rs:252:5 | 252 | vec.iter().cloned().map(|x| out.push(x)).collect::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -425,7 +425,7 @@ error: you are collect()ing an iterator and throwing away the result. Consider u = 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 - --> for_loop.rs:257:5 + --> $DIR/for_loop.rs:257:5 | 257 | for _v in &vec { _index += 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -433,13 +433,13 @@ error: the variable `_index` is used as a loop counter. Consider using `for (_in = 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 - --> for_loop.rs:261:5 + --> $DIR/for_loop.rs:261:5 | 261 | for _v in &vec { _index += 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you seem to want to iterate on a map's values - --> for_loop.rs:321:5 + --> $DIR/for_loop.rs:321:5 | 321 | / for (_, v) in &m { 322 | | let _v = v; @@ -453,7 +453,7 @@ help: use the corresponding method | ^ error: you seem to want to iterate on a map's values - --> for_loop.rs:326:5 + --> $DIR/for_loop.rs:326:5 | 326 | / for (_, v) in &*m { 327 | | let _v = v; @@ -468,7 +468,7 @@ help: use the corresponding method | ^ error: you seem to want to iterate on a map's values - --> for_loop.rs:333:5 + --> $DIR/for_loop.rs:333:5 | 333 | / for (_, v) in &mut m { 334 | | let _v = v; @@ -481,7 +481,7 @@ help: use the corresponding method | ^ error: you seem to want to iterate on a map's values - --> for_loop.rs:338:5 + --> $DIR/for_loop.rs:338:5 | 338 | / for (_, v) in &mut *m { 339 | | let _v = v; @@ -494,7 +494,7 @@ help: use the corresponding method | ^ error: you seem to want to iterate on a map's keys - --> for_loop.rs:344:5 + --> $DIR/for_loop.rs:344:5 | 344 | / for (k, _value) in rm { 345 | | let _k = k; @@ -508,5 +508,3 @@ help: use the corresponding method error: aborting due to 51 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/format.rs b/tests/ui/format.rs similarity index 100% rename from clippy_tests/examples/format.rs rename to tests/ui/format.rs diff --git a/clippy_tests/examples/format.stderr b/tests/ui/format.stderr similarity index 77% rename from clippy_tests/examples/format.stderr rename to tests/ui/format.stderr index 30c3cb7676ea..d2c9f3938312 100644 --- a/clippy_tests/examples/format.stderr +++ b/tests/ui/format.stderr @@ -1,5 +1,5 @@ error: useless use of `format!` - --> format.rs:6:5 + --> $DIR/format.rs:6:5 | 6 | format!("foo"); | ^^^^^^^^^^^^^^^ @@ -7,18 +7,16 @@ error: useless use of `format!` = note: `-D useless-format` implied by `-D warnings` error: useless use of `format!` - --> format.rs:8:5 + --> $DIR/format.rs:8:5 | 8 | format!("{}", "foo"); | ^^^^^^^^^^^^^^^^^^^^^ error: useless use of `format!` - --> format.rs:15:5 + --> $DIR/format.rs:15:5 | 15 | format!("{}", arg); | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/formatting.rs b/tests/ui/formatting.rs similarity index 100% rename from clippy_tests/examples/formatting.rs rename to tests/ui/formatting.rs diff --git a/clippy_tests/examples/formatting.stderr b/tests/ui/formatting.stderr similarity index 88% rename from clippy_tests/examples/formatting.stderr rename to tests/ui/formatting.stderr index 68160bd8f0a5..266de262ea0a 100644 --- a/clippy_tests/examples/formatting.stderr +++ b/tests/ui/formatting.stderr @@ -1,5 +1,5 @@ error: this looks like an `else if` but the `else` is missing - --> formatting.rs:15:6 + --> $DIR/formatting.rs:15:6 | 15 | } if foo() { | ^ @@ -8,7 +8,7 @@ error: this looks like an `else if` but the `else` is missing = 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 - --> formatting.rs:22:10 + --> $DIR/formatting.rs:22:10 | 22 | } if foo() { | ^ @@ -16,7 +16,7 @@ error: this looks like an `else if` but the `else` is missing = 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 - --> formatting.rs:30:10 + --> $DIR/formatting.rs:30:10 | 30 | } if foo() { | ^ @@ -24,7 +24,7 @@ error: this looks like an `else if` but the `else` is missing = 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 - --> formatting.rs:39:6 + --> $DIR/formatting.rs:39:6 | 39 | } else | ______^ @@ -34,7 +34,7 @@ error: this is an `else if` but the formatting might hide it = 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 - --> formatting.rs:44:6 + --> $DIR/formatting.rs:44:6 | 44 | } | ______^ @@ -45,7 +45,7 @@ error: this is an `else if` but the formatting might hide it = 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 `.. = (- ..)` - --> formatting.rs:71:6 + --> $DIR/formatting.rs:71:6 | 71 | a =- 35; | ^^^^ @@ -54,7 +54,7 @@ error: this looks like you are trying to use `.. -= ..`, but you really are doin = note: to remove this lint, use either `-=` or `= -` error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)` - --> formatting.rs:72:6 + --> $DIR/formatting.rs:72:6 | 72 | a =* &191; | ^^^^ @@ -62,7 +62,7 @@ error: this looks like you are trying to use `.. *= ..`, but you really are doin = note: to remove this lint, use either `*=` or `= *` error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)` - --> formatting.rs:75:6 + --> $DIR/formatting.rs:75:6 | 75 | b =! false; | ^^^^ @@ -70,7 +70,7 @@ error: this looks like you are trying to use `.. != ..`, but you really are doin = note: to remove this lint, use either `!=` or `= !` error: possibly missing a comma here - --> formatting.rs:84:19 + --> $DIR/formatting.rs:84:19 | 84 | -1, -2, -3 // <= no comma here | ^ @@ -79,7 +79,7 @@ error: possibly missing a comma here = note: to remove this lint, add a comma or write the expr in a single line error: possibly missing a comma here - --> formatting.rs:88:19 + --> $DIR/formatting.rs:88:19 | 88 | -1, -2, -3 // <= no comma here | ^ @@ -88,5 +88,3 @@ error: possibly missing a comma here error: aborting due to 10 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/functions.rs b/tests/ui/functions.rs similarity index 100% rename from clippy_tests/examples/functions.rs rename to tests/ui/functions.rs diff --git a/clippy_tests/examples/functions.stderr b/tests/ui/functions.stderr similarity index 87% rename from clippy_tests/examples/functions.stderr rename to tests/ui/functions.stderr index aca983e3b389..0a97748954f3 100644 --- a/clippy_tests/examples/functions.stderr +++ b/tests/ui/functions.stderr @@ -1,5 +1,5 @@ error: this function has too many arguments (8/7) - --> functions.rs:11:1 + --> $DIR/functions.rs:11:1 | 11 | / fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) { 12 | | } @@ -8,19 +8,19 @@ error: this function has too many arguments (8/7) = note: `-D too-many-arguments` implied by `-D warnings` error: this function has too many arguments (8/7) - --> functions.rs:19:5 + --> $DIR/functions.rs:19:5 | 19 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this function has too many arguments (8/7) - --> functions.rs:28:5 + --> $DIR/functions.rs:28:5 | 28 | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:37:34 + --> $DIR/functions.rs:37:34 | 37 | println!("{}", unsafe { *p }); | ^ @@ -28,54 +28,52 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:38:35 + --> $DIR/functions.rs:38:35 | 38 | println!("{:?}", unsafe { p.as_ref() }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:39:33 + --> $DIR/functions.rs:39:33 | 39 | unsafe { std::ptr::read(p) }; | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:50:30 + --> $DIR/functions.rs:50:30 | 50 | println!("{}", unsafe { *p }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:51:31 + --> $DIR/functions.rs:51:31 | 51 | println!("{:?}", unsafe { p.as_ref() }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:52:29 + --> $DIR/functions.rs:52:29 | 52 | unsafe { std::ptr::read(p) }; | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:61:34 + --> $DIR/functions.rs:61:34 | 61 | println!("{}", unsafe { *p }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:62:35 + --> $DIR/functions.rs:62:35 | 62 | println!("{:?}", unsafe { p.as_ref() }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> functions.rs:63:33 + --> $DIR/functions.rs:63:33 | 63 | unsafe { std::ptr::read(p) }; | ^ error: aborting due to 12 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/identity_op.rs b/tests/ui/identity_op.rs similarity index 100% rename from clippy_tests/examples/identity_op.rs rename to tests/ui/identity_op.rs diff --git a/clippy_tests/examples/identity_op.stderr b/tests/ui/identity_op.stderr similarity index 77% rename from clippy_tests/examples/identity_op.stderr rename to tests/ui/identity_op.stderr index a3080f57b3b1..94b9b727a510 100644 --- a/clippy_tests/examples/identity_op.stderr +++ b/tests/ui/identity_op.stderr @@ -1,5 +1,5 @@ error: the operation is ineffective. Consider reducing it to `x` - --> identity_op.rs:13:5 + --> $DIR/identity_op.rs:13:5 | 13 | x + 0; | ^^^^^ @@ -7,42 +7,40 @@ error: the operation is ineffective. Consider reducing it to `x` = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> identity_op.rs:14:5 + --> $DIR/identity_op.rs:14:5 | 14 | x + (1 - 1); | ^^^^^^^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> identity_op.rs:16:5 + --> $DIR/identity_op.rs:16:5 | 16 | 0 + x; | ^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> identity_op.rs:19:5 + --> $DIR/identity_op.rs:19:5 | 19 | x | (0); | ^^^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> identity_op.rs:22:5 + --> $DIR/identity_op.rs:22:5 | 22 | x * 1; | ^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> identity_op.rs:23:5 + --> $DIR/identity_op.rs:23:5 | 23 | 1 * x; | ^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> identity_op.rs:29:5 + --> $DIR/identity_op.rs:29:5 | 29 | -1 & x; | ^^^^^^ error: aborting due to 7 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/if_let_redundant_pattern_matching.rs b/tests/ui/if_let_redundant_pattern_matching.rs similarity index 100% rename from clippy_tests/examples/if_let_redundant_pattern_matching.rs rename to tests/ui/if_let_redundant_pattern_matching.rs diff --git a/clippy_tests/examples/if_let_redundant_pattern_matching.stderr b/tests/ui/if_let_redundant_pattern_matching.stderr similarity index 78% rename from clippy_tests/examples/if_let_redundant_pattern_matching.stderr rename to tests/ui/if_let_redundant_pattern_matching.stderr index aefe624a8d40..e7bfd0275d8e 100644 --- a/clippy_tests/examples/if_let_redundant_pattern_matching.stderr +++ b/tests/ui/if_let_redundant_pattern_matching.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching, consider using `is_ok()` - --> if_let_redundant_pattern_matching.rs:9:12 + --> $DIR/if_let_redundant_pattern_matching.rs:9:12 | 9 | if let Ok(_) = Ok::(42) {} | -------^^^^^--------------------- help: try this: `if Ok::(42).is_ok()` @@ -7,24 +7,22 @@ error: redundant pattern matching, consider using `is_ok()` = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_err()` - --> if_let_redundant_pattern_matching.rs:11:12 + --> $DIR/if_let_redundant_pattern_matching.rs:11:12 | 11 | if let Err(_) = Err::(42) { | -------^^^^^^---------------------- help: try this: `if Err::(42).is_err()` error: redundant pattern matching, consider using `is_none()` - --> if_let_redundant_pattern_matching.rs:14:12 + --> $DIR/if_let_redundant_pattern_matching.rs:14:12 | 14 | if let None = None::<()> { | -------^^^^------------- help: try this: `if None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` - --> if_let_redundant_pattern_matching.rs:17:12 + --> $DIR/if_let_redundant_pattern_matching.rs:17:12 | 17 | if let Some(_) = Some(42) { | -------^^^^^^^----------- help: try this: `if Some(42).is_some()` error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/if_not_else.rs b/tests/ui/if_not_else.rs similarity index 100% rename from clippy_tests/examples/if_not_else.rs rename to tests/ui/if_not_else.rs diff --git a/clippy_tests/examples/if_not_else.stderr b/tests/ui/if_not_else.stderr similarity index 84% rename from clippy_tests/examples/if_not_else.stderr rename to tests/ui/if_not_else.stderr index f7d30ab7e203..b920ef3b6250 100644 --- a/clippy_tests/examples/if_not_else.stderr +++ b/tests/ui/if_not_else.stderr @@ -1,5 +1,5 @@ error: Unnecessary boolean `not` operation - --> if_not_else.rs:9:5 + --> $DIR/if_not_else.rs:9:5 | 9 | / if !bla() { 10 | | println!("Bugs"); @@ -12,7 +12,7 @@ error: Unnecessary boolean `not` operation = help: remove the `!` and swap the blocks of the if/else error: Unnecessary `!=` operation - --> if_not_else.rs:14:5 + --> $DIR/if_not_else.rs:14:5 | 14 | / if 4 != 5 { 15 | | println!("Bugs"); @@ -25,5 +25,3 @@ error: Unnecessary `!=` operation error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/inconsistent_digit_grouping.rs b/tests/ui/inconsistent_digit_grouping.rs similarity index 100% rename from clippy_tests/examples/inconsistent_digit_grouping.rs rename to tests/ui/inconsistent_digit_grouping.rs diff --git a/clippy_tests/examples/inconsistent_digit_grouping.stderr b/tests/ui/inconsistent_digit_grouping.stderr similarity index 82% rename from clippy_tests/examples/inconsistent_digit_grouping.stderr rename to tests/ui/inconsistent_digit_grouping.stderr index ba2bc305d8d3..12d9e3cf0fd7 100644 --- a/clippy_tests/examples/inconsistent_digit_grouping.stderr +++ b/tests/ui/inconsistent_digit_grouping.stderr @@ -1,5 +1,5 @@ error: digits grouped inconsistently by underscores - --> inconsistent_digit_grouping.rs:7:16 + --> $DIR/inconsistent_digit_grouping.rs:7:16 | 7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); | ^^^^^^^^ @@ -8,7 +8,7 @@ error: digits grouped inconsistently by underscores = help: consider: 123_456 error: digits grouped inconsistently by underscores - --> inconsistent_digit_grouping.rs:7:26 + --> $DIR/inconsistent_digit_grouping.rs:7:26 | 7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); | ^^^^^^^^^^ @@ -16,7 +16,7 @@ error: digits grouped inconsistently by underscores = help: consider: 12_345_678 error: digits grouped inconsistently by underscores - --> inconsistent_digit_grouping.rs:7:38 + --> $DIR/inconsistent_digit_grouping.rs:7:38 | 7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); | ^^^^^^^^ @@ -24,7 +24,7 @@ error: digits grouped inconsistently by underscores = help: consider: 1_234_567 error: digits grouped inconsistently by underscores - --> inconsistent_digit_grouping.rs:7:48 + --> $DIR/inconsistent_digit_grouping.rs:7:48 | 7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); | ^^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ error: digits grouped inconsistently by underscores = help: consider: 1_234.567_8_f32 error: digits grouped inconsistently by underscores - --> inconsistent_digit_grouping.rs:7:64 + --> $DIR/inconsistent_digit_grouping.rs:7:64 | 7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); | ^^^^^^^^^^^^^^ @@ -41,5 +41,3 @@ error: digits grouped inconsistently by underscores error: aborting due to 5 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/invalid_upcast_comparisons.rs b/tests/ui/invalid_upcast_comparisons.rs similarity index 100% rename from clippy_tests/examples/invalid_upcast_comparisons.rs rename to tests/ui/invalid_upcast_comparisons.rs diff --git a/clippy_tests/examples/invalid_upcast_comparisons.stderr b/tests/ui/invalid_upcast_comparisons.stderr similarity index 77% rename from clippy_tests/examples/invalid_upcast_comparisons.stderr rename to tests/ui/invalid_upcast_comparisons.stderr index 8e51609f5722..eb46802899e7 100644 --- a/clippy_tests/examples/invalid_upcast_comparisons.stderr +++ b/tests/ui/invalid_upcast_comparisons.stderr @@ -1,5 +1,5 @@ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:16:5 + --> $DIR/invalid_upcast_comparisons.rs:16:5 | 16 | (u8 as u32) > 300; | ^^^^^^^^^^^^^^^^^ @@ -7,162 +7,160 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = 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 - --> invalid_upcast_comparisons.rs:17:5 + --> $DIR/invalid_upcast_comparisons.rs:17:5 | 17 | (u8 as i32) > 300; | ^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:18:5 + --> $DIR/invalid_upcast_comparisons.rs:18:5 | 18 | (u8 as u32) == 300; | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:19:5 + --> $DIR/invalid_upcast_comparisons.rs:19:5 | 19 | (u8 as i32) == 300; | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:20:5 + --> $DIR/invalid_upcast_comparisons.rs:20:5 | 20 | 300 < (u8 as u32); | ^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:21:5 + --> $DIR/invalid_upcast_comparisons.rs:21:5 | 21 | 300 < (u8 as i32); | ^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:22:5 + --> $DIR/invalid_upcast_comparisons.rs:22:5 | 22 | 300 == (u8 as u32); | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:23:5 + --> $DIR/invalid_upcast_comparisons.rs:23:5 | 23 | 300 == (u8 as i32); | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:25:5 + --> $DIR/invalid_upcast_comparisons.rs:25:5 | 25 | (u8 as u32) <= 300; | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:26:5 + --> $DIR/invalid_upcast_comparisons.rs:26:5 | 26 | (u8 as i32) <= 300; | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:27:5 + --> $DIR/invalid_upcast_comparisons.rs:27:5 | 27 | (u8 as u32) != 300; | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:28:5 + --> $DIR/invalid_upcast_comparisons.rs:28:5 | 28 | (u8 as i32) != 300; | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:29:5 + --> $DIR/invalid_upcast_comparisons.rs:29:5 | 29 | 300 >= (u8 as u32); | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:30:5 + --> $DIR/invalid_upcast_comparisons.rs:30:5 | 30 | 300 >= (u8 as i32); | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:31:5 + --> $DIR/invalid_upcast_comparisons.rs:31:5 | 31 | 300 != (u8 as u32); | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:32:5 + --> $DIR/invalid_upcast_comparisons.rs:32:5 | 32 | 300 != (u8 as i32); | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:35:5 + --> $DIR/invalid_upcast_comparisons.rs:35:5 | 35 | (u8 as i32) < 0; | ^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:36:5 + --> $DIR/invalid_upcast_comparisons.rs:36:5 | 36 | -5 != (u8 as i32); | ^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:38:5 + --> $DIR/invalid_upcast_comparisons.rs:38:5 | 38 | (u8 as i32) >= 0; | ^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:39:5 + --> $DIR/invalid_upcast_comparisons.rs:39:5 | 39 | -5 == (u8 as i32); | ^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:42:5 + --> $DIR/invalid_upcast_comparisons.rs:42:5 | 42 | 1337 == (u8 as i32); | ^^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:43:5 + --> $DIR/invalid_upcast_comparisons.rs:43:5 | 43 | 1337 == (u8 as u32); | ^^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:45:5 + --> $DIR/invalid_upcast_comparisons.rs:45:5 | 45 | 1337 != (u8 as i32); | ^^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:46:5 + --> $DIR/invalid_upcast_comparisons.rs:46:5 | 46 | 1337 != (u8 as u32); | ^^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> invalid_upcast_comparisons.rs:61:5 + --> $DIR/invalid_upcast_comparisons.rs:61:5 | 61 | (u8 as i32) > -1; | ^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:62:5 + --> $DIR/invalid_upcast_comparisons.rs:62:5 | 62 | (u8 as i32) < -1; | ^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> invalid_upcast_comparisons.rs:78:5 + --> $DIR/invalid_upcast_comparisons.rs:78:5 | 78 | -5 >= (u8 as i32); | ^^^^^^^^^^^^^^^^^ error: aborting due to 27 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/item_after_statement.rs b/tests/ui/item_after_statement.rs similarity index 100% rename from clippy_tests/examples/item_after_statement.rs rename to tests/ui/item_after_statement.rs diff --git a/clippy_tests/examples/item_after_statement.stderr b/tests/ui/item_after_statement.stderr similarity index 79% rename from clippy_tests/examples/item_after_statement.stderr rename to tests/ui/item_after_statement.stderr index c01a1099d1e7..ec1296caf83e 100644 --- a/clippy_tests/examples/item_after_statement.stderr +++ b/tests/ui/item_after_statement.stderr @@ -1,5 +1,5 @@ error: adding items after statements is confusing, since items exist from the start of the scope - --> item_after_statement.rs:12:5 + --> $DIR/item_after_statement.rs:12:5 | 12 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,12 +7,10 @@ error: adding items after statements is confusing, since items exist from the st = 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 - --> item_after_statement.rs:17:5 + --> $DIR/item_after_statement.rs:17:5 | 17 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/large_digit_groups.rs b/tests/ui/large_digit_groups.rs similarity index 100% rename from clippy_tests/examples/large_digit_groups.rs rename to tests/ui/large_digit_groups.rs diff --git a/clippy_tests/examples/large_digit_groups.stderr b/tests/ui/large_digit_groups.stderr similarity index 88% rename from clippy_tests/examples/large_digit_groups.stderr rename to tests/ui/large_digit_groups.stderr index 408bff8b3cd6..6fc285274a0b 100644 --- a/clippy_tests/examples/large_digit_groups.stderr +++ b/tests/ui/large_digit_groups.stderr @@ -1,5 +1,5 @@ error: digit groups should be smaller - --> large_digit_groups.rs:7:16 + --> $DIR/large_digit_groups.rs:7:16 | 7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); | ^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: digit groups should be smaller = help: consider: 0b11_0110_i64 error: digit groups should be smaller - --> large_digit_groups.rs:7:31 + --> $DIR/large_digit_groups.rs:7:31 | 7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); | ^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ error: digit groups should be smaller = help: consider: 0x123_4567_8901_usize error: digit groups should be smaller - --> large_digit_groups.rs:7:54 + --> $DIR/large_digit_groups.rs:7:54 | 7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); | ^^^^^^^^^^^ @@ -24,7 +24,7 @@ error: digit groups should be smaller = help: consider: 123_456_f32 error: digit groups should be smaller - --> large_digit_groups.rs:7:67 + --> $DIR/large_digit_groups.rs:7:67 | 7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); | ^^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ error: digit groups should be smaller = help: consider: 123_456.12_f32 error: digit groups should be smaller - --> large_digit_groups.rs:7:83 + --> $DIR/large_digit_groups.rs:7:83 | 7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); | ^^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ error: digit groups should be smaller = help: consider: 123_456.123_45_f32 error: digit groups should be smaller - --> large_digit_groups.rs:7:102 + --> $DIR/large_digit_groups.rs:7:102 | 7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); | ^^^^^^^^^^^^^^^^^^^ @@ -49,5 +49,3 @@ error: digit groups should be smaller error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/large_enum_variant.rs b/tests/ui/large_enum_variant.rs similarity index 100% rename from clippy_tests/examples/large_enum_variant.rs rename to tests/ui/large_enum_variant.rs diff --git a/clippy_tests/examples/large_enum_variant.stderr b/tests/ui/large_enum_variant.stderr similarity index 84% rename from clippy_tests/examples/large_enum_variant.stderr rename to tests/ui/large_enum_variant.stderr index dc857b4430e6..bb889087095b 100644 --- a/clippy_tests/examples/large_enum_variant.stderr +++ b/tests/ui/large_enum_variant.stderr @@ -1,5 +1,5 @@ error: large size difference between variants - --> large_enum_variant.rs:10:5 + --> $DIR/large_enum_variant.rs:10:5 | 10 | B([i32; 8000]), | ^^^^^^^^^^^^^^ @@ -11,19 +11,19 @@ help: consider boxing the large fields to reduce the total size of the enum | ^^^^^^^^^^^^^^^^ error: large size difference between variants - --> large_enum_variant.rs:21:5 + --> $DIR/large_enum_variant.rs:21:5 | 21 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum - --> large_enum_variant.rs:21:5 + --> $DIR/large_enum_variant.rs:21:5 | 21 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> large_enum_variant.rs:34:5 + --> $DIR/large_enum_variant.rs:34:5 | 34 | ContainingLargeEnum(LargeEnum), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -34,31 +34,31 @@ help: consider boxing the large fields to reduce the total size of the enum | ^^^^^^^^^^^^^^ error: large size difference between variants - --> large_enum_variant.rs:37:5 + --> $DIR/large_enum_variant.rs:37:5 | 37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum - --> large_enum_variant.rs:37:5 + --> $DIR/large_enum_variant.rs:37:5 | 37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> large_enum_variant.rs:44:5 + --> $DIR/large_enum_variant.rs:44:5 | 44 | StructLikeLarge { x: [i32; 8000], y: i32 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum - --> large_enum_variant.rs:44:5 + --> $DIR/large_enum_variant.rs:44:5 | 44 | StructLikeLarge { x: [i32; 8000], y: i32 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> large_enum_variant.rs:49:5 + --> $DIR/large_enum_variant.rs:49:5 | 49 | StructLikeLarge2 { x: [i32; 8000] }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -70,5 +70,3 @@ help: consider boxing the large fields to reduce the total size of the enum error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/len_zero.rs b/tests/ui/len_zero.rs similarity index 100% rename from clippy_tests/examples/len_zero.rs rename to tests/ui/len_zero.rs diff --git a/clippy_tests/examples/len_zero.stderr b/tests/ui/len_zero.stderr similarity index 87% rename from clippy_tests/examples/len_zero.stderr rename to tests/ui/len_zero.stderr index 0ab65d468f86..2c9edfe9b0eb 100644 --- a/clippy_tests/examples/len_zero.stderr +++ b/tests/ui/len_zero.stderr @@ -1,5 +1,5 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` method - --> len_zero.rs:9:1 + --> $DIR/len_zero.rs:9:1 | 9 | / impl PubOne { 10 | | pub fn len(self: &Self) -> isize { @@ -11,7 +11,7 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` m = note: `-D len-without-is-empty` implied by `-D warnings` error: trait `PubTraitsToo` has a `len` method but no `is_empty` method - --> len_zero.rs:55:1 + --> $DIR/len_zero.rs:55:1 | 55 | / pub trait PubTraitsToo { 56 | | fn len(self: &Self) -> isize; @@ -19,7 +19,7 @@ error: trait `PubTraitsToo` has a `len` method but no `is_empty` method | |_^ error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method - --> len_zero.rs:89:1 + --> $DIR/len_zero.rs:89:1 | 89 | / impl HasIsEmpty { 90 | | pub fn len(self: &Self) -> isize { @@ -31,7 +31,7 @@ error: item `HasIsEmpty` has a public `len` method but a private `is_empty` meth | |_^ error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method - --> len_zero.rs:118:1 + --> $DIR/len_zero.rs:118:1 | 118 | / impl HasWrongIsEmpty { 119 | | pub fn len(self: &Self) -> isize { @@ -43,7 +43,7 @@ error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is | |_^ error: length comparison to zero - --> len_zero.rs:130:8 + --> $DIR/len_zero.rs:130:8 | 130 | if x.len() == 0 { | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `x.is_empty()` @@ -51,42 +51,40 @@ error: length comparison to zero = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> len_zero.rs:134:8 + --> $DIR/len_zero.rs:134:8 | 134 | if "".len() == 0 { | ^^^^^^^^^^^^^ help: using `is_empty` is more concise: `"".is_empty()` error: length comparison to zero - --> len_zero.rs:148:8 + --> $DIR/len_zero.rs:148:8 | 148 | if has_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to zero - --> len_zero.rs:151:8 + --> $DIR/len_zero.rs:151:8 | 151 | if has_is_empty.len() != 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to zero - --> len_zero.rs:154:8 + --> $DIR/len_zero.rs:154:8 | 154 | if has_is_empty.len() > 0 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to zero - --> len_zero.rs:160:8 + --> $DIR/len_zero.rs:160:8 | 160 | if with_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `with_is_empty.is_empty()` error: length comparison to zero - --> len_zero.rs:172:8 + --> $DIR/len_zero.rs:172:8 | 172 | if b.len() != 0 { | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()` error: aborting due to 11 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/let_if_seq.rs b/tests/ui/let_if_seq.rs similarity index 100% rename from clippy_tests/examples/let_if_seq.rs rename to tests/ui/let_if_seq.rs diff --git a/clippy_tests/examples/let_if_seq.stderr b/tests/ui/let_if_seq.stderr similarity index 89% rename from clippy_tests/examples/let_if_seq.stderr rename to tests/ui/let_if_seq.stderr index eda6229427ac..b912373f95c6 100644 --- a/clippy_tests/examples/let_if_seq.stderr +++ b/tests/ui/let_if_seq.stderr @@ -1,5 +1,5 @@ error: `if _ { .. } else { .. }` is an expression - --> let_if_seq.rs:57:5 + --> $DIR/let_if_seq.rs:57:5 | 57 | / let mut foo = 0; 58 | | if f() { @@ -11,7 +11,7 @@ error: `if _ { .. } else { .. }` is an expression = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression - --> let_if_seq.rs:62:5 + --> $DIR/let_if_seq.rs:62:5 | 62 | / let mut bar = 0; 63 | | if f() { @@ -25,7 +25,7 @@ error: `if _ { .. } else { .. }` is an expression = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression - --> let_if_seq.rs:71:5 + --> $DIR/let_if_seq.rs:71:5 | 71 | / let quz; 72 | | if f() { @@ -36,7 +36,7 @@ error: `if _ { .. } else { .. }` is an expression | |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };` error: `if _ { .. } else { .. }` is an expression - --> let_if_seq.rs:100:5 + --> $DIR/let_if_seq.rs:100:5 | 100 | / let mut baz = 0; 101 | | if f() { @@ -48,5 +48,3 @@ error: `if _ { .. } else { .. }` is an expression error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/let_return.rs b/tests/ui/let_return.rs similarity index 100% rename from clippy_tests/examples/let_return.rs rename to tests/ui/let_return.rs diff --git a/clippy_tests/examples/let_return.stderr b/tests/ui/let_return.stderr similarity index 78% rename from clippy_tests/examples/let_return.stderr rename to tests/ui/let_return.stderr index 7de107d48671..459b2eafa26f 100644 --- a/clippy_tests/examples/let_return.stderr +++ b/tests/ui/let_return.stderr @@ -1,29 +1,27 @@ error: returning the result of a let binding from a block. Consider returning the expression directly. - --> let_return.rs:10:5 + --> $DIR/let_return.rs:10:5 | 10 | x | ^ | = note: `-D let-and-return` implied by `-D warnings` note: this expression can be directly returned - --> let_return.rs:9:13 + --> $DIR/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. - --> let_return.rs:16:9 + --> $DIR/let_return.rs:16:9 | 16 | x | ^ | note: this expression can be directly returned - --> let_return.rs:15:17 + --> $DIR/let_return.rs:15:17 | 15 | let x = 5; | ^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/let_unit.rs b/tests/ui/let_unit.rs similarity index 100% rename from clippy_tests/examples/let_unit.rs rename to tests/ui/let_unit.rs diff --git a/clippy_tests/examples/let_unit.stderr b/tests/ui/let_unit.stderr similarity index 78% rename from clippy_tests/examples/let_unit.stderr rename to tests/ui/let_unit.stderr index e6a883b87ea0..da579ec80f31 100644 --- a/clippy_tests/examples/let_unit.stderr +++ b/tests/ui/let_unit.stderr @@ -1,5 +1,5 @@ error: this let-binding has unit value. Consider omitting `let _x =` - --> let_unit.rs:14:5 + --> $DIR/let_unit.rs:14:5 | 14 | let _x = println!("x"); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,12 +7,10 @@ error: this let-binding has unit value. Consider omitting `let _x =` = note: `-D let-unit-value` implied by `-D warnings` error: this let-binding has unit value. Consider omitting `let _a =` - --> let_unit.rs:18:9 + --> $DIR/let_unit.rs:18:9 | 18 | let _a = (); | ^^^^^^^^^^^^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/lifetimes.rs b/tests/ui/lifetimes.rs similarity index 100% rename from clippy_tests/examples/lifetimes.rs rename to tests/ui/lifetimes.rs diff --git a/clippy_tests/examples/lifetimes.stderr b/tests/ui/lifetimes.stderr similarity index 89% rename from clippy_tests/examples/lifetimes.stderr rename to tests/ui/lifetimes.stderr index 95b750f3bda0..23b353d13d2e 100644 --- a/clippy_tests/examples/lifetimes.stderr +++ b/tests/ui/lifetimes.stderr @@ -1,5 +1,5 @@ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:7:1 + --> $DIR/lifetimes.rs:7:1 | 7 | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,37 +7,37 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:9:1 + --> $DIR/lifetimes.rs:9:1 | 9 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:17:1 + --> $DIR/lifetimes.rs:17:1 | 17 | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:29:1 + --> $DIR/lifetimes.rs:29:1 | 29 | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:32:1 + --> $DIR/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) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:38:1 + --> $DIR/lifetimes.rs:38:1 | 38 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:52:1 + --> $DIR/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> @@ -45,48 +45,46 @@ error: explicit lifetimes given in parameter types where they could be elided | |__________________^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:61:5 + --> $DIR/lifetimes.rs:61:5 | 61 | fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:65:5 + --> $DIR/lifetimes.rs:65:5 | 65 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:81:1 + --> $DIR/lifetimes.rs:81:1 | 81 | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:101:1 + --> $DIR/lifetimes.rs:101:1 | 101 | fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:105:1 + --> $DIR/lifetimes.rs:105:1 | 105 | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:116:1 + --> $DIR/lifetimes.rs:116:1 | 116 | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> lifetimes.rs:120:1 + --> $DIR/lifetimes.rs:120:1 | 120 | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/lint_pass.rs b/tests/ui/lint_pass.rs similarity index 100% rename from clippy_tests/examples/lint_pass.rs rename to tests/ui/lint_pass.rs diff --git a/clippy_tests/examples/lint_pass.stderr b/tests/ui/lint_pass.stderr similarity index 78% rename from clippy_tests/examples/lint_pass.stderr rename to tests/ui/lint_pass.stderr index bb4be74faecc..2f9a6813b96d 100644 --- a/clippy_tests/examples/lint_pass.stderr +++ b/tests/ui/lint_pass.stderr @@ -1,5 +1,5 @@ error: the lint `MISSING_LINT` is not added to any `LintPass` - --> lint_pass.rs:12:1 + --> $DIR/lint_pass.rs:12:1 | 12 | declare_lint! { MISSING_LINT, Warn, "missing lint" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,5 +8,3 @@ error: the lint `MISSING_LINT` is not added to any `LintPass` error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/literals.rs b/tests/ui/literals.rs similarity index 100% rename from clippy_tests/examples/literals.rs rename to tests/ui/literals.rs diff --git a/clippy_tests/examples/literals.stderr b/tests/ui/literals.stderr similarity index 87% rename from clippy_tests/examples/literals.stderr rename to tests/ui/literals.stderr index 05f623cae951..17210b6b275a 100644 --- a/clippy_tests/examples/literals.stderr +++ b/tests/ui/literals.stderr @@ -1,5 +1,5 @@ error: inconsistent casing in hexadecimal literal - --> literals.rs:14:17 + --> $DIR/literals.rs:14:17 | 14 | let fail1 = 0xabCD; | ^^^^^^ @@ -7,19 +7,19 @@ error: inconsistent casing in hexadecimal literal = note: `-D mixed-case-hex-literals` implied by `-D warnings` error: inconsistent casing in hexadecimal literal - --> literals.rs:15:17 + --> $DIR/literals.rs:15:17 | 15 | let fail2 = 0xabCD_u32; | ^^^^^^^^^^ error: inconsistent casing in hexadecimal literal - --> literals.rs:16:17 + --> $DIR/literals.rs:16:17 | 16 | let fail2 = 0xabCD_isize; | ^^^^^^^^^^^^ error: integer type suffix should be separated by an underscore - --> literals.rs:17:27 + --> $DIR/literals.rs:17:27 | 17 | let fail_multi_zero = 000_123usize; | ^^^^^^^^^^^^ @@ -27,7 +27,7 @@ error: integer type suffix should be separated by an underscore = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: this is a decimal constant - --> literals.rs:17:27 + --> $DIR/literals.rs:17:27 | 17 | let fail_multi_zero = 000_123usize; | ^^^^^^^^^^^^ @@ -43,37 +43,37 @@ help: if you mean to use an octal constant, use `0o` | ^^^^^^^^^^ error: integer type suffix should be separated by an underscore - --> literals.rs:22:17 + --> $DIR/literals.rs:22:17 | 22 | let fail3 = 1234i32; | ^^^^^^^ error: integer type suffix should be separated by an underscore - --> literals.rs:23:17 + --> $DIR/literals.rs:23:17 | 23 | let fail4 = 1234u32; | ^^^^^^^ error: integer type suffix should be separated by an underscore - --> literals.rs:24:17 + --> $DIR/literals.rs:24:17 | 24 | let fail5 = 1234isize; | ^^^^^^^^^ error: integer type suffix should be separated by an underscore - --> literals.rs:25:17 + --> $DIR/literals.rs:25:17 | 25 | let fail6 = 1234usize; | ^^^^^^^^^ error: float type suffix should be separated by an underscore - --> literals.rs:26:17 + --> $DIR/literals.rs:26:17 | 26 | let fail7 = 1.5f32; | ^^^^^^ error: this is a decimal constant - --> literals.rs:30:17 + --> $DIR/literals.rs:30:17 | 30 | let fail8 = 0123; | ^^^^ @@ -89,5 +89,3 @@ help: if you mean to use an octal constant, use `0o` error: aborting due to 11 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/map_clone.rs b/tests/ui/map_clone.rs similarity index 100% rename from clippy_tests/examples/map_clone.rs rename to tests/ui/map_clone.rs diff --git a/clippy_tests/examples/map_clone.stderr b/tests/ui/map_clone.stderr similarity index 89% rename from clippy_tests/examples/map_clone.stderr rename to tests/ui/map_clone.stderr index 2e32f7ade60e..c29f37918517 100644 --- a/clippy_tests/examples/map_clone.stderr +++ b/tests/ui/map_clone.stderr @@ -1,5 +1,5 @@ error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> map_clone.rs:12:5 + --> $DIR/map_clone.rs:12:5 | 12 | x.iter().map(|y| y.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> map_clone.rs:14:5 + --> $DIR/map_clone.rs:14:5 | 14 | x.iter().map(|&y| y); | ^^^^^^^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> map_clone.rs:16:5 + --> $DIR/map_clone.rs:16:5 | 16 | x.iter().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^ @@ -27,7 +27,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> map_clone.rs:18:5 + --> $DIR/map_clone.rs:18:5 | 18 | x.iter().map(|y| { y.clone() }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -36,7 +36,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> map_clone.rs:20:5 + --> $DIR/map_clone.rs:20:5 | 20 | x.iter().map(|&y| { y }); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -45,7 +45,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> map_clone.rs:22:5 + --> $DIR/map_clone.rs:22:5 | 22 | x.iter().map(|y| { *y }); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,7 +54,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> map_clone.rs:24:5 + --> $DIR/map_clone.rs:24:5 | 24 | x.iter().map(Clone::clone); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> map_clone.rs:30:5 + --> $DIR/map_clone.rs:30:5 | 30 | x.as_ref().map(|y| y.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -72,7 +72,7 @@ error: you seem to be using .map() to clone the contents of an Option, consider x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> map_clone.rs:32:5 + --> $DIR/map_clone.rs:32:5 | 32 | x.as_ref().map(|&y| y); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ error: you seem to be using .map() to clone the contents of an Option, consider x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> map_clone.rs:34:5 + --> $DIR/map_clone.rs:34:5 | 34 | x.as_ref().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ error: you seem to be using .map() to clone the contents of an Option, consider x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> map_clone.rs:90:35 + --> $DIR/map_clone.rs:90:35 | 90 | let _: Option = x.as_ref().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -100,5 +100,3 @@ error: you seem to be using .map() to clone the contents of an Option, consider error: aborting due to 11 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/matches.rs b/tests/ui/matches.rs similarity index 100% rename from clippy_tests/examples/matches.rs rename to tests/ui/matches.rs diff --git a/clippy_tests/examples/matches.stderr b/tests/ui/matches.stderr similarity index 89% rename from clippy_tests/examples/matches.stderr rename to tests/ui/matches.stderr index 4a7491b8de62..29a558aef928 100644 --- a/clippy_tests/examples/matches.stderr +++ b/tests/ui/matches.stderr @@ -1,5 +1,5 @@ error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> matches.rs:26:5 + --> $DIR/matches.rs:26:5 | 26 | / match ExprNode::Butterflies { 27 | | ExprNode::ExprAddrOf => Some(&NODE), @@ -10,7 +10,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co = 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` - --> matches.rs:35:5 + --> $DIR/matches.rs:35:5 | 35 | / match x { 36 | | Some(y) => { println!("{:?}", y); } @@ -21,7 +21,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co = 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` - --> matches.rs:41:5 + --> $DIR/matches.rs:41:5 | 41 | / match z { 42 | | (2...3, 7...9) => dummy(), @@ -30,7 +30,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co | |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> matches.rs:63:5 + --> $DIR/matches.rs:63:5 | 63 | / match x { 64 | | Some(y) => dummy(), @@ -39,7 +39,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co | |_____^ help: try this: `if let Some(y) = x { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> matches.rs:68:5 + --> $DIR/matches.rs:68:5 | 68 | / match y { 69 | | Ok(y) => dummy(), @@ -48,7 +48,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co | |_____^ help: try this: `if let Ok(y) = y { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> matches.rs:75:5 + --> $DIR/matches.rs:75:5 | 75 | / match c { 76 | | Cow::Borrowed(..) => dummy(), @@ -57,7 +57,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }` error: you seem to be trying to match on a boolean expression - --> matches.rs:96:5 + --> $DIR/matches.rs:96:5 | 96 | / match test { 97 | | true => 0, @@ -68,7 +68,7 @@ error: you seem to be trying to match on a boolean expression = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> matches.rs:102:5 + --> $DIR/matches.rs:102:5 | 102 | / match option == 1 { 103 | | true => 1, @@ -77,7 +77,7 @@ error: you seem to be trying to match on a boolean expression | |_____^ help: consider using an if/else expression: `if option == 1 { 1 } else { 0 }` error: you seem to be trying to match on a boolean expression - --> matches.rs:107:5 + --> $DIR/matches.rs:107:5 | 107 | / match test { 108 | | true => (), @@ -86,7 +86,7 @@ error: you seem to be trying to match on a boolean expression | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }` error: you seem to be trying to match on a boolean expression - --> matches.rs:112:5 + --> $DIR/matches.rs:112:5 | 112 | / match test { 113 | | false => { println!("Noooo!"); } @@ -95,7 +95,7 @@ error: you seem to be trying to match on a boolean expression | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }` error: you seem to be trying to match on a boolean expression - --> matches.rs:117:5 + --> $DIR/matches.rs:117:5 | 117 | / match test && test { 118 | | false => { println!("Noooo!"); } @@ -104,7 +104,7 @@ error: you seem to be trying to match on a boolean expression | |_____^ help: consider using an if/else expression: `if !(test && test) { println!("Noooo!"); }` error: equal expressions as operands to `&&` - --> matches.rs:117:11 + --> $DIR/matches.rs:117:11 | 117 | match test && test { | ^^^^^^^^^^^^ @@ -112,7 +112,7 @@ error: equal expressions as operands to `&&` = note: `-D eq-op` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> matches.rs:122:5 + --> $DIR/matches.rs:122:5 | 122 | / match test { 123 | | false => { println!("Noooo!"); } @@ -121,7 +121,7 @@ error: you seem to be trying to match on a boolean expression | |_____^ help: consider using an if/else expression: `if test { println!("Yes!"); } else { println!("Noooo!"); }` error: you don't need to add `&` to all patterns - --> matches.rs:138:9 + --> $DIR/matches.rs:138:9 | 138 | / match v { 139 | | &Some(v) => println!("{:?}", v), @@ -136,7 +136,7 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres | ^^^^^^^^^^^^^^^ error: you don't need to add `&` to all patterns - --> matches.rs:148:5 + --> $DIR/matches.rs:148:5 | 148 | / match tup { 149 | | &(v, 1) => println!("{}", v), @@ -150,7 +150,7 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres | ^^^^^^^^^^^^^^^^^ error: you don't need to add `&` to both the expression and the patterns - --> matches.rs:154:5 + --> $DIR/matches.rs:154:5 | 154 | / match &w { 155 | | &Some(v) => println!("{:?}", v), @@ -159,7 +159,7 @@ error: you don't need to add `&` to both the expression and the patterns | |_____^ help: try: `match w { .. }` error: you don't need to add `&` to all patterns - --> matches.rs:165:5 + --> $DIR/matches.rs:165:5 | 165 | / if let &None = a { 166 | | println!("none"); @@ -172,7 +172,7 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres | ^^^^^^^^^^^^^^^^^^^^^ error: you don't need to add `&` to both the expression and the patterns - --> matches.rs:170:5 + --> $DIR/matches.rs:170:5 | 170 | / if let &None = &b { 171 | | println!("none"); @@ -180,68 +180,68 @@ error: you don't need to add `&` to both the expression and the patterns | |_____^ help: try: `if let .. = b { .. }` error: some ranges overlap - --> matches.rs:179:9 + --> $DIR/matches.rs:179:9 | 179 | 0 ... 10 => println!("0 ... 10"), | ^^^^^^^^ | = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> matches.rs:180:9 + --> $DIR/matches.rs:180:9 | 180 | 0 ... 11 => println!("0 ... 11"), | ^^^^^^^^ error: some ranges overlap - --> matches.rs:185:9 + --> $DIR/matches.rs:185:9 | 185 | 0 ... 5 => println!("0 ... 5"), | ^^^^^^^ | note: overlaps with this - --> matches.rs:187:9 + --> $DIR/matches.rs:187:9 | 187 | FOO ... 11 => println!("0 ... 11"), | ^^^^^^^^^^ error: some ranges overlap - --> matches.rs:193:9 + --> $DIR/matches.rs:193:9 | 193 | 0 ... 5 => println!("0 ... 5"), | ^^^^^^^ | note: overlaps with this - --> matches.rs:192:9 + --> $DIR/matches.rs:192:9 | 192 | 2 => println!("2"), | ^ error: some ranges overlap - --> matches.rs:199:9 + --> $DIR/matches.rs:199:9 | 199 | 0 ... 2 => println!("0 ... 2"), | ^^^^^^^ | note: overlaps with this - --> matches.rs:198:9 + --> $DIR/matches.rs:198:9 | 198 | 2 => println!("2"), | ^ error: some ranges overlap - --> matches.rs:222:9 + --> $DIR/matches.rs:222:9 | 222 | 0 .. 11 => println!("0 .. 11"), | ^^^^^^^ | note: overlaps with this - --> matches.rs:223:9 + --> $DIR/matches.rs:223:9 | 223 | 0 ... 11 => println!("0 ... 11"), | ^^^^^^^^ error: Err(_) will match all errors, maybe not a good idea - --> matches.rs:240:9 + --> $DIR/matches.rs:240:9 | 240 | Err(_) => panic!("err") | ^^^^^^ @@ -250,7 +250,7 @@ error: Err(_) will match all errors, maybe not a good idea = note: to remove this warning, match each error seperately or use unreachable macro error: Err(_) will match all errors, maybe not a good idea - --> matches.rs:246:9 + --> $DIR/matches.rs:246:9 | 246 | Err(_) => {panic!()} | ^^^^^^ @@ -258,7 +258,7 @@ error: Err(_) will match all errors, maybe not a good idea = note: to remove this warning, match each error seperately or use unreachable macro error: Err(_) will match all errors, maybe not a good idea - --> matches.rs:252:9 + --> $DIR/matches.rs:252:9 | 252 | Err(_) => {panic!();} | ^^^^^^ @@ -267,5 +267,3 @@ error: Err(_) will match all errors, maybe not a good idea error: aborting due to 26 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/mem_forget.rs b/tests/ui/mem_forget.rs similarity index 100% rename from clippy_tests/examples/mem_forget.rs rename to tests/ui/mem_forget.rs diff --git a/clippy_tests/examples/mem_forget.stderr b/tests/ui/mem_forget.stderr similarity index 77% rename from clippy_tests/examples/mem_forget.stderr rename to tests/ui/mem_forget.stderr index a1ae2c0859c5..6e7a44694e14 100644 --- a/clippy_tests/examples/mem_forget.stderr +++ b/tests/ui/mem_forget.stderr @@ -1,5 +1,5 @@ error: usage of mem::forget on Drop type - --> mem_forget.rs:18:5 + --> $DIR/mem_forget.rs:18:5 | 18 | memstuff::forget(six); | ^^^^^^^^^^^^^^^^^^^^^ @@ -7,18 +7,16 @@ error: usage of mem::forget on Drop type = note: `-D mem-forget` implied by `-D warnings` error: usage of mem::forget on Drop type - --> mem_forget.rs:21:5 + --> $DIR/mem_forget.rs:21:5 | 21 | std::mem::forget(seven); | ^^^^^^^^^^^^^^^^^^^^^^^ error: usage of mem::forget on Drop type - --> mem_forget.rs:24:5 + --> $DIR/mem_forget.rs:24:5 | 24 | forgetSomething(eight); | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/methods.rs b/tests/ui/methods.rs similarity index 100% rename from clippy_tests/examples/methods.rs rename to tests/ui/methods.rs diff --git a/clippy_tests/examples/methods.stderr b/tests/ui/methods.stderr similarity index 88% rename from clippy_tests/examples/methods.stderr rename to tests/ui/methods.stderr index dc0a2f3554ec..1f9bc9a84c7e 100644 --- a/clippy_tests/examples/methods.stderr +++ b/tests/ui/methods.stderr @@ -1,5 +1,5 @@ error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name - --> methods.rs:18:5 + --> $DIR/methods.rs:18:5 | 18 | fn add(self, other: T) -> T { self } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,13 +7,13 @@ error: defining a method called `add` on this type; consider implementing the `s = 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 - --> methods.rs:19:5 + --> $DIR/methods.rs:19:5 | 19 | fn drop(&mut self) { } | ^^^^^^^^^^^^^^^^^^^^^^ error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> methods.rs:26:17 + --> $DIR/methods.rs:26:17 | 26 | fn into_u16(&self) -> u16 { 0 } | ^^^^^ @@ -21,19 +21,19 @@ error: methods called `into_*` usually take self by value; consider choosing a l = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> methods.rs:28:21 + --> $DIR/methods.rs:28:21 | 28 | fn to_something(self) -> u32 { 0 } | ^^^^ error: methods called `new` usually take no self; consider choosing a less ambiguous name - --> methods.rs:30:12 + --> $DIR/methods.rs:30:12 | 30 | fn new(self) {} | ^^^^ error: methods called `new` usually return `Self` - --> methods.rs:30:5 + --> $DIR/methods.rs:30:5 | 30 | fn new(self) {} | ^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ error: methods called `new` usually return `Self` = 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 - --> methods.rs:97:13 + --> $DIR/methods.rs:97:13 | 97 | let _ = opt.map(|x| x + 1) | _____________^ @@ -53,7 +53,7 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di = 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 - --> methods.rs:101:13 + --> $DIR/methods.rs:101:13 | 101 | let _ = opt.map(|x| { | _____________^ @@ -63,7 +63,7 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di | |____________________________^ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> methods.rs:105:13 + --> $DIR/methods.rs:105:13 | 105 | let _ = opt.map(|x| x + 1) | _____________^ @@ -73,7 +73,7 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di | |__________________^ 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 - --> methods.rs:114:13 + --> $DIR/methods.rs:114:13 | 114 | let _ = opt.map(|x| x + 1) | _____________^ @@ -85,7 +85,7 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo = 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 - --> methods.rs:118:13 + --> $DIR/methods.rs:118:13 | 118 | let _ = opt.map(|x| { | _____________^ @@ -95,7 +95,7 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo | |____________________________________^ 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 - --> methods.rs:122:13 + --> $DIR/methods.rs:122:13 | 122 | let _ = opt.map(|x| x + 1) | _____________^ @@ -105,7 +105,7 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo | |_________________^ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> methods.rs:194:13 + --> $DIR/methods.rs:194:13 | 194 | let _ = v.iter().filter(|&x| *x < 0).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expre = 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. - --> methods.rs:197:13 + --> $DIR/methods.rs:197:13 | 197 | let _ = v.iter().filter(|&x| { | _____________^ @@ -124,7 +124,7 @@ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expre | |___________________________^ error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> methods.rs:212:13 + --> $DIR/methods.rs:212:13 | 212 | let _ = v.iter().find(|&x| *x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ error: called `is_some()` after searching an `Iterator` with find. This is more = 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()`. - --> methods.rs:215:13 + --> $DIR/methods.rs:215:13 | 215 | let _ = v.iter().find(|&x| { | _____________^ @@ -143,7 +143,7 @@ error: called `is_some()` after searching an `Iterator` with find. This is more | |______________________________^ error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> methods.rs:221:13 + --> $DIR/methods.rs:221:13 | 221 | let _ = v.iter().position(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -151,7 +151,7 @@ error: called `is_some()` after searching an `Iterator` with position. This is m = 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()`. - --> methods.rs:224:13 + --> $DIR/methods.rs:224:13 | 224 | let _ = v.iter().position(|&x| { | _____________^ @@ -161,7 +161,7 @@ error: called `is_some()` after searching an `Iterator` with position. This is m | |______________________________^ error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> methods.rs:230:13 + --> $DIR/methods.rs:230:13 | 230 | let _ = v.iter().rposition(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -169,7 +169,7 @@ error: called `is_some()` after searching an `Iterator` with rposition. This is = 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()`. - --> methods.rs:233:13 + --> $DIR/methods.rs:233:13 | 233 | let _ = v.iter().rposition(|&x| { | _____________^ @@ -179,7 +179,7 @@ error: called `is_some()` after searching an `Iterator` with rposition. This is | |______________________________^ error: use of `unwrap_or` followed by a function call - --> methods.rs:268:5 + --> $DIR/methods.rs:268:5 | 268 | with_constructor.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_constructor.unwrap_or_else(make)` @@ -187,73 +187,73 @@ error: use of `unwrap_or` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `new` - --> methods.rs:271:5 + --> $DIR/methods.rs:271:5 | 271 | with_new.unwrap_or(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()` error: use of `unwrap_or` followed by a function call - --> methods.rs:274:5 + --> $DIR/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))` error: use of `unwrap_or` followed by a function call - --> methods.rs:277:5 + --> $DIR/methods.rs:277:5 | 277 | with_err.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err.unwrap_or_else(|_| make())` error: use of `unwrap_or` followed by a function call - --> methods.rs:280:5 + --> $DIR/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))` error: use of `unwrap_or` followed by a call to `default` - --> methods.rs:283:5 + --> $DIR/methods.rs:283:5 | 283 | with_default_trait.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()` error: use of `unwrap_or` followed by a call to `default` - --> methods.rs:286:5 + --> $DIR/methods.rs:286:5 | 286 | with_default_type.unwrap_or(u64::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()` error: use of `unwrap_or` followed by a function call - --> methods.rs:289:5 + --> $DIR/methods.rs:289:5 | 289 | with_vec.unwrap_or(vec![]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))` error: use of `unwrap_or` followed by a function call - --> methods.rs:294:5 + --> $DIR/methods.rs:294:5 | 294 | without_default.unwrap_or(Foo::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `without_default.unwrap_or_else(Foo::new)` error: use of `or_insert` followed by a function call - --> methods.rs:297:5 + --> $DIR/methods.rs:297:5 | 297 | map.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `map.entry(42).or_insert_with(String::new)` error: use of `or_insert` followed by a function call - --> methods.rs:300:5 + --> $DIR/methods.rs:300:5 | 300 | btree.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `btree.entry(42).or_insert_with(String::new)` error: use of `unwrap_or` followed by a function call - --> methods.rs:303:13 + --> $DIR/methods.rs:303:13 | 303 | let _ = stringy.unwrap_or("".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `stringy.unwrap_or_else(|| "".to_owned())` error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable - --> methods.rs:314:23 + --> $DIR/methods.rs:314:23 | 314 | let bad_vec = some_vec.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -261,43 +261,43 @@ error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more = note: `-D iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> methods.rs:315:26 + --> $DIR/methods.rs:315:26 | 315 | let bad_slice = &some_vec[..].iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> methods.rs:316:31 + --> $DIR/methods.rs:316:31 | 316 | let bad_boxed_slice = boxed_slice.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable - --> methods.rs:317:29 + --> $DIR/methods.rs:317:29 | 317 | let bad_vec_deque = some_vec_deque.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable - --> methods.rs:322:23 + --> $DIR/methods.rs:322:23 | 322 | let bad_vec = some_vec.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable - --> methods.rs:325:26 + --> $DIR/methods.rs:325:26 | 325 | let bad_slice = &some_vec[..].iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable - --> methods.rs:328:29 + --> $DIR/methods.rs:328:29 | 328 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> methods.rs:340:13 + --> $DIR/methods.rs:340:13 | 340 | let _ = some_vec.iter().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -305,25 +305,25 @@ error: called `skip(x).next()` on an iterator. This is more succinctly expressed = 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)` - --> methods.rs:341:13 + --> $DIR/methods.rs:341:13 | 341 | let _ = some_vec.iter().cycle().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> methods.rs:342:13 + --> $DIR/methods.rs:342:13 | 342 | let _ = (1..10).skip(10).next(); | ^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> methods.rs:343:14 + --> $DIR/methods.rs:343:14 | 343 | let _ = &some_vec[..].iter().skip(3).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise - --> methods.rs:369:17 + --> $DIR/methods.rs:369:17 | 369 | let _ = boxed_slice.get(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]` @@ -331,61 +331,61 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise - --> methods.rs:370:17 + --> $DIR/methods.rs:370:17 | 370 | let _ = some_slice.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_slice[0]` error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> methods.rs:371:17 + --> $DIR/methods.rs:371:17 | 371 | let _ = some_vec.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vec[0]` error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise - --> methods.rs:372:17 + --> $DIR/methods.rs:372:17 | 372 | let _ = some_vecdeque.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vecdeque[0]` error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise - --> methods.rs:373:17 + --> $DIR/methods.rs:373:17 | 373 | let _ = some_hashmap.get(&1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_hashmap[&1]` error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise - --> methods.rs:374:17 + --> $DIR/methods.rs:374:17 | 374 | let _ = some_btreemap.get(&1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_btreemap[&1]` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise - --> methods.rs:379:10 + --> $DIR/methods.rs:379:10 | 379 | *boxed_slice.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut boxed_slice[0]` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise - --> methods.rs:380:10 + --> $DIR/methods.rs:380:10 | 380 | *some_slice.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_slice[0]` error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> methods.rs:381:10 + --> $DIR/methods.rs:381:10 | 381 | *some_vec.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vec[0]` error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise - --> methods.rs:382:10 + --> $DIR/methods.rs:382:10 | 382 | *some_vecdeque.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vecdeque[0]` 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 - --> methods.rs:396:13 + --> $DIR/methods.rs:396:13 | 396 | let _ = opt.unwrap(); | ^^^^^^^^^^^^ @@ -393,7 +393,7 @@ error: used unwrap() on an Option value. If you don't want to handle the None ca = 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 - --> methods.rs:399:13 + --> $DIR/methods.rs:399:13 | 399 | let _ = res.unwrap(); | ^^^^^^^^^^^^ @@ -401,7 +401,7 @@ error: used unwrap() on a Result value. If you don't want to handle the Err case = 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` - --> methods.rs:401:5 + --> $DIR/methods.rs:401:5 | 401 | res.ok().expect("disaster!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -409,31 +409,31 @@ error: called `ok().expect()` on a Result value. You can call `expect` directly = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> methods.rs:407:5 + --> $DIR/methods.rs:407:5 | 407 | res3.ok().expect("whoof"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> methods.rs:409:5 + --> $DIR/methods.rs:409:5 | 409 | res4.ok().expect("argh"); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> methods.rs:411:5 + --> $DIR/methods.rs:411:5 | 411 | res5.ok().expect("oops"); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> methods.rs:413:5 + --> $DIR/methods.rs:413:5 | 413 | res6.ok().expect("meh"); | ^^^^^^^^^^^^^^^^^^^^^^^ error: you should use the `starts_with` method - --> methods.rs:425:5 + --> $DIR/methods.rs:425:5 | 425 | "".chars().next() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with(' ')` @@ -441,13 +441,13 @@ error: you should use the `starts_with` method = note: `-D chars-next-cmp` implied by `-D warnings` error: you should use the `starts_with` method - --> methods.rs:426:5 + --> $DIR/methods.rs:426:5 | 426 | Some(' ') != "".chars().next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with(' ')` error: calling `.extend(_.chars())` - --> methods.rs:435:5 + --> $DIR/methods.rs:435:5 | 435 | s.extend(abc.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(abc)` @@ -455,19 +455,19 @@ error: calling `.extend(_.chars())` = note: `-D string-extend-chars` implied by `-D warnings` error: calling `.extend(_.chars())` - --> methods.rs:438:5 + --> $DIR/methods.rs:438:5 | 438 | s.extend("abc".chars()); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str("abc")` error: calling `.extend(_.chars())` - --> methods.rs:441:5 + --> $DIR/methods.rs:441:5 | 441 | s.extend(def.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(&def)` error: using `clone` on a `Copy` type - --> methods.rs:452:5 + --> $DIR/methods.rs:452:5 | 452 | 42.clone(); | ^^^^^^^^^^ help: try removing the `clone` call: `42` @@ -475,25 +475,25 @@ error: using `clone` on a `Copy` type = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> methods.rs:456:5 + --> $DIR/methods.rs:456:5 | 456 | (&42).clone(); | ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)` error: using `clone` on a `Copy` type - --> methods.rs:460:5 + --> $DIR/methods.rs:460:5 | 460 | t.clone(); | ^^^^^^^^^ help: try removing the `clone` call: `t` error: using `clone` on a `Copy` type - --> methods.rs:462:5 + --> $DIR/methods.rs:462:5 | 462 | Some(t).clone(); | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)` error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type - --> methods.rs:468:22 + --> $DIR/methods.rs:468:22 | 468 | let z: &Vec<_> = y.clone(); | ^^^^^^^^^ help: try dereferencing it: `(*y).clone()` @@ -501,7 +501,7 @@ error: using `clone` on a double-reference; this will copy the reference instead = note: `-D clone-double-ref` implied by `-D warnings` error: single-character string constant used as pattern - --> methods.rs:475:13 + --> $DIR/methods.rs:475:13 | 475 | x.split("x"); | --------^^^- help: try using a char instead: `x.split('x')` @@ -509,103 +509,103 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> methods.rs:492:16 + --> $DIR/methods.rs:492:16 | 492 | x.contains("x"); | -----------^^^- help: try using a char instead: `x.contains('x')` error: single-character string constant used as pattern - --> methods.rs:493:19 + --> $DIR/methods.rs:493:19 | 493 | x.starts_with("x"); | --------------^^^- help: try using a char instead: `x.starts_with('x')` error: single-character string constant used as pattern - --> methods.rs:494:17 + --> $DIR/methods.rs:494:17 | 494 | x.ends_with("x"); | ------------^^^- help: try using a char instead: `x.ends_with('x')` error: single-character string constant used as pattern - --> methods.rs:495:12 + --> $DIR/methods.rs:495:12 | 495 | x.find("x"); | -------^^^- help: try using a char instead: `x.find('x')` error: single-character string constant used as pattern - --> methods.rs:496:13 + --> $DIR/methods.rs:496:13 | 496 | x.rfind("x"); | --------^^^- help: try using a char instead: `x.rfind('x')` error: single-character string constant used as pattern - --> methods.rs:497:14 + --> $DIR/methods.rs:497:14 | 497 | x.rsplit("x"); | ---------^^^- help: try using a char instead: `x.rsplit('x')` error: single-character string constant used as pattern - --> methods.rs:498:24 + --> $DIR/methods.rs:498:24 | 498 | x.split_terminator("x"); | -------------------^^^- help: try using a char instead: `x.split_terminator('x')` error: single-character string constant used as pattern - --> methods.rs:499:25 + --> $DIR/methods.rs:499:25 | 499 | x.rsplit_terminator("x"); | --------------------^^^- help: try using a char instead: `x.rsplit_terminator('x')` error: single-character string constant used as pattern - --> methods.rs:500:17 + --> $DIR/methods.rs:500:17 | 500 | x.splitn(0, "x"); | ------------^^^- help: try using a char instead: `x.splitn(0, 'x')` error: single-character string constant used as pattern - --> methods.rs:501:18 + --> $DIR/methods.rs:501:18 | 501 | x.rsplitn(0, "x"); | -------------^^^- help: try using a char instead: `x.rsplitn(0, 'x')` error: single-character string constant used as pattern - --> methods.rs:502:15 + --> $DIR/methods.rs:502:15 | 502 | x.matches("x"); | ----------^^^- help: try using a char instead: `x.matches('x')` error: single-character string constant used as pattern - --> methods.rs:503:16 + --> $DIR/methods.rs:503:16 | 503 | x.rmatches("x"); | -----------^^^- help: try using a char instead: `x.rmatches('x')` error: single-character string constant used as pattern - --> methods.rs:504:21 + --> $DIR/methods.rs:504:21 | 504 | x.match_indices("x"); | ----------------^^^- help: try using a char instead: `x.match_indices('x')` error: single-character string constant used as pattern - --> methods.rs:505:22 + --> $DIR/methods.rs:505:22 | 505 | x.rmatch_indices("x"); | -----------------^^^- help: try using a char instead: `x.rmatch_indices('x')` error: single-character string constant used as pattern - --> methods.rs:506:25 + --> $DIR/methods.rs:506:25 | 506 | x.trim_left_matches("x"); | --------------------^^^- help: try using a char instead: `x.trim_left_matches('x')` error: single-character string constant used as pattern - --> methods.rs:507:26 + --> $DIR/methods.rs:507:26 | 507 | x.trim_right_matches("x"); | ---------------------^^^- help: try using a char instead: `x.trim_right_matches('x')` error: you are getting the inner pointer of a temporary `CString` - --> methods.rs:517:5 + --> $DIR/methods.rs:517:5 | 517 | CString::new("foo").unwrap().as_ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -613,13 +613,13 @@ error: you are getting the inner pointer of a temporary `CString` = 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 - --> methods.rs:517:5 + --> $DIR/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 - --> methods.rs:522:27 + --> $DIR/methods.rs:522:27 | 522 | let v2 : Vec = v.iter().cloned().collect(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -628,5 +628,3 @@ error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec error: aborting due to 89 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/min_max.rs b/tests/ui/min_max.rs similarity index 100% rename from clippy_tests/examples/min_max.rs rename to tests/ui/min_max.rs diff --git a/clippy_tests/examples/min_max.stderr b/tests/ui/min_max.stderr similarity index 82% rename from clippy_tests/examples/min_max.stderr rename to tests/ui/min_max.stderr index caf13c4e8c3e..de4c4e16fa03 100644 --- a/clippy_tests/examples/min_max.stderr +++ b/tests/ui/min_max.stderr @@ -1,5 +1,5 @@ error: this min/max combination leads to constant result - --> min_max.rs:15:5 + --> $DIR/min_max.rs:15:5 | 15 | min(1, max(3, x)); | ^^^^^^^^^^^^^^^^^ @@ -7,42 +7,40 @@ error: this min/max combination leads to constant result = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> min_max.rs:16:5 + --> $DIR/min_max.rs:16:5 | 16 | min(max(3, x), 1); | ^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> min_max.rs:17:5 + --> $DIR/min_max.rs:17:5 | 17 | max(min(x, 1), 3); | ^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> min_max.rs:18:5 + --> $DIR/min_max.rs:18:5 | 18 | max(3, min(x, 1)); | ^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> min_max.rs:20:5 + --> $DIR/min_max.rs:20:5 | 20 | my_max(3, my_min(x, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> min_max.rs:29:5 + --> $DIR/min_max.rs:29:5 | 29 | min("Apple", max("Zoo", s)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> min_max.rs:30:5 + --> $DIR/min_max.rs:30:5 | 30 | max(min(s, "Apple"), "Zoo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/missing-doc.rs b/tests/ui/missing-doc.rs similarity index 100% rename from clippy_tests/examples/missing-doc.rs rename to tests/ui/missing-doc.rs diff --git a/clippy_tests/examples/missing-doc.stderr b/tests/ui/missing-doc.stderr similarity index 78% rename from clippy_tests/examples/missing-doc.stderr rename to tests/ui/missing-doc.stderr index d749fc0782d0..e25edb64181e 100644 --- a/clippy_tests/examples/missing-doc.stderr +++ b/tests/ui/missing-doc.stderr @@ -1,5 +1,5 @@ error: missing documentation for a type alias - --> missing-doc.rs:26:1 + --> $DIR/missing-doc.rs:26:1 | 26 | type Typedef = String; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,13 +7,13 @@ error: missing documentation for a type alias = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a type alias - --> missing-doc.rs:27:1 + --> $DIR/missing-doc.rs:27:1 | 27 | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a struct - --> missing-doc.rs:29:1 + --> $DIR/missing-doc.rs:29:1 | 29 | / struct Foo { 30 | | a: isize, @@ -22,19 +22,19 @@ error: missing documentation for a struct | |_^ error: missing documentation for a struct field - --> missing-doc.rs:30:5 + --> $DIR/missing-doc.rs:30:5 | 30 | a: isize, | ^^^^^^^^ error: missing documentation for a struct field - --> missing-doc.rs:31:5 + --> $DIR/missing-doc.rs:31:5 | 31 | b: isize, | ^^^^^^^^ error: missing documentation for a struct - --> missing-doc.rs:34:1 + --> $DIR/missing-doc.rs:34:1 | 34 | / pub struct PubFoo { 35 | | pub a: isize, @@ -43,43 +43,43 @@ error: missing documentation for a struct | |_^ error: missing documentation for a struct field - --> missing-doc.rs:35:5 + --> $DIR/missing-doc.rs:35:5 | 35 | pub a: isize, | ^^^^^^^^^^^^ error: missing documentation for a struct field - --> missing-doc.rs:36:5 + --> $DIR/missing-doc.rs:36:5 | 36 | b: isize, | ^^^^^^^^ error: missing documentation for a module - --> missing-doc.rs:45:1 + --> $DIR/missing-doc.rs:45:1 | 45 | mod module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> missing-doc.rs:46:1 + --> $DIR/missing-doc.rs:46:1 | 46 | pub mod pub_module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> missing-doc.rs:50:1 + --> $DIR/missing-doc.rs:50:1 | 50 | pub fn foo2() {} | ^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> missing-doc.rs:51:1 + --> $DIR/missing-doc.rs:51:1 | 51 | fn foo3() {} | ^^^^^^^^^^^^ error: missing documentation for a trait - --> missing-doc.rs:68:1 + --> $DIR/missing-doc.rs:68:1 | 68 | / pub trait C { 69 | | fn foo(&self); @@ -88,55 +88,55 @@ error: missing documentation for a trait | |_^ error: missing documentation for a trait method - --> missing-doc.rs:69:5 + --> $DIR/missing-doc.rs:69:5 | 69 | fn foo(&self); | ^^^^^^^^^^^^^^ error: missing documentation for a trait method - --> missing-doc.rs:70:5 + --> $DIR/missing-doc.rs:70:5 | 70 | fn foo_with_impl(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> missing-doc.rs:80:5 + --> $DIR/missing-doc.rs:80:5 | 80 | type AssociatedType; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> missing-doc.rs:81:5 + --> $DIR/missing-doc.rs:81:5 | 81 | type AssociatedTypeDef = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a method - --> missing-doc.rs:92:5 + --> $DIR/missing-doc.rs:92:5 | 92 | pub fn foo() {} | ^^^^^^^^^^^^^^^ error: missing documentation for a method - --> missing-doc.rs:93:5 + --> $DIR/missing-doc.rs:93:5 | 93 | fn bar() {} | ^^^^^^^^^^^ error: missing documentation for a method - --> missing-doc.rs:97:5 + --> $DIR/missing-doc.rs:97:5 | 97 | pub fn foo() {} | ^^^^^^^^^^^^^^^ error: missing documentation for a method - --> missing-doc.rs:100:5 + --> $DIR/missing-doc.rs:100:5 | 100 | fn foo2() {} | ^^^^^^^^^^^^ error: missing documentation for an enum - --> missing-doc.rs:126:1 + --> $DIR/missing-doc.rs:126:1 | 126 | / enum Baz { 127 | | BazA { @@ -148,7 +148,7 @@ error: missing documentation for an enum | |_^ error: missing documentation for a variant - --> missing-doc.rs:127:5 + --> $DIR/missing-doc.rs:127:5 | 127 | / BazA { 128 | | a: isize, @@ -157,25 +157,25 @@ error: missing documentation for a variant | |_____^ error: missing documentation for a struct field - --> missing-doc.rs:128:9 + --> $DIR/missing-doc.rs:128:9 | 128 | a: isize, | ^^^^^^^^ error: missing documentation for a struct field - --> missing-doc.rs:129:9 + --> $DIR/missing-doc.rs:129:9 | 129 | b: isize | ^^^^^^^^ error: missing documentation for a variant - --> missing-doc.rs:131:5 + --> $DIR/missing-doc.rs:131:5 | 131 | BarB | ^^^^ error: missing documentation for an enum - --> missing-doc.rs:134:1 + --> $DIR/missing-doc.rs:134:1 | 134 | / pub enum PubBaz { 135 | | PubBazA { @@ -185,7 +185,7 @@ error: missing documentation for an enum | |_^ error: missing documentation for a variant - --> missing-doc.rs:135:5 + --> $DIR/missing-doc.rs:135:5 | 135 | / PubBazA { 136 | | a: isize, @@ -193,37 +193,37 @@ error: missing documentation for a variant | |_____^ error: missing documentation for a struct field - --> missing-doc.rs:136:9 + --> $DIR/missing-doc.rs:136:9 | 136 | a: isize, | ^^^^^^^^ error: missing documentation for a constant - --> missing-doc.rs:160:1 + --> $DIR/missing-doc.rs:160:1 | 160 | const FOO: u32 = 0; | ^^^^^^^^^^^^^^^^^^^ error: missing documentation for a constant - --> missing-doc.rs:167:1 + --> $DIR/missing-doc.rs:167:1 | 167 | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> missing-doc.rs:170:1 + --> $DIR/missing-doc.rs:170:1 | 170 | static BAR: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> missing-doc.rs:177:1 + --> $DIR/missing-doc.rs:177:1 | 177 | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> missing-doc.rs:180:1 + --> $DIR/missing-doc.rs:180:1 | 180 | / mod internal_impl { 181 | | /// dox @@ -235,42 +235,40 @@ error: missing documentation for a module | |_^ error: missing documentation for a function - --> missing-doc.rs:183:5 + --> $DIR/missing-doc.rs:183:5 | 183 | pub fn undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> missing-doc.rs:184:5 + --> $DIR/missing-doc.rs:184:5 | 184 | pub fn undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> missing-doc.rs:185:5 + --> $DIR/missing-doc.rs:185:5 | 185 | fn undocumented3() {} | ^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> missing-doc.rs:190:9 + --> $DIR/missing-doc.rs:190:9 | 190 | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> missing-doc.rs:191:9 + --> $DIR/missing-doc.rs:191:9 | 191 | fn also_undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> missing-doc.rs:202:1 + --> $DIR/missing-doc.rs:202:1 | 202 | fn main() {} | ^^^^^^^^^^^^ error: aborting due to 40 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/module_inception.rs b/tests/ui/module_inception.rs similarity index 100% rename from clippy_tests/examples/module_inception.rs rename to tests/ui/module_inception.rs diff --git a/clippy_tests/examples/module_inception.stderr b/tests/ui/module_inception.stderr similarity index 77% rename from clippy_tests/examples/module_inception.stderr rename to tests/ui/module_inception.stderr index 987db94e97c4..c9d3319db1b6 100644 --- a/clippy_tests/examples/module_inception.stderr +++ b/tests/ui/module_inception.stderr @@ -1,5 +1,5 @@ error: module has the same name as its containing module - --> module_inception.rs:7:9 + --> $DIR/module_inception.rs:7:9 | 7 | / mod bar { 8 | | mod foo {} @@ -9,7 +9,7 @@ error: module has the same name as its containing module = note: `-D module-inception` implied by `-D warnings` error: module has the same name as its containing module - --> module_inception.rs:12:5 + --> $DIR/module_inception.rs:12:5 | 12 | / mod foo { 13 | | mod bar {} @@ -18,5 +18,3 @@ error: module has the same name as its containing module error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/modulo_one.rs b/tests/ui/modulo_one.rs similarity index 100% rename from clippy_tests/examples/modulo_one.rs rename to tests/ui/modulo_one.rs diff --git a/clippy_tests/examples/modulo_one.stderr b/tests/ui/modulo_one.stderr similarity index 68% rename from clippy_tests/examples/modulo_one.stderr rename to tests/ui/modulo_one.stderr index c4f8b1d08e04..ccfca7154e04 100644 --- a/clippy_tests/examples/modulo_one.stderr +++ b/tests/ui/modulo_one.stderr @@ -1,5 +1,5 @@ error: any number modulo 1 will be 0 - --> modulo_one.rs:7:5 + --> $DIR/modulo_one.rs:7:5 | 7 | 10 % 1; | ^^^^^^ @@ -8,5 +8,3 @@ error: any number modulo 1 will be 0 error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/mut_from_ref.rs b/tests/ui/mut_from_ref.rs similarity index 100% rename from clippy_tests/examples/mut_from_ref.rs rename to tests/ui/mut_from_ref.rs diff --git a/clippy_tests/examples/mut_from_ref.stderr b/tests/ui/mut_from_ref.stderr similarity index 82% rename from clippy_tests/examples/mut_from_ref.stderr rename to tests/ui/mut_from_ref.stderr index bb4364a4c321..a7cbc0b7a096 100644 --- a/clippy_tests/examples/mut_from_ref.stderr +++ b/tests/ui/mut_from_ref.stderr @@ -1,65 +1,63 @@ error: mutable borrow from immutable input(s) - --> mut_from_ref.rs:9:39 + --> $DIR/mut_from_ref.rs:9:39 | 9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^^^^ | = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> mut_from_ref.rs:9:29 + --> $DIR/mut_from_ref.rs:9:29 | 9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^ error: mutable borrow from immutable input(s) - --> mut_from_ref.rs:15:25 + --> $DIR/mut_from_ref.rs:15:25 | 15 | fn ouch(x: &Foo) -> &mut Foo; | ^^^^^^^^ | note: immutable borrow here - --> mut_from_ref.rs:15:16 + --> $DIR/mut_from_ref.rs:15:16 | 15 | fn ouch(x: &Foo) -> &mut Foo; | ^^^^ error: mutable borrow from immutable input(s) - --> mut_from_ref.rs:24:21 + --> $DIR/mut_from_ref.rs:24:21 | 24 | fn fail(x: &u32) -> &mut u16 { | ^^^^^^^^ | note: immutable borrow here - --> mut_from_ref.rs:24:12 + --> $DIR/mut_from_ref.rs:24:12 | 24 | fn fail(x: &u32) -> &mut u16 { | ^^^^ error: mutable borrow from immutable input(s) - --> mut_from_ref.rs:28:50 + --> $DIR/mut_from_ref.rs:28:50 | 28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | note: immutable borrow here - --> mut_from_ref.rs:28:25 + --> $DIR/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) - --> mut_from_ref.rs:32:67 + --> $DIR/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: immutable borrow here - --> mut_from_ref.rs:32:27 + --> $DIR/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 - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/mut_mut.rs b/tests/ui/mut_mut.rs similarity index 100% rename from clippy_tests/examples/mut_mut.rs rename to tests/ui/mut_mut.rs diff --git a/clippy_tests/examples/mut_mut.stderr b/tests/ui/mut_mut.stderr similarity index 86% rename from clippy_tests/examples/mut_mut.stderr rename to tests/ui/mut_mut.stderr index 2eec18abeee7..dd3a85c97760 100644 --- a/clippy_tests/examples/mut_mut.stderr +++ b/tests/ui/mut_mut.stderr @@ -1,5 +1,5 @@ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:10:12 + --> $DIR/mut_mut.rs:10:12 | 10 | fn fun(x : &mut &mut u32) -> bool { | ^^^^^^^^^^^^^ @@ -7,13 +7,13 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:24:17 + --> $DIR/mut_mut.rs:24:17 | 24 | let mut x = &mut &mut 1u32; | ^^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:19:20 + --> $DIR/mut_mut.rs:19:20 | 19 | ($p:expr) => { &mut $p } | ^^^^^^^ @@ -22,66 +22,64 @@ error: generally you want to avoid `&mut &mut _` if possible | ------------------- in this macro invocation error: this expression mutably borrows a mutable reference. Consider reborrowing - --> mut_mut.rs:26:21 + --> $DIR/mut_mut.rs:26:21 | 26 | let mut y = &mut x; | ^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:30:17 + --> $DIR/mut_mut.rs:30:17 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:30:33 + --> $DIR/mut_mut.rs:30:33 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:30:17 + --> $DIR/mut_mut.rs:30:17 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:35:17 + --> $DIR/mut_mut.rs:35:17 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:35:22 + --> $DIR/mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:35:38 + --> $DIR/mut_mut.rs:35:38 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:35:17 + --> $DIR/mut_mut.rs:35:17 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:35:22 + --> $DIR/mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> mut_mut.rs:35:22 + --> $DIR/mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ error: aborting due to 13 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/mut_reference.rs b/tests/ui/mut_reference.rs similarity index 100% rename from clippy_tests/examples/mut_reference.rs rename to tests/ui/mut_reference.rs diff --git a/clippy_tests/examples/mut_reference.stderr b/tests/ui/mut_reference.stderr similarity index 81% rename from clippy_tests/examples/mut_reference.stderr rename to tests/ui/mut_reference.stderr index 42e227bfc369..73df19bf1583 100644 --- a/clippy_tests/examples/mut_reference.stderr +++ b/tests/ui/mut_reference.stderr @@ -1,5 +1,5 @@ error: The function/method `takes_an_immutable_reference` doesn't need a mutable reference - --> mut_reference.rs:22:34 + --> $DIR/mut_reference.rs:22:34 | 22 | takes_an_immutable_reference(&mut 42); | ^^^^^^^ @@ -7,18 +7,16 @@ error: The function/method `takes_an_immutable_reference` doesn't need a mutable = note: `-D unnecessary-mut-passed` implied by `-D warnings` error: The function/method `as_ptr` doesn't need a mutable reference - --> mut_reference.rs:24:12 + --> $DIR/mut_reference.rs:24:12 | 24 | as_ptr(&mut 42); | ^^^^^^^ error: The function/method `takes_an_immutable_reference` doesn't need a mutable reference - --> mut_reference.rs:28:44 + --> $DIR/mut_reference.rs:28:44 | 28 | my_struct.takes_an_immutable_reference(&mut 42); | ^^^^^^^ error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/mutex_atomic.rs b/tests/ui/mutex_atomic.rs similarity index 100% rename from clippy_tests/examples/mutex_atomic.rs rename to tests/ui/mutex_atomic.rs diff --git a/clippy_tests/examples/mutex_atomic.stderr b/tests/ui/mutex_atomic.stderr similarity index 87% rename from clippy_tests/examples/mutex_atomic.stderr rename to tests/ui/mutex_atomic.stderr index 403d0b8837b3..354f9891c178 100644 --- a/clippy_tests/examples/mutex_atomic.stderr +++ b/tests/ui/mutex_atomic.stderr @@ -1,5 +1,5 @@ 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<()>. - --> mutex_atomic.rs:9:5 + --> $DIR/mutex_atomic.rs:9:5 | 9 | Mutex::new(true); | ^^^^^^^^^^^^^^^^ @@ -7,31 +7,31 @@ error: Consider using an AtomicBool instead of a Mutex here. If you just want th = 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<()>. - --> mutex_atomic.rs:10:5 + --> $DIR/mutex_atomic.rs:10:5 | 10 | Mutex::new(5usize); | ^^^^^^^^^^^^^^^^^^ 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<()>. - --> mutex_atomic.rs:11:5 + --> $DIR/mutex_atomic.rs:11:5 | 11 | Mutex::new(9isize); | ^^^^^^^^^^^^^^^^^^ 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<()>. - --> mutex_atomic.rs:13:5 + --> $DIR/mutex_atomic.rs:13:5 | 13 | Mutex::new(&x as *const u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<()>. - --> mutex_atomic.rs:14:5 + --> $DIR/mutex_atomic.rs:14:5 | 14 | Mutex::new(&mut x as *mut u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<()>. - --> mutex_atomic.rs:15:5 + --> $DIR/mutex_atomic.rs:15:5 | 15 | Mutex::new(0u32); | ^^^^^^^^^^^^^^^^ @@ -39,12 +39,10 @@ error: Consider using an AtomicUsize instead of a Mutex here. If you just want t = 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<()>. - --> mutex_atomic.rs:16:5 + --> $DIR/mutex_atomic.rs:16:5 | 16 | Mutex::new(0i32); | ^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/needless_bool.rs b/tests/ui/needless_bool.rs similarity index 100% rename from clippy_tests/examples/needless_bool.rs rename to tests/ui/needless_bool.rs diff --git a/clippy_tests/examples/needless_bool.stderr b/tests/ui/needless_bool.stderr similarity index 85% rename from clippy_tests/examples/needless_bool.stderr rename to tests/ui/needless_bool.stderr index 6d129777fa95..63e0632445f6 100644 --- a/clippy_tests/examples/needless_bool.stderr +++ b/tests/ui/needless_bool.stderr @@ -1,5 +1,5 @@ error: this if-then-else expression will always return true - --> needless_bool.rs:9:5 + --> $DIR/needless_bool.rs:9:5 | 9 | if x { true } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,66 +7,64 @@ error: this if-then-else expression will always return true = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression will always return false - --> needless_bool.rs:10:5 + --> $DIR/needless_bool.rs:10:5 | 10 | if x { false } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this if-then-else expression returns a bool literal - --> needless_bool.rs:11:5 + --> $DIR/needless_bool.rs:11:5 | 11 | if x { true } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `x` error: this if-then-else expression returns a bool literal - --> needless_bool.rs:12:5 + --> $DIR/needless_bool.rs:12:5 | 12 | if x { false } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!x` error: this if-then-else expression returns a bool literal - --> needless_bool.rs:13:5 + --> $DIR/needless_bool.rs:13:5 | 13 | if x && y { false } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!(x && y)` error: this if-then-else expression will always return true - --> needless_bool.rs:25:5 + --> $DIR/needless_bool.rs:25:5 | 25 | if x { return true } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this if-then-else expression will always return false - --> needless_bool.rs:30:5 + --> $DIR/needless_bool.rs:30:5 | 30 | if x { return false } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this if-then-else expression returns a bool literal - --> needless_bool.rs:35:5 + --> $DIR/needless_bool.rs:35:5 | 35 | if x { return true } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x` error: this if-then-else expression returns a bool literal - --> needless_bool.rs:40:5 + --> $DIR/needless_bool.rs:40:5 | 40 | if x && y { return true } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x && y` error: this if-then-else expression returns a bool literal - --> needless_bool.rs:45:5 + --> $DIR/needless_bool.rs:45:5 | 45 | if x { return false } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !x` error: this if-then-else expression returns a bool literal - --> needless_bool.rs:50:5 + --> $DIR/needless_bool.rs:50:5 | 50 | if x && y { return false } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !(x && y)` error: aborting due to 11 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/needless_borrow.rs b/tests/ui/needless_borrow.rs similarity index 100% rename from clippy_tests/examples/needless_borrow.rs rename to tests/ui/needless_borrow.rs diff --git a/clippy_tests/examples/needless_borrow.stderr b/tests/ui/needless_borrow.stderr similarity index 79% rename from clippy_tests/examples/needless_borrow.stderr rename to tests/ui/needless_borrow.stderr index 9c3633d4cb69..cc5b1b6c33c6 100644 --- a/clippy_tests/examples/needless_borrow.stderr +++ b/tests/ui/needless_borrow.stderr @@ -1,5 +1,5 @@ error: this expression borrows a reference that is immediately dereferenced by the compiler - --> needless_borrow.rs:13:15 + --> $DIR/needless_borrow.rs:13:15 | 13 | let c = x(&&a); | ^^^ @@ -7,24 +7,22 @@ error: this expression borrows a reference that is immediately dereferenced by t = note: `-D needless-borrow` implied by `-D warnings` error: this pattern creates a reference to a reference - --> needless_borrow.rs:20:17 + --> $DIR/needless_borrow.rs:20:17 | 20 | if let Some(ref cake) = Some(&5) {} | ^^^^^^^^ error: this expression borrows a reference that is immediately dereferenced by the compiler - --> needless_borrow.rs:27:15 + --> $DIR/needless_borrow.rs:27:15 | 27 | 46 => &&a, | ^^^ error: this pattern creates a reference to a reference - --> needless_borrow.rs:50:31 + --> $DIR/needless_borrow.rs:50:31 | 50 | let _ = v.iter().filter(|&ref a| a.is_empty()); | ^^^^^ error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/needless_continue.rs b/tests/ui/needless_continue.rs similarity index 100% rename from clippy_tests/examples/needless_continue.rs rename to tests/ui/needless_continue.rs diff --git a/clippy_tests/examples/needless_continue.stderr b/tests/ui/needless_continue.stderr similarity index 93% rename from clippy_tests/examples/needless_continue.stderr rename to tests/ui/needless_continue.stderr index dd0a508b6d10..3e0368892a43 100644 --- a/clippy_tests/examples/needless_continue.stderr +++ b/tests/ui/needless_continue.stderr @@ -1,6 +1,6 @@ error: This else block is redundant. - --> needless_continue.rs:26:16 + --> $DIR/needless_continue.rs:26:16 | 26 | } else { | ________________^ @@ -37,7 +37,7 @@ error: This else block is redundant. error: There is no need for an explicit `else` block for this `if` expression - --> needless_continue.rs:41:9 + --> $DIR/needless_continue.rs:41:9 | 41 | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 { 42 | | continue; @@ -57,5 +57,3 @@ error: There is no need for an explicit `else` block for this `if` expression error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/needless_pass_by_value.rs b/tests/ui/needless_pass_by_value.rs similarity index 100% rename from clippy_tests/examples/needless_pass_by_value.rs rename to tests/ui/needless_pass_by_value.rs diff --git a/clippy_tests/examples/needless_pass_by_value.stderr b/tests/ui/needless_pass_by_value.stderr similarity index 86% rename from clippy_tests/examples/needless_pass_by_value.stderr rename to tests/ui/needless_pass_by_value.stderr index 15701d651243..02293c9cb3cf 100644 --- a/clippy_tests/examples/needless_pass_by_value.stderr +++ b/tests/ui/needless_pass_by_value.stderr @@ -1,5 +1,5 @@ error: this argument is passed by value, but not consumed in the function body - --> needless_pass_by_value.rs:9:23 + --> $DIR/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]` @@ -7,25 +7,25 @@ error: this argument is passed by value, but not consumed in the function body = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> needless_pass_by_value.rs:23:11 + --> $DIR/needless_pass_by_value.rs:23:11 | 23 | fn bar(x: String, y: Wrapper) { | ^^^^^^ help: consider changing the type to: `&str` error: this argument is passed by value, but not consumed in the function body - --> needless_pass_by_value.rs:23:22 + --> $DIR/needless_pass_by_value.rs:23:22 | 23 | fn bar(x: String, y: Wrapper) { | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` error: this argument is passed by value, but not consumed in the function body - --> needless_pass_by_value.rs:29:63 + --> $DIR/needless_pass_by_value.rs:29:63 | 29 | fn test_borrow_trait, U>(t: T, u: U) { | ^ help: consider taking a reference instead: `&U` error: this argument is passed by value, but not consumed in the function body - --> needless_pass_by_value.rs:40:18 + --> $DIR/needless_pass_by_value.rs:40:18 | 40 | fn test_match(x: Option>, y: Option>) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -37,13 +37,13 @@ help: consider taking a reference instead | error: this argument is passed by value, but not consumed in the function body - --> needless_pass_by_value.rs:53:24 + --> $DIR/needless_pass_by_value.rs:53:24 | 53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` error: this argument is passed by value, but not consumed in the function body - --> needless_pass_by_value.rs:53:36 + --> $DIR/needless_pass_by_value.rs:53:36 | 53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ @@ -58,5 +58,3 @@ help: consider taking a reference instead error: aborting due to 7 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/needless_return.rs b/tests/ui/needless_return.rs similarity index 100% rename from clippy_tests/examples/needless_return.rs rename to tests/ui/needless_return.rs diff --git a/clippy_tests/examples/needless_return.stderr b/tests/ui/needless_return.stderr similarity index 79% rename from clippy_tests/examples/needless_return.stderr rename to tests/ui/needless_return.stderr index 8cd549c96da4..42dc6e6594c5 100644 --- a/clippy_tests/examples/needless_return.stderr +++ b/tests/ui/needless_return.stderr @@ -1,5 +1,5 @@ error: unneeded return statement - --> needless_return.rs:11:5 + --> $DIR/needless_return.rs:11:5 | 11 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` @@ -7,48 +7,46 @@ error: unneeded return statement = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> needless_return.rs:15:5 + --> $DIR/needless_return.rs:15:5 | 15 | return true | ^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> needless_return.rs:20:9 + --> $DIR/needless_return.rs:20:9 | 20 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> needless_return.rs:22:9 + --> $DIR/needless_return.rs:22:9 | 22 | return false; | ^^^^^^^^^^^^^ help: remove `return` as shown: `false` error: unneeded return statement - --> needless_return.rs:28:17 + --> $DIR/needless_return.rs:28:17 | 28 | true => return false, | ^^^^^^^^^^^^ help: remove `return` as shown: `false` error: unneeded return statement - --> needless_return.rs:30:13 + --> $DIR/needless_return.rs:30:13 | 30 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> needless_return.rs:37:9 + --> $DIR/needless_return.rs:37:9 | 37 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> needless_return.rs:39:16 + --> $DIR/needless_return.rs:39:16 | 39 | let _ = || return true; | ^^^^^^^^^^^ help: remove `return` as shown: `true` error: aborting due to 8 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/needless_update.rs b/tests/ui/needless_update.rs similarity index 100% rename from clippy_tests/examples/needless_update.rs rename to tests/ui/needless_update.rs diff --git a/clippy_tests/examples/needless_update.stderr b/tests/ui/needless_update.stderr similarity index 75% rename from clippy_tests/examples/needless_update.stderr rename to tests/ui/needless_update.stderr index 19d0998cbe9c..3e509870d00f 100644 --- a/clippy_tests/examples/needless_update.stderr +++ b/tests/ui/needless_update.stderr @@ -1,5 +1,5 @@ error: struct update has no effect, all the fields in the struct have already been specified - --> needless_update.rs:16:23 + --> $DIR/needless_update.rs:16:23 | 16 | S { a: 1, b: 1, ..base }; | ^^^^ @@ -8,5 +8,3 @@ error: struct update has no effect, all the fields in the struct have already be error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/neg_multiply.rs b/tests/ui/neg_multiply.rs similarity index 100% rename from clippy_tests/examples/neg_multiply.rs rename to tests/ui/neg_multiply.rs diff --git a/clippy_tests/examples/neg_multiply.stderr b/tests/ui/neg_multiply.stderr similarity index 70% rename from clippy_tests/examples/neg_multiply.stderr rename to tests/ui/neg_multiply.stderr index 095c2915de3c..1d52ba16eae8 100644 --- a/clippy_tests/examples/neg_multiply.stderr +++ b/tests/ui/neg_multiply.stderr @@ -1,5 +1,5 @@ error: Negation by multiplying with -1 - --> neg_multiply.rs:30:5 + --> $DIR/neg_multiply.rs:30:5 | 30 | x * -1; | ^^^^^^ @@ -7,12 +7,10 @@ error: Negation by multiplying with -1 = note: `-D neg-multiply` implied by `-D warnings` error: Negation by multiplying with -1 - --> neg_multiply.rs:32:5 + --> $DIR/neg_multiply.rs:32:5 | 32 | -1 * x; | ^^^^^^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/never_loop.rs b/tests/ui/never_loop.rs similarity index 100% rename from clippy_tests/examples/never_loop.rs rename to tests/ui/never_loop.rs diff --git a/clippy_tests/examples/never_loop.stderr b/tests/ui/never_loop.stderr similarity index 68% rename from clippy_tests/examples/never_loop.stderr rename to tests/ui/never_loop.stderr index 224f87cd518e..97205690da64 100644 --- a/clippy_tests/examples/never_loop.stderr +++ b/tests/ui/never_loop.stderr @@ -1,5 +1,5 @@ error: this loop never actually loops - --> never_loop.rs:7:5 + --> $DIR/never_loop.rs:7:5 | 7 | / loop { // never_loop 8 | | x += 1; @@ -13,7 +13,7 @@ error: this loop never actually loops = note: `-D never-loop` implied by `-D warnings` error: this loop never actually loops - --> never_loop.rs:28:5 + --> $DIR/never_loop.rs:28:5 | 28 | / loop { // never loops 29 | | x += 1; @@ -22,18 +22,18 @@ error: this loop never actually loops | |_____^ error: this loop never actually loops - --> never_loop.rs:47:2 + --> $DIR/never_loop.rs:47:2 | -47 | / loop { // never loops -48 | | while i == 0 { // never loops -49 | | break -50 | | } -51 | | return -52 | | } +47 | / \tloop { // never loops +48 | | \t while i == 0 { // never loops +49 | | \t break +50 | | \t } +51 | | \t return +52 | | \t} | |__^ error: this loop never actually loops - --> never_loop.rs:48:9 + --> $DIR/never_loop.rs:48:9 | 48 | / while i == 0 { // never loops 49 | | break @@ -41,28 +41,28 @@ error: this loop never actually loops | |_________^ error: this loop never actually loops - --> never_loop.rs:57:5 + --> $DIR/never_loop.rs:57:5 | 57 | / 'outer: loop { // never loops 58 | | x += 1; -59 | | loop { // never loops +59 | | \t\tloop { // never loops 60 | | if x == 5 { break } ... | -63 | | return -64 | | } +63 | | \t\treturn +64 | | \t} | |__^ error: this loop never actually loops - --> never_loop.rs:59:3 + --> $DIR/never_loop.rs:59:3 | -59 | / loop { // never loops -60 | | if x == 5 { break } -61 | | continue 'outer -62 | | } +59 | / \t\tloop { // never loops +60 | | \t\t if x == 5 { break } +61 | | \t\t\tcontinue 'outer +62 | | \t\t} | |___^ error: this loop never actually loops - --> never_loop.rs:92:5 + --> $DIR/never_loop.rs:92:5 | 92 | / while let Some(y) = x { // never loops 93 | | return @@ -70,7 +70,7 @@ error: this loop never actually loops | |_____^ error: this loop never actually loops - --> never_loop.rs:98:5 + --> $DIR/never_loop.rs:98:5 | 98 | / for x in 0..10 { // never loops 99 | | match x { @@ -82,5 +82,3 @@ error: this loop never actually loops error: aborting due to 8 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/new_without_default.rs b/tests/ui/new_without_default.rs similarity index 100% rename from clippy_tests/examples/new_without_default.rs rename to tests/ui/new_without_default.rs diff --git a/clippy_tests/examples/new_without_default.stderr b/tests/ui/new_without_default.stderr similarity index 85% rename from clippy_tests/examples/new_without_default.stderr rename to tests/ui/new_without_default.stderr index 97a3c0462f87..91e437a6eb54 100644 --- a/clippy_tests/examples/new_without_default.stderr +++ b/tests/ui/new_without_default.stderr @@ -1,5 +1,5 @@ error: you should consider deriving a `Default` implementation for `Foo` - --> new_without_default.rs:10:5 + --> $DIR/new_without_default.rs:10:5 | 10 | pub fn new() -> Foo { Foo } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ help: try this | error: you should consider deriving a `Default` implementation for `Bar` - --> new_without_default.rs:16:5 + --> $DIR/new_without_default.rs:16:5 | 16 | pub fn new() -> Self { Bar } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -22,7 +22,7 @@ help: try this | error: you should consider adding a `Default` implementation for `LtKo<'c>` - --> new_without_default.rs:64:5 + --> $DIR/new_without_default.rs:64:5 | 64 | pub fn new() -> LtKo<'c> { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -40,5 +40,3 @@ help: try this error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/no_effect.rs b/tests/ui/no_effect.rs similarity index 100% rename from clippy_tests/examples/no_effect.rs rename to tests/ui/no_effect.rs diff --git a/clippy_tests/examples/no_effect.stderr b/tests/ui/no_effect.stderr similarity index 78% rename from clippy_tests/examples/no_effect.stderr rename to tests/ui/no_effect.stderr index 4d1c29ed079e..590b1eab4977 100644 --- a/clippy_tests/examples/no_effect.stderr +++ b/tests/ui/no_effect.stderr @@ -1,5 +1,5 @@ error: statement with no effect - --> no_effect.rs:34:5 + --> $DIR/no_effect.rs:34:5 | 34 | 0; | ^^ @@ -7,151 +7,151 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> no_effect.rs:35:5 + --> $DIR/no_effect.rs:35:5 | 35 | s2; | ^^^ error: statement with no effect - --> no_effect.rs:36:5 + --> $DIR/no_effect.rs:36:5 | 36 | Unit; | ^^^^^ error: statement with no effect - --> no_effect.rs:37:5 + --> $DIR/no_effect.rs:37:5 | 37 | Tuple(0); | ^^^^^^^^^ error: statement with no effect - --> no_effect.rs:38:5 + --> $DIR/no_effect.rs:38:5 | 38 | Struct { field: 0 }; | ^^^^^^^^^^^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:39:5 + --> $DIR/no_effect.rs:39:5 | 39 | Struct { ..s }; | ^^^^^^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:40:5 + --> $DIR/no_effect.rs:40:5 | 40 | Union { a: 0 }; | ^^^^^^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:41:5 + --> $DIR/no_effect.rs:41:5 | 41 | Enum::Tuple(0); | ^^^^^^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:42:5 + --> $DIR/no_effect.rs:42:5 | 42 | Enum::Struct { field: 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:43:5 + --> $DIR/no_effect.rs:43:5 | 43 | 5 + 6; | ^^^^^^ error: statement with no effect - --> no_effect.rs:44:5 + --> $DIR/no_effect.rs:44:5 | 44 | *&42; | ^^^^^ error: statement with no effect - --> no_effect.rs:45:5 + --> $DIR/no_effect.rs:45:5 | 45 | &6; | ^^^ error: statement with no effect - --> no_effect.rs:46:5 + --> $DIR/no_effect.rs:46:5 | 46 | (5, 6, 7); | ^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:47:5 + --> $DIR/no_effect.rs:47:5 | 47 | box 42; | ^^^^^^^ error: statement with no effect - --> no_effect.rs:48:5 + --> $DIR/no_effect.rs:48:5 | 48 | ..; | ^^^ error: statement with no effect - --> no_effect.rs:49:5 + --> $DIR/no_effect.rs:49:5 | 49 | 5..; | ^^^^ error: statement with no effect - --> no_effect.rs:50:5 + --> $DIR/no_effect.rs:50:5 | 50 | ..5; | ^^^^ error: statement with no effect - --> no_effect.rs:51:5 + --> $DIR/no_effect.rs:51:5 | 51 | 5..6; | ^^^^^ error: statement with no effect - --> no_effect.rs:52:5 + --> $DIR/no_effect.rs:52:5 | 52 | 5...6; | ^^^^^^ error: statement with no effect - --> no_effect.rs:53:5 + --> $DIR/no_effect.rs:53:5 | 53 | [42, 55]; | ^^^^^^^^^ error: statement with no effect - --> no_effect.rs:54:5 + --> $DIR/no_effect.rs:54:5 | 54 | [42, 55][1]; | ^^^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:55:5 + --> $DIR/no_effect.rs:55:5 | 55 | (42, 55).1; | ^^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:56:5 + --> $DIR/no_effect.rs:56:5 | 56 | [42; 55]; | ^^^^^^^^^ error: statement with no effect - --> no_effect.rs:57:5 + --> $DIR/no_effect.rs:57:5 | 57 | [42; 55][13]; | ^^^^^^^^^^^^^ error: statement with no effect - --> no_effect.rs:59:5 + --> $DIR/no_effect.rs:59:5 | 59 | || x += 5; | ^^^^^^^^^^ error: statement can be reduced - --> no_effect.rs:65:5 + --> $DIR/no_effect.rs:65:5 | 65 | Tuple(get_number()); | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` @@ -159,114 +159,112 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> no_effect.rs:66:5 + --> $DIR/no_effect.rs:66:5 | 66 | Struct { field: get_number() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:67:5 + --> $DIR/no_effect.rs:67:5 | 67 | Struct { ..get_struct() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_struct();` error: statement can be reduced - --> no_effect.rs:68:5 + --> $DIR/no_effect.rs:68:5 | 68 | Enum::Tuple(get_number()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:69:5 + --> $DIR/no_effect.rs:69:5 | 69 | Enum::Struct { field: get_number() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:70:5 + --> $DIR/no_effect.rs:70:5 | 70 | 5 + get_number(); | ^^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` error: statement can be reduced - --> no_effect.rs:71:5 + --> $DIR/no_effect.rs:71:5 | 71 | *&get_number(); | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:72:5 + --> $DIR/no_effect.rs:72:5 | 72 | &get_number(); | ^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:73:5 + --> $DIR/no_effect.rs:73:5 | 73 | (5, 6, get_number()); | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `5;6;get_number();` error: statement can be reduced - --> no_effect.rs:74:5 + --> $DIR/no_effect.rs:74:5 | 74 | box get_number(); | ^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:75:5 + --> $DIR/no_effect.rs:75:5 | 75 | get_number()..; | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:76:5 + --> $DIR/no_effect.rs:76:5 | 76 | ..get_number(); | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:77:5 + --> $DIR/no_effect.rs:77:5 | 77 | 5..get_number(); | ^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` error: statement can be reduced - --> no_effect.rs:78:5 + --> $DIR/no_effect.rs:78:5 | 78 | [42, get_number()]; | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` error: statement can be reduced - --> no_effect.rs:79:5 + --> $DIR/no_effect.rs:79:5 | 79 | [42, 55][get_number() as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42, 55];get_number() as usize;` error: statement can be reduced - --> no_effect.rs:80:5 + --> $DIR/no_effect.rs:80:5 | 80 | (42, get_number()).1; | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` error: statement can be reduced - --> no_effect.rs:81:5 + --> $DIR/no_effect.rs:81:5 | 81 | [get_number(); 55]; | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced - --> no_effect.rs:82:5 + --> $DIR/no_effect.rs:82:5 | 82 | [42; 55][get_number() as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42; 55];get_number() as usize;` error: statement can be reduced - --> no_effect.rs:83:5 + --> $DIR/no_effect.rs:83:5 | 83 | {get_number()}; | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: aborting due to 44 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/non_expressive_names.rs b/tests/ui/non_expressive_names.rs similarity index 100% rename from clippy_tests/examples/non_expressive_names.rs rename to tests/ui/non_expressive_names.rs diff --git a/clippy_tests/examples/non_expressive_names.stderr b/tests/ui/non_expressive_names.stderr similarity index 74% rename from clippy_tests/examples/non_expressive_names.stderr rename to tests/ui/non_expressive_names.stderr index 34d16cbd5393..780d7d8aec90 100644 --- a/clippy_tests/examples/non_expressive_names.stderr +++ b/tests/ui/non_expressive_names.stderr @@ -1,110 +1,110 @@ error: binding's name is too similar to existing binding - --> non_expressive_names.rs:18:9 + --> $DIR/non_expressive_names.rs:18:9 | 18 | let bpple: i32; | ^^^^^ | = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> non_expressive_names.rs:16:9 + --> $DIR/non_expressive_names.rs:16:9 | 16 | let apple: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `b_pple` - --> non_expressive_names.rs:18:9 + --> $DIR/non_expressive_names.rs:18:9 | 18 | let bpple: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> non_expressive_names.rs:20:9 + --> $DIR/non_expressive_names.rs:20:9 | 20 | let cpple: i32; | ^^^^^ | note: existing binding defined here - --> non_expressive_names.rs:16:9 + --> $DIR/non_expressive_names.rs:16:9 | 16 | let apple: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `c_pple` - --> non_expressive_names.rs:20:9 + --> $DIR/non_expressive_names.rs:20:9 | 20 | let cpple: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> non_expressive_names.rs:45:9 + --> $DIR/non_expressive_names.rs:45:9 | 45 | let bluby: i32; | ^^^^^ | note: existing binding defined here - --> non_expressive_names.rs:44:9 + --> $DIR/non_expressive_names.rs:44:9 | 44 | let blubx: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `blub_y` - --> non_expressive_names.rs:45:9 + --> $DIR/non_expressive_names.rs:45:9 | 45 | let bluby: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> non_expressive_names.rs:50:9 + --> $DIR/non_expressive_names.rs:50:9 | 50 | let coke: i32; | ^^^^ | note: existing binding defined here - --> non_expressive_names.rs:48:9 + --> $DIR/non_expressive_names.rs:48:9 | 48 | let cake: i32; | ^^^^ error: binding's name is too similar to existing binding - --> non_expressive_names.rs:68:9 + --> $DIR/non_expressive_names.rs:68:9 | 68 | let xyzeabc: i32; | ^^^^^^^ | note: existing binding defined here - --> non_expressive_names.rs:66:9 + --> $DIR/non_expressive_names.rs:66:9 | 66 | let xyz1abc: i32; | ^^^^^^^ error: binding's name is too similar to existing binding - --> non_expressive_names.rs:72:9 + --> $DIR/non_expressive_names.rs:72:9 | 72 | let parsee: i32; | ^^^^^^ | note: existing binding defined here - --> non_expressive_names.rs:70:9 + --> $DIR/non_expressive_names.rs:70:9 | 70 | let parser: i32; | ^^^^^^ help: separate the discriminating character by an underscore like: `parse_e` - --> non_expressive_names.rs:72:9 + --> $DIR/non_expressive_names.rs:72:9 | 72 | let parsee: i32; | ^^^^^^ error: binding's name is too similar to existing binding - --> non_expressive_names.rs:86:16 + --> $DIR/non_expressive_names.rs:86:16 | 86 | bpple: sprang } = unimplemented!(); | ^^^^^^ | note: existing binding defined here - --> non_expressive_names.rs:85:22 + --> $DIR/non_expressive_names.rs:85:22 | 85 | let Foo { apple: spring, | ^^^^^^ error: 5th binding whose name is just one char - --> non_expressive_names.rs:120:17 + --> $DIR/non_expressive_names.rs:120:17 | 120 | let e: i32; | ^ @@ -112,24 +112,22 @@ error: 5th binding whose name is just one char = note: `-D many-single-char-names` implied by `-D warnings` error: 5th binding whose name is just one char - --> non_expressive_names.rs:123:17 + --> $DIR/non_expressive_names.rs:123:17 | 123 | let e: i32; | ^ error: 6th binding whose name is just one char - --> non_expressive_names.rs:124:17 + --> $DIR/non_expressive_names.rs:124:17 | 124 | let f: i32; | ^ error: 5th binding whose name is just one char - --> non_expressive_names.rs:129:13 + --> $DIR/non_expressive_names.rs:129:13 | 129 | e => panic!(), | ^ error: aborting due to 11 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/ok_if_let.rs b/tests/ui/ok_if_let.rs similarity index 100% rename from clippy_tests/examples/ok_if_let.rs rename to tests/ui/ok_if_let.rs diff --git a/clippy_tests/examples/ok_if_let.stderr b/tests/ui/ok_if_let.stderr similarity index 82% rename from clippy_tests/examples/ok_if_let.stderr rename to tests/ui/ok_if_let.stderr index 21352c639575..e1371d924eb6 100644 --- a/clippy_tests/examples/ok_if_let.stderr +++ b/tests/ui/ok_if_let.stderr @@ -1,5 +1,5 @@ error: Matching on `Some` with `ok()` is redundant - --> ok_if_let.rs:7:5 + --> $DIR/ok_if_let.rs:7:5 | 7 | / if let Some(y) = x.parse().ok() { 8 | | y @@ -13,5 +13,3 @@ error: Matching on `Some` with `ok()` is redundant error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/op_ref.rs b/tests/ui/op_ref.rs similarity index 100% rename from clippy_tests/examples/op_ref.rs rename to tests/ui/op_ref.rs diff --git a/clippy_tests/examples/op_ref.stderr b/tests/ui/op_ref.stderr similarity index 79% rename from clippy_tests/examples/op_ref.stderr rename to tests/ui/op_ref.stderr index 9c747006a43f..715c7378e0cf 100644 --- a/clippy_tests/examples/op_ref.stderr +++ b/tests/ui/op_ref.stderr @@ -1,5 +1,5 @@ error: needlessly taken reference of both operands - --> op_ref.rs:13:15 + --> $DIR/op_ref.rs:13:15 | 13 | let foo = &5 - &6; | ^^^^^^^ @@ -12,5 +12,3 @@ help: use the values directly error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/open_options.rs b/tests/ui/open_options.rs similarity index 100% rename from clippy_tests/examples/open_options.rs rename to tests/ui/open_options.rs diff --git a/clippy_tests/examples/open_options.stderr b/tests/ui/open_options.stderr similarity index 86% rename from clippy_tests/examples/open_options.stderr rename to tests/ui/open_options.stderr index 94bcf301d35d..f0d419041523 100644 --- a/clippy_tests/examples/open_options.stderr +++ b/tests/ui/open_options.stderr @@ -1,5 +1,5 @@ error: file opened with "truncate" and "read" - --> open_options.rs:8:5 + --> $DIR/open_options.rs:8:5 | 8 | OpenOptions::new().read(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,42 +7,40 @@ error: file opened with "truncate" and "read" = note: `-D nonsensical-open-options` implied by `-D warnings` error: file opened with "append" and "truncate" - --> open_options.rs:9:5 + --> $DIR/open_options.rs:9:5 | 9 | OpenOptions::new().append(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "read" is called more than once - --> open_options.rs:11:5 + --> $DIR/open_options.rs:11:5 | 11 | OpenOptions::new().read(true).read(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "create" is called more than once - --> open_options.rs:12:5 + --> $DIR/open_options.rs:12:5 | 12 | OpenOptions::new().create(true).create(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "write" is called more than once - --> open_options.rs:13:5 + --> $DIR/open_options.rs:13:5 | 13 | OpenOptions::new().write(true).write(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "append" is called more than once - --> open_options.rs:14:5 + --> $DIR/open_options.rs:14:5 | 14 | OpenOptions::new().append(true).append(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "truncate" is called more than once - --> open_options.rs:15:5 + --> $DIR/open_options.rs:15:5 | 15 | OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/overflow_check_conditional.rs b/tests/ui/overflow_check_conditional.rs similarity index 100% rename from clippy_tests/examples/overflow_check_conditional.rs rename to tests/ui/overflow_check_conditional.rs diff --git a/clippy_tests/examples/overflow_check_conditional.stderr b/tests/ui/overflow_check_conditional.stderr similarity index 54% rename from clippy_tests/examples/overflow_check_conditional.stderr rename to tests/ui/overflow_check_conditional.stderr index b2dbb57d50ed..543075ff5de1 100644 --- a/clippy_tests/examples/overflow_check_conditional.stderr +++ b/tests/ui/overflow_check_conditional.stderr @@ -1,54 +1,52 @@ error: You are trying to use classic C overflow conditions that will fail in Rust. - --> overflow_check_conditional.rs:11:5 + --> $DIR/overflow_check_conditional.rs:11:5 | -11 | if a + b < a { - | ^^^^^^^^^ +11 | \tif a + b < a { + | \t ^^^^^^^^^ | = note: `-D overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C overflow conditions that will fail in Rust. - --> overflow_check_conditional.rs:14:5 + --> $DIR/overflow_check_conditional.rs:14:5 | -14 | if a > a + b { - | ^^^^^^^^^ +14 | \tif a > a + b { + | \t ^^^^^^^^^ error: You are trying to use classic C overflow conditions that will fail in Rust. - --> overflow_check_conditional.rs:17:5 + --> $DIR/overflow_check_conditional.rs:17:5 | -17 | if a + b < b { - | ^^^^^^^^^ +17 | \tif a + b < b { + | \t ^^^^^^^^^ error: You are trying to use classic C overflow conditions that will fail in Rust. - --> overflow_check_conditional.rs:20:5 + --> $DIR/overflow_check_conditional.rs:20:5 | -20 | if b > a + b { - | ^^^^^^^^^ +20 | \tif b > a + b { + | \t ^^^^^^^^^ error: You are trying to use classic C underflow conditions that will fail in Rust. - --> overflow_check_conditional.rs:23:5 + --> $DIR/overflow_check_conditional.rs:23:5 | -23 | if a - b > b { - | ^^^^^^^^^ +23 | \tif a - b > b { + | \t ^^^^^^^^^ error: You are trying to use classic C underflow conditions that will fail in Rust. - --> overflow_check_conditional.rs:26:5 + --> $DIR/overflow_check_conditional.rs:26:5 | -26 | if b < a - b { - | ^^^^^^^^^ +26 | \tif b < a - b { + | \t ^^^^^^^^^ error: You are trying to use classic C underflow conditions that will fail in Rust. - --> overflow_check_conditional.rs:29:5 + --> $DIR/overflow_check_conditional.rs:29:5 | -29 | if a - b > a { - | ^^^^^^^^^ +29 | \tif a - b > a { + | \t ^^^^^^^^^ error: You are trying to use classic C underflow conditions that will fail in Rust. - --> overflow_check_conditional.rs:32:5 + --> $DIR/overflow_check_conditional.rs:32:5 | -32 | if a < a - b { - | ^^^^^^^^^ +32 | \tif a < a - b { + | \t ^^^^^^^^^ error: aborting due to 8 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/panic.rs b/tests/ui/panic.rs similarity index 100% rename from clippy_tests/examples/panic.rs rename to tests/ui/panic.rs diff --git a/clippy_tests/examples/panic.stderr b/tests/ui/panic.stderr similarity index 85% rename from clippy_tests/examples/panic.stderr rename to tests/ui/panic.stderr index e8c3fffce051..a7284124b294 100644 --- a/clippy_tests/examples/panic.stderr +++ b/tests/ui/panic.stderr @@ -1,5 +1,5 @@ error: you probably are missing some parameter in your format string - --> panic.rs:8:16 + --> $DIR/panic.rs:8:16 | 8 | panic!("{}"); | ^^^^ @@ -7,19 +7,19 @@ error: you probably are missing some parameter in your format string = note: `-D panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string - --> panic.rs:10:16 + --> $DIR/panic.rs:10:16 | 10 | panic!("{:?}"); | ^^^^^^ error: you probably are missing some parameter in your format string - --> panic.rs:12:23 + --> $DIR/panic.rs:12:23 | 12 | assert!(true, "here be missing values: {}"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you probably are missing some parameter in your format string - --> panic.rs:22:5 + --> $DIR/panic.rs:22:5 | 22 | assert!("foo bar".contains(&format!("foo {}", "bar"))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -28,5 +28,3 @@ error: you probably are missing some parameter in your format string error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/partialeq_ne_impl.rs b/tests/ui/partialeq_ne_impl.rs similarity index 100% rename from clippy_tests/examples/partialeq_ne_impl.rs rename to tests/ui/partialeq_ne_impl.rs diff --git a/clippy_tests/examples/partialeq_ne_impl.stderr b/tests/ui/partialeq_ne_impl.stderr similarity index 75% rename from clippy_tests/examples/partialeq_ne_impl.stderr rename to tests/ui/partialeq_ne_impl.stderr index d9f852387a9b..5e536cc51d28 100644 --- a/clippy_tests/examples/partialeq_ne_impl.stderr +++ b/tests/ui/partialeq_ne_impl.stderr @@ -1,5 +1,5 @@ error: re-implementing `PartialEq::ne` is unnecessary - --> partialeq_ne_impl.rs:10:5 + --> $DIR/partialeq_ne_impl.rs:10:5 | 10 | fn ne(&self, _: &Foo) -> bool { false } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,5 +8,3 @@ error: re-implementing `PartialEq::ne` is unnecessary error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/patterns.rs b/tests/ui/patterns.rs similarity index 100% rename from clippy_tests/examples/patterns.rs rename to tests/ui/patterns.rs diff --git a/clippy_tests/examples/patterns.stderr b/tests/ui/patterns.stderr similarity index 73% rename from clippy_tests/examples/patterns.stderr rename to tests/ui/patterns.stderr index 224674f0a673..59bce3a9a8f6 100644 --- a/clippy_tests/examples/patterns.stderr +++ b/tests/ui/patterns.stderr @@ -1,5 +1,5 @@ error: the `y @ _` pattern can be written as just `y` - --> patterns.rs:10:9 + --> $DIR/patterns.rs:10:9 | 10 | y @ _ => (), | ^^^^^ @@ -8,5 +8,3 @@ error: the `y @ _` pattern can be written as just `y` error: aborting due to previous error - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/precedence.rs b/tests/ui/precedence.rs similarity index 100% rename from clippy_tests/examples/precedence.rs rename to tests/ui/precedence.rs diff --git a/clippy_tests/examples/precedence.stderr b/tests/ui/precedence.stderr similarity index 84% rename from clippy_tests/examples/precedence.stderr rename to tests/ui/precedence.stderr index 945279092bcc..9f0e53ffca2b 100644 --- a/clippy_tests/examples/precedence.stderr +++ b/tests/ui/precedence.stderr @@ -1,5 +1,5 @@ error: operator precedence can trip the unwary - --> precedence.rs:8:5 + --> $DIR/precedence.rs:8:5 | 8 | 1 << 2 + 3; | ^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (2 + 3)` @@ -7,54 +7,52 @@ error: operator precedence can trip the unwary = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> precedence.rs:9:5 + --> $DIR/precedence.rs:9:5 | 9 | 1 + 2 << 3; | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 2) << 3` error: operator precedence can trip the unwary - --> precedence.rs:10:5 + --> $DIR/precedence.rs:10:5 | 10 | 4 >> 1 + 1; | ^^^^^^^^^^ help: consider parenthesizing your expression: `4 >> (1 + 1)` error: operator precedence can trip the unwary - --> precedence.rs:11:5 + --> $DIR/precedence.rs:11:5 | 11 | 1 + 3 >> 2; | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 3) >> 2` error: operator precedence can trip the unwary - --> precedence.rs:12:5 + --> $DIR/precedence.rs:12:5 | 12 | 1 ^ 1 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression: `1 ^ (1 - 1)` error: operator precedence can trip the unwary - --> precedence.rs:13:5 + --> $DIR/precedence.rs:13:5 | 13 | 3 | 2 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression: `3 | (2 - 1)` error: operator precedence can trip the unwary - --> precedence.rs:14:5 + --> $DIR/precedence.rs:14:5 | 14 | 3 & 5 - 2; | ^^^^^^^^^ help: consider parenthesizing your expression: `3 & (5 - 2)` error: unary minus has lower precedence than method call - --> precedence.rs:15:5 + --> $DIR/precedence.rs:15:5 | 15 | -1i32.abs(); | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1i32.abs())` error: unary minus has lower precedence than method call - --> precedence.rs:16:5 + --> $DIR/precedence.rs:16:5 | 16 | -1f32.abs(); | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1f32.abs())` error: aborting due to 9 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/print.rs b/tests/ui/print.rs similarity index 100% rename from clippy_tests/examples/print.rs rename to tests/ui/print.rs diff --git a/clippy_tests/examples/print.stderr b/tests/ui/print.stderr similarity index 82% rename from clippy_tests/examples/print.stderr rename to tests/ui/print.stderr index f8a62c4e7e63..789e1218b780 100644 --- a/clippy_tests/examples/print.stderr +++ b/tests/ui/print.stderr @@ -1,5 +1,5 @@ error: use of `Debug`-based formatting - --> print.rs:12:27 + --> $DIR/print.rs:12:27 | 12 | write!(f, "{:?}", 43.1415) | ^^^^^^^ @@ -7,7 +7,7 @@ error: use of `Debug`-based formatting = note: `-D use-debug` implied by `-D warnings` error: use of `println!` - --> print.rs:24:5 + --> $DIR/print.rs:24:5 | 24 | println!("Hello"); | ^^^^^^^^^^^^^^^^^^ @@ -15,42 +15,40 @@ error: use of `println!` = note: `-D print-stdout` implied by `-D warnings` error: use of `print!` - --> print.rs:25:5 + --> $DIR/print.rs:25:5 | 25 | print!("Hello"); | ^^^^^^^^^^^^^^^^ error: use of `print!` - --> print.rs:27:5 + --> $DIR/print.rs:27:5 | 27 | print!("Hello {}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `print!` - --> print.rs:29:5 + --> $DIR/print.rs:29:5 | 29 | print!("Hello {:?}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `Debug`-based formatting - --> print.rs:29:26 + --> $DIR/print.rs:29:26 | 29 | print!("Hello {:?}", "World"); | ^^^^^^^ error: use of `print!` - --> print.rs:31:5 + --> $DIR/print.rs:31:5 | 31 | print!("Hello {:#?}", "#orld"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `Debug`-based formatting - --> print.rs:31:27 + --> $DIR/print.rs:31:27 | 31 | print!("Hello {:#?}", "#orld"); | ^^^^^^^ error: aborting due to 8 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/print_with_newline.rs b/tests/ui/print_with_newline.rs similarity index 100% rename from clippy_tests/examples/print_with_newline.rs rename to tests/ui/print_with_newline.rs diff --git a/clippy_tests/examples/print_with_newline.stderr b/tests/ui/print_with_newline.stderr similarity index 68% rename from clippy_tests/examples/print_with_newline.stderr rename to tests/ui/print_with_newline.stderr index ff94150a5e6c..1bacc40bfb4f 100644 --- a/clippy_tests/examples/print_with_newline.stderr +++ b/tests/ui/print_with_newline.stderr @@ -1,30 +1,28 @@ error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> print_with_newline.rs:6:5 + --> $DIR/print_with_newline.rs:6:5 | -6 | print!("Hello\n"); +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 - --> print_with_newline.rs:7:5 + --> $DIR/print_with_newline.rs:7:5 | -7 | print!("Hello {}\n", "world"); +7 | print!("Hello {}/n", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> print_with_newline.rs:8:5 + --> $DIR/print_with_newline.rs:8:5 | -8 | print!("Hello {} {}\n\n", "world", "#2"); +8 | print!("Hello {} {}/n/n", "world", "#2"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> print_with_newline.rs:9:5 + --> $DIR/print_with_newline.rs:9:5 | -9 | print!("{}\n", 1265); +9 | print!("{}/n", 1265); | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/ptr_arg.rs b/tests/ui/ptr_arg.rs similarity index 100% rename from clippy_tests/examples/ptr_arg.rs rename to tests/ui/ptr_arg.rs diff --git a/clippy_tests/examples/ptr_arg.stderr b/tests/ui/ptr_arg.stderr similarity index 85% rename from clippy_tests/examples/ptr_arg.stderr rename to tests/ui/ptr_arg.stderr index a7a089ec12bb..bc5ca11155f1 100644 --- a/clippy_tests/examples/ptr_arg.stderr +++ b/tests/ui/ptr_arg.stderr @@ -1,5 +1,5 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. Consider changing the type to `&[...]` - --> ptr_arg.rs:6:14 + --> $DIR/ptr_arg.rs:6:14 | 6 | fn do_vec(x: &Vec) { | ^^^^^^^^^ @@ -7,18 +7,16 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and canno = 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` - --> ptr_arg.rs:14:14 + --> $DIR/ptr_arg.rs:14:14 | 14 | fn do_str(x: &String) { | ^^^^^^^ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. Consider changing the type to `&[...]` - --> ptr_arg.rs:27:18 + --> $DIR/ptr_arg.rs:27:18 | 27 | fn do_vec(x: &Vec); | ^^^^^^^^^ error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/range.rs b/tests/ui/range.rs similarity index 100% rename from clippy_tests/examples/range.rs rename to tests/ui/range.rs diff --git a/clippy_tests/examples/range.stderr b/tests/ui/range.stderr similarity index 84% rename from clippy_tests/examples/range.stderr rename to tests/ui/range.stderr index b6951b9f7130..772375c179b0 100644 --- a/clippy_tests/examples/range.stderr +++ b/tests/ui/range.stderr @@ -1,5 +1,5 @@ error: Iterator::step_by(0) will panic at runtime - --> range.rs:13:13 + --> $DIR/range.rs:13:13 | 13 | let _ = (0..1).step_by(0); | ^^^^^^^^^^^^^^^^^ @@ -7,25 +7,25 @@ error: Iterator::step_by(0) will panic at runtime = note: `-D iterator-step-by-zero` implied by `-D warnings` error: Iterator::step_by(0) will panic at runtime - --> range.rs:17:13 + --> $DIR/range.rs:17:13 | 17 | let _ = (1..).step_by(0); | ^^^^^^^^^^^^^^^^ error: Iterator::step_by(0) will panic at runtime - --> range.rs:18:13 + --> $DIR/range.rs:18:13 | 18 | let _ = (1...2).step_by(0); | ^^^^^^^^^^^^^^^^^^ error: Iterator::step_by(0) will panic at runtime - --> range.rs:21:13 + --> $DIR/range.rs:21:13 | 21 | let _ = x.step_by(0); | ^^^^^^^^^^^^ error: It is more idiomatic to use v1.iter().enumerate() - --> range.rs:29:14 + --> $DIR/range.rs:29:14 | 29 | let _x = v1.iter().zip(0..v1.len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,12 +33,10 @@ error: It is more idiomatic to use v1.iter().enumerate() = note: `-D range-zip-with-len` implied by `-D warnings` error: Iterator::step_by(0) will panic at runtime - --> range.rs:33:13 + --> $DIR/range.rs:33:13 | 33 | let _ = v1.iter().step_by(2/3); | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/redundant_closure_call.rs b/tests/ui/redundant_closure_call.rs similarity index 100% rename from clippy_tests/examples/redundant_closure_call.rs rename to tests/ui/redundant_closure_call.rs diff --git a/tests/ui/redundant_closure_call.stderr b/tests/ui/redundant_closure_call.stderr new file mode 100644 index 000000000000..599574a185e5 --- /dev/null +++ b/tests/ui/redundant_closure_call.stderr @@ -0,0 +1,34 @@ +error: Closure called just once immediately after it was declared + --> $DIR/redundant_closure_call.rs:15:2 + | +15 | \ti = closure(); + | \t^^^^^^^^^^^^^ + | + = note: `-D redundant-closure-call` implied by `-D warnings` + +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:14 + | +10 | \tlet mut 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/clippy_tests/examples/reference.rs b/tests/ui/reference.rs similarity index 100% rename from clippy_tests/examples/reference.rs rename to tests/ui/reference.rs diff --git a/clippy_tests/examples/reference.stderr b/tests/ui/reference.stderr similarity index 82% rename from clippy_tests/examples/reference.stderr rename to tests/ui/reference.stderr index 6e8bfedf4335..741c0cc10385 100644 --- a/clippy_tests/examples/reference.stderr +++ b/tests/ui/reference.stderr @@ -1,5 +1,5 @@ error: immediately dereferencing a reference - --> reference.rs:19:13 + --> $DIR/reference.rs:19:13 | 19 | let b = *&a; | ^^^ help: try this: `a` @@ -7,66 +7,64 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> reference.rs:21:13 + --> $DIR/reference.rs:21:13 | 21 | let b = *&get_number(); | ^^^^^^^^^^^^^^ help: try this: `get_number()` error: immediately dereferencing a reference - --> reference.rs:26:13 + --> $DIR/reference.rs:26:13 | 26 | let b = *&bytes[1..2][0]; | ^^^^^^^^^^^^^^^^ help: try this: `bytes[1..2][0]` error: immediately dereferencing a reference - --> reference.rs:30:13 + --> $DIR/reference.rs:30:13 | 30 | let b = *&(a); | ^^^^^ help: try this: `(a)` error: immediately dereferencing a reference - --> reference.rs:32:13 + --> $DIR/reference.rs:32:13 | 32 | let b = *(&a); | ^^^^^ help: try this: `a` error: immediately dereferencing a reference - --> reference.rs:34:13 + --> $DIR/reference.rs:34:13 | 34 | let b = *((&a)); | ^^^^^^^ help: try this: `a` error: immediately dereferencing a reference - --> reference.rs:36:13 + --> $DIR/reference.rs:36:13 | 36 | let b = *&&a; | ^^^^ help: try this: `&a` error: immediately dereferencing a reference - --> reference.rs:38:14 + --> $DIR/reference.rs:38:14 | 38 | let b = **&aref; | ^^^^^^ help: try this: `aref` error: immediately dereferencing a reference - --> reference.rs:42:14 + --> $DIR/reference.rs:42:14 | 42 | let b = **&&a; | ^^^^ help: try this: `&a` error: immediately dereferencing a reference - --> reference.rs:46:17 + --> $DIR/reference.rs:46:17 | 46 | let y = *&mut x; | ^^^^^^^ help: try this: `x` error: immediately dereferencing a reference - --> reference.rs:53:18 + --> $DIR/reference.rs:53:18 | 53 | let y = **&mut &mut x; | ^^^^^^^^^^^^ help: try this: `&mut x` error: aborting due to 11 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/regex.rs b/tests/ui/regex.rs similarity index 100% rename from clippy_tests/examples/regex.rs rename to tests/ui/regex.rs diff --git a/tests/ui/regex.stderr b/tests/ui/regex.stderr new file mode 100644 index 000000000000..1c3a47b82be7 --- /dev/null +++ b/tests/ui/regex.stderr @@ -0,0 +1,153 @@ +error: regex syntax error: empty alternate + --> $DIR/regex.rs:16:45 + | +16 | let pipe_in_wrong_position = Regex::new("|"); + | ^^^ + | + = note: `-D invalid-regex` implied by `-D warnings` + +error: regex syntax error: empty alternate + --> $DIR/regex.rs:17:60 + | +17 | let pipe_in_wrong_position_builder = RegexBuilder::new("|"); + | ^^^ + +error: regex syntax error: invalid character class range + --> $DIR/regex.rs:18:40 + | +18 | let wrong_char_ranice = Regex::new("[z-a]"); + | ^^^^^^^ + +error: regex syntax error: invalid character class range + --> $DIR/regex.rs:19:35 + | +19 | let some_unicode = Regex::new("[é-è]"); + | ^^^^^^^ + +error: regex syntax error on position 0: unclosed parenthesis + --> $DIR/regex.rs:21:33 + | +21 | let some_regex = Regex::new(OPENING_PAREN); + | ^^^^^^^^^^^^^ + +error: regex syntax error: empty alternate + --> $DIR/regex.rs:23:53 + | +23 | let binary_pipe_in_wrong_position = BRegex::new("|"); + | ^^^ + +error: regex syntax error on position 0: unclosed parenthesis + --> $DIR/regex.rs:24:41 + | +24 | let some_binary_regex = BRegex::new(OPENING_PAREN); + | ^^^^^^^^^^^^^ + +error: regex syntax error on position 0: unclosed parenthesis + --> $DIR/regex.rs:25:56 + | +25 | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN); + | ^^^^^^^^^^^^^ + +error: regex syntax error on position 0: unclosed parenthesis + --> $DIR/regex.rs:40:9 + | +40 | OPENING_PAREN, + | ^^^^^^^^^^^^^ + +error: regex syntax error on position 0: unclosed parenthesis + --> $DIR/regex.rs:44:9 + | +44 | OPENING_PAREN, + | ^^^^^^^^^^^^^ + +error: trivial regex + --> $DIR/regex.rs:50:33 + | +50 | let trivial_eq = Regex::new("^foobar$"); + | ^^^^^^^^^^ + | + = note: `-D trivial-regex` implied by `-D warnings` + = 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/clippy_tests/examples/serde.rs b/tests/ui/serde.rs similarity index 100% rename from clippy_tests/examples/serde.rs rename to tests/ui/serde.rs diff --git a/tests/ui/serde.stderr b/tests/ui/serde.stderr new file mode 100644 index 000000000000..58667e0f820b --- /dev/null +++ b/tests/ui/serde.stderr @@ -0,0 +1,14 @@ +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: `-D serde-api-misuse` implied by `-D warnings` + +error: aborting due to previous error + diff --git a/clippy_tests/examples/shadow.rs b/tests/ui/shadow.rs similarity index 100% rename from clippy_tests/examples/shadow.rs rename to tests/ui/shadow.rs diff --git a/clippy_tests/examples/shadow.stderr b/tests/ui/shadow.stderr similarity index 79% rename from clippy_tests/examples/shadow.stderr rename to tests/ui/shadow.stderr index ac5ec98ed144..9501fd68fcec 100644 --- a/clippy_tests/examples/shadow.stderr +++ b/tests/ui/shadow.stderr @@ -1,140 +1,138 @@ error: `x` is shadowed by itself in `&mut x` - --> shadow.rs:13:9 + --> $DIR/shadow.rs:13:9 | 13 | let x = &mut x; | ^^^^^^^^^^ | = note: `-D shadow-same` implied by `-D warnings` note: previous binding is here - --> shadow.rs:12:13 + --> $DIR/shadow.rs:12:13 | 12 | let mut x = 1; | ^ error: `x` is shadowed by itself in `{ x }` - --> shadow.rs:14:9 + --> $DIR/shadow.rs:14:9 | 14 | let x = { x }; | ^^^^^^^^^ | note: previous binding is here - --> shadow.rs:13:9 + --> $DIR/shadow.rs:13:9 | 13 | let x = &mut x; | ^ error: `x` is shadowed by itself in `(&*x)` - --> shadow.rs:15:9 + --> $DIR/shadow.rs:15:9 | 15 | let x = (&*x); | ^^^^^^^^^ | note: previous binding is here - --> shadow.rs:14:9 + --> $DIR/shadow.rs:14:9 | 14 | let x = { x }; | ^ error: `x` is shadowed by `{ *x + 1 }` which reuses the original value - --> shadow.rs:16:9 + --> $DIR/shadow.rs:16:9 | 16 | let x = { *x + 1 }; | ^ | = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> shadow.rs:16:13 + --> $DIR/shadow.rs:16:13 | 16 | let x = { *x + 1 }; | ^^^^^^^^^^ note: previous binding is here - --> shadow.rs:15:9 + --> $DIR/shadow.rs:15:9 | 15 | let x = (&*x); | ^ error: `x` is shadowed by `id(x)` which reuses the original value - --> shadow.rs:17:9 + --> $DIR/shadow.rs:17:9 | 17 | let x = id(x); | ^ | note: initialization happens here - --> shadow.rs:17:13 + --> $DIR/shadow.rs:17:13 | 17 | let x = id(x); | ^^^^^ note: previous binding is here - --> shadow.rs:16:9 + --> $DIR/shadow.rs:16:9 | 16 | let x = { *x + 1 }; | ^ error: `x` is shadowed by `(1, x)` which reuses the original value - --> shadow.rs:18:9 + --> $DIR/shadow.rs:18:9 | 18 | let x = (1, x); | ^ | note: initialization happens here - --> shadow.rs:18:13 + --> $DIR/shadow.rs:18:13 | 18 | let x = (1, x); | ^^^^^^ note: previous binding is here - --> shadow.rs:17:9 + --> $DIR/shadow.rs:17:9 | 17 | let x = id(x); | ^ error: `x` is shadowed by `first(x)` which reuses the original value - --> shadow.rs:19:9 + --> $DIR/shadow.rs:19:9 | 19 | let x = first(x); | ^ | note: initialization happens here - --> shadow.rs:19:13 + --> $DIR/shadow.rs:19:13 | 19 | let x = first(x); | ^^^^^^^^ note: previous binding is here - --> shadow.rs:18:9 + --> $DIR/shadow.rs:18:9 | 18 | let x = (1, x); | ^ error: `x` is shadowed by `y` - --> shadow.rs:21:9 + --> $DIR/shadow.rs:21:9 | 21 | let x = y; | ^ | = note: `-D shadow-unrelated` implied by `-D warnings` note: initialization happens here - --> shadow.rs:21:13 + --> $DIR/shadow.rs:21:13 | 21 | let x = y; | ^ note: previous binding is here - --> shadow.rs:19:9 + --> $DIR/shadow.rs:19:9 | 19 | let x = first(x); | ^ error: `x` shadows a previous declaration - --> shadow.rs:23:9 + --> $DIR/shadow.rs:23:9 | 23 | let x; | ^ | note: previous binding is here - --> shadow.rs:21:9 + --> $DIR/shadow.rs:21:9 | 21 | let x = y; | ^ error: aborting due to 9 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/short_circuit_statement.rs b/tests/ui/short_circuit_statement.rs similarity index 100% rename from clippy_tests/examples/short_circuit_statement.rs rename to tests/ui/short_circuit_statement.rs diff --git a/clippy_tests/examples/short_circuit_statement.stderr b/tests/ui/short_circuit_statement.stderr similarity index 80% rename from clippy_tests/examples/short_circuit_statement.stderr rename to tests/ui/short_circuit_statement.stderr index 74976bfdc27f..7697cbd1c64c 100644 --- a/clippy_tests/examples/short_circuit_statement.stderr +++ b/tests/ui/short_circuit_statement.stderr @@ -1,5 +1,5 @@ error: boolean short circuit operator in statement may be clearer using an explicit test - --> short_circuit_statement.rs:7:5 + --> $DIR/short_circuit_statement.rs:7:5 | 7 | f() && g(); | ^^^^^^^^^^^ help: replace it with: `if f() { g(); }` @@ -7,18 +7,16 @@ error: boolean short circuit operator in statement may be clearer using an expli = note: `-D short-circuit-statement` implied by `-D warnings` error: boolean short circuit operator in statement may be clearer using an explicit test - --> short_circuit_statement.rs:8:5 + --> $DIR/short_circuit_statement.rs:8:5 | 8 | f() || g(); | ^^^^^^^^^^^ help: replace it with: `if !f() { g(); }` error: boolean short circuit operator in statement may be clearer using an explicit test - --> short_circuit_statement.rs:9:5 + --> $DIR/short_circuit_statement.rs:9:5 | 9 | 1 == 2 || g(); | ^^^^^^^^^^^^^^ help: replace it with: `if !(1 == 2) { g(); }` error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/should_assert_eq.rs b/tests/ui/should_assert_eq.rs similarity index 100% rename from clippy_tests/examples/should_assert_eq.rs rename to tests/ui/should_assert_eq.rs diff --git a/clippy_tests/examples/should_assert_eq.stderr b/tests/ui/should_assert_eq.stderr similarity index 84% rename from clippy_tests/examples/should_assert_eq.stderr rename to tests/ui/should_assert_eq.stderr index 82d15fb757cc..57abf8004988 100644 --- a/clippy_tests/examples/should_assert_eq.stderr +++ b/tests/ui/should_assert_eq.stderr @@ -1,5 +1,5 @@ error: use `assert_eq` for better reporting - --> should_assert_eq.rs:14:5 + --> $DIR/should_assert_eq.rs:14:5 | 14 | assert!(1 == 2); | ^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: use `assert_eq` for better reporting = note: this error originates in a macro outside of the current crate error: use `assert_eq` for better reporting - --> should_assert_eq.rs:15:5 + --> $DIR/should_assert_eq.rs:15:5 | 15 | assert!(Debug(1) == Debug(2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ error: use `assert_eq` for better reporting = note: this error originates in a macro outside of the current crate error: use `assert_ne` for better reporting - --> should_assert_eq.rs:17:5 + --> $DIR/should_assert_eq.rs:17:5 | 17 | assert!(Debug(1) != Debug(2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -24,7 +24,7 @@ error: use `assert_ne` for better reporting = note: this error originates in a macro outside of the current crate error: use `debug_assert_eq` for better reporting - --> should_assert_eq.rs:22:5 + --> $DIR/should_assert_eq.rs:22:5 | 22 | debug_assert!(4 == 5); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ error: use `debug_assert_eq` for better reporting = note: this error originates in a macro outside of the current crate error: use `debug_assert_ne` for better reporting - --> should_assert_eq.rs:23:5 + --> $DIR/should_assert_eq.rs:23:5 | 23 | debug_assert!(4 != 6); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ error: use `debug_assert_ne` for better reporting = note: this error originates in a macro outside of the current crate error: use `assert_eq` for better reporting - --> should_assert_eq.rs:27:5 + --> $DIR/should_assert_eq.rs:27:5 | 27 | assert!(x == y); | ^^^^^^^^^^^^^^^^ @@ -48,7 +48,7 @@ error: use `assert_eq` for better reporting = note: this error originates in a macro outside of the current crate error: use `assert_ne` for better reporting - --> should_assert_eq.rs:30:5 + --> $DIR/should_assert_eq.rs:30:5 | 30 | assert!(x != y); | ^^^^^^^^^^^^^^^^ @@ -57,5 +57,3 @@ error: use `assert_ne` for better reporting error: aborting due to 7 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/strings.rs b/tests/ui/strings.rs similarity index 100% rename from clippy_tests/examples/strings.rs rename to tests/ui/strings.rs diff --git a/clippy_tests/examples/strings.stderr b/tests/ui/strings.stderr similarity index 87% rename from clippy_tests/examples/strings.stderr rename to tests/ui/strings.stderr index fd2d749f4ecb..d098ce9df5ea 100644 --- a/clippy_tests/examples/strings.stderr +++ b/tests/ui/strings.stderr @@ -1,5 +1,5 @@ error: manual implementation of an assign operation - --> strings.rs:10:9 + --> $DIR/strings.rs:10:9 | 10 | x = x + "."; | ^^^^^^^^^^^ help: replace it with: `x += "."` @@ -7,7 +7,7 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead - --> strings.rs:10:13 + --> $DIR/strings.rs:10:13 | 10 | x = x + "."; | ^^^^^^^ @@ -15,13 +15,13 @@ error: you added something to a string. Consider using `String::push_str()` inst = note: `-D string-add` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead - --> strings.rs:14:13 + --> $DIR/strings.rs:14:13 | 14 | let z = y + "..."; | ^^^^^^^^^ error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead - --> strings.rs:24:9 + --> $DIR/strings.rs:24:9 | 24 | x = x + "."; | ^^^^^^^^^^^ @@ -29,31 +29,31 @@ error: you assigned the result of adding something to this string. Consider usin = note: `-D string-add-assign` implied by `-D warnings` error: manual implementation of an assign operation - --> strings.rs:24:9 + --> $DIR/strings.rs:24:9 | 24 | x = x + "."; | ^^^^^^^^^^^ help: replace it with: `x += "."` error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead - --> strings.rs:38:9 + --> $DIR/strings.rs:38:9 | 38 | x = x + "."; | ^^^^^^^^^^^ error: manual implementation of an assign operation - --> strings.rs:38:9 + --> $DIR/strings.rs:38:9 | 38 | x = x + "."; | ^^^^^^^^^^^ help: replace it with: `x += "."` error: you added something to a string. Consider using `String::push_str()` instead - --> strings.rs:42:13 + --> $DIR/strings.rs:42:13 | 42 | let z = y + "..."; | ^^^^^^^^^ error: calling `as_bytes()` on a string literal - --> strings.rs:50:14 + --> $DIR/strings.rs:50:14 | 50 | let bs = "hello there".as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"hello there"` @@ -61,18 +61,16 @@ error: calling `as_bytes()` on a string literal = note: `-D string-lit-as-bytes` implied by `-D warnings` error: calling `as_bytes()` on a string literal - --> strings.rs:55:18 + --> $DIR/strings.rs:55:18 | 55 | let strify = stringify!(foobar).as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `bstringify!(foobar)` error: manual implementation of an assign operation - --> strings.rs:65:7 + --> $DIR/strings.rs:65:7 | 65 | ; x = x + 1; | ^^^^^^^^^ help: replace it with: `x += 1` error: aborting due to 11 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/stutter.rs b/tests/ui/stutter.rs similarity index 100% rename from clippy_tests/examples/stutter.rs rename to tests/ui/stutter.rs diff --git a/clippy_tests/examples/stutter.stderr b/tests/ui/stutter.stderr similarity index 80% rename from clippy_tests/examples/stutter.stderr rename to tests/ui/stutter.stderr index 1c97972abf29..b68f561b483c 100644 --- a/clippy_tests/examples/stutter.stderr +++ b/tests/ui/stutter.stderr @@ -1,5 +1,5 @@ error: item name starts with its containing module's name - --> stutter.rs:8:5 + --> $DIR/stutter.rs:8:5 | 8 | pub fn foo_bar() {} | ^^^^^^^^^^^^^^^^^^^ @@ -7,24 +7,22 @@ error: item name starts with its containing module's name = note: `-D stutter` implied by `-D warnings` error: item name ends with its containing module's name - --> stutter.rs:9:5 + --> $DIR/stutter.rs:9:5 | 9 | pub fn bar_foo() {} | ^^^^^^^^^^^^^^^^^^^ error: item name starts with its containing module's name - --> stutter.rs:10:5 + --> $DIR/stutter.rs:10:5 | 10 | pub struct FooCake {} | ^^^^^^^^^^^^^^^^^^^^^ error: item name ends with its containing module's name - --> stutter.rs:11:5 + --> $DIR/stutter.rs:11:5 | 11 | pub enum CakeFoo {} | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/swap.rs b/tests/ui/swap.rs similarity index 100% rename from clippy_tests/examples/swap.rs rename to tests/ui/swap.rs diff --git a/clippy_tests/examples/swap.stderr b/tests/ui/swap.stderr similarity index 90% rename from clippy_tests/examples/swap.stderr rename to tests/ui/swap.stderr index c2e05ddc8df1..a01ec375e639 100644 --- a/clippy_tests/examples/swap.stderr +++ b/tests/ui/swap.stderr @@ -1,5 +1,5 @@ error: this looks like you are swapping elements of `foo` manually - --> swap.rs:11:5 + --> $DIR/swap.rs:11:5 | 11 | / let temp = foo[0]; 12 | | foo[0] = foo[1]; @@ -9,7 +9,7 @@ error: this looks like you are swapping elements of `foo` manually = note: `-D manual-swap` implied by `-D warnings` error: this looks like you are swapping elements of `foo` manually - --> swap.rs:20:5 + --> $DIR/swap.rs:20:5 | 20 | / let temp = foo[0]; 21 | | foo[0] = foo[1]; @@ -17,7 +17,7 @@ error: this looks like you are swapping elements of `foo` manually | |_________________^ help: try: `foo.swap(0, 1)` error: this looks like you are swapping elements of `foo` manually - --> swap.rs:29:5 + --> $DIR/swap.rs:29:5 | 29 | / let temp = foo[0]; 30 | | foo[0] = foo[1]; @@ -25,7 +25,7 @@ error: this looks like you are swapping elements of `foo` manually | |_________________^ help: try: `foo.swap(0, 1)` error: this looks like you are swapping `a` and `b` manually - --> swap.rs:47:7 + --> $DIR/swap.rs:47:7 | 47 | ; let t = a; | _______^ @@ -36,7 +36,7 @@ error: this looks like you are swapping `a` and `b` manually = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping `c.0` and `a` manually - --> swap.rs:56:7 + --> $DIR/swap.rs:56:7 | 56 | ; let t = c.0; | _______^ @@ -47,7 +47,7 @@ error: this looks like you are swapping `c.0` and `a` manually = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `a` and `b` - --> swap.rs:44:5 + --> $DIR/swap.rs:44:5 | 44 | / a = b; 45 | | b = a; @@ -57,7 +57,7 @@ error: this looks like you are trying to swap `a` and `b` = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `c.0` and `a` - --> swap.rs:53:5 + --> $DIR/swap.rs:53:5 | 53 | / c.0 = a; 54 | | a = c.0; @@ -67,5 +67,3 @@ error: this looks like you are trying to swap `c.0` and `a` error: aborting due to 7 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/temporary_assignment.rs b/tests/ui/temporary_assignment.rs similarity index 100% rename from clippy_tests/examples/temporary_assignment.rs rename to tests/ui/temporary_assignment.rs diff --git a/clippy_tests/examples/temporary_assignment.stderr b/tests/ui/temporary_assignment.stderr similarity index 71% rename from clippy_tests/examples/temporary_assignment.stderr rename to tests/ui/temporary_assignment.stderr index 4c64afdddd12..979720c914d1 100644 --- a/clippy_tests/examples/temporary_assignment.stderr +++ b/tests/ui/temporary_assignment.stderr @@ -1,5 +1,5 @@ error: assignment to temporary - --> temporary_assignment.rs:29:5 + --> $DIR/temporary_assignment.rs:29:5 | 29 | Struct { field: 0 }.field = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,12 +7,10 @@ error: assignment to temporary = note: `-D temporary-assignment` implied by `-D warnings` error: assignment to temporary - --> temporary_assignment.rs:30:5 + --> $DIR/temporary_assignment.rs:30:5 | 30 | (0, 0).0 = 1; | ^^^^^^^^^^^^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/toplevel_ref_arg.rs b/tests/ui/toplevel_ref_arg.rs similarity index 100% rename from clippy_tests/examples/toplevel_ref_arg.rs rename to tests/ui/toplevel_ref_arg.rs diff --git a/clippy_tests/examples/toplevel_ref_arg.stderr b/tests/ui/toplevel_ref_arg.stderr similarity index 83% rename from clippy_tests/examples/toplevel_ref_arg.stderr rename to tests/ui/toplevel_ref_arg.stderr index 59cb6448b4eb..f360e85329f5 100644 --- a/clippy_tests/examples/toplevel_ref_arg.stderr +++ b/tests/ui/toplevel_ref_arg.stderr @@ -1,5 +1,5 @@ error: `ref` directly on a function argument is ignored. Consider using a reference type instead. - --> toplevel_ref_arg.rs:7:15 + --> $DIR/toplevel_ref_arg.rs:7:15 | 7 | fn the_answer(ref mut x: u8) { | ^^^^^^^^^ @@ -7,30 +7,28 @@ error: `ref` directly on a function argument is ignored. Consider using a refere = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> toplevel_ref_arg.rs:18:7 + --> $DIR/toplevel_ref_arg.rs:18:7 | 18 | let ref x = 1; | ----^^^^^----- help: try: `let x = &1;` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> toplevel_ref_arg.rs:20:7 + --> $DIR/toplevel_ref_arg.rs:20:7 | 20 | let ref y: (&_, u8) = (&1, 2); | ----^^^^^--------------------- help: try: `let y: &(&_, u8) = &(&1, 2);` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> toplevel_ref_arg.rs:22:7 + --> $DIR/toplevel_ref_arg.rs:22:7 | 22 | let ref z = 1 + 2; | ----^^^^^--------- help: try: `let z = &(1 + 2);` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> toplevel_ref_arg.rs:24:7 + --> $DIR/toplevel_ref_arg.rs:24:7 | 24 | let ref mut z = 1 + 2; | ----^^^^^^^^^--------- help: try: `let z = &mut (1 + 2);` error: aborting due to 5 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/trailing_zeros.rs b/tests/ui/trailing_zeros.rs similarity index 100% rename from clippy_tests/examples/trailing_zeros.rs rename to tests/ui/trailing_zeros.rs diff --git a/clippy_tests/examples/trailing_zeros.stderr b/tests/ui/trailing_zeros.stderr similarity index 83% rename from clippy_tests/examples/trailing_zeros.stderr rename to tests/ui/trailing_zeros.stderr index 1b0ebf7d3c85..5a8de3bcc879 100644 --- a/clippy_tests/examples/trailing_zeros.stderr +++ b/tests/ui/trailing_zeros.stderr @@ -1,5 +1,5 @@ error: bit mask could be simplified with a call to `trailing_zeros` - --> trailing_zeros.rs:7:31 + --> $DIR/trailing_zeros.rs:7:31 | 7 | let _ = #[clippy(author)] (x & 0b1111 == 0); // suggest trailing_zeros | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() > 4` @@ -7,12 +7,10 @@ error: bit mask could be simplified with a call to `trailing_zeros` = note: `-D verbose-bit-mask` implied by `-D warnings` error: bit mask could be simplified with a call to `trailing_zeros` - --> trailing_zeros.rs:8:13 + --> $DIR/trailing_zeros.rs:8:13 | 8 | let _ = x & 0b1_1111 == 0; // suggest trailing_zeros | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() > 5` error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/trailing_zeros.stdout b/tests/ui/trailing_zeros.stdout similarity index 100% rename from clippy_tests/examples/trailing_zeros.stdout rename to tests/ui/trailing_zeros.stdout diff --git a/tests/ui/transmute.stderr b/tests/ui/transmute.stderr index 7a1e4e867202..a571fed24f05 100644 --- a/tests/ui/transmute.stderr +++ b/tests/ui/transmute.stderr @@ -1,156 +1,158 @@ -warning: transmute from a type (`&'a T`) to itself +error: transmute from a type (`&'a T`) to itself --> $DIR/transmute.rs:22:20 | 22 | let _: &'a T = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[warn(useless_transmute)] on by default + = note: `-D useless-transmute` implied by `-D warnings` -warning: transmute from a reference to a pointer +error: 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` -warning: transmute from a reference to a pointer +error: 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` -warning: transmute from a reference to a pointer +error: 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` -warning: transmute from a pointer type (`*const T`) to a reference type (`&T`) +error: 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: #[warn(transmute_ptr_to_ref)] on by default + = note: `-D transmute-ptr-to-ref` implied by `-D warnings` -warning: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) +error: 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` -warning: transmute from a pointer type (`*mut T`) to a reference type (`&T`) +error: 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` -warning: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) +error: 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)` -warning: transmute from a pointer type (`*const U`) to a reference type (`&T`) +error: 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)` -warning: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`) +error: 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)` -warning: transmute from a pointer type (`*mut U`) to a reference type (`&T`) +error: 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)` -warning: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`) +error: 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<_>)` -warning: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`) +error: 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<&_>)` -warning: transmute from a pointer type (`*const i32`) to a reference type (`&u8`) +error: 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)` -warning: transmute from a type (`std::vec::Vec`) to itself +error: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:76:27 | 76 | let _: Vec = core::intrinsics::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: transmute from a type (`std::vec::Vec`) to itself +error: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:78:27 | 78 | let _: Vec = core::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: transmute from a type (`std::vec::Vec`) to itself +error: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:80:27 | 80 | let _: Vec = std::intrinsics::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: transmute from a type (`std::vec::Vec`) to itself +error: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:82:27 | 82 | let _: Vec = std::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: transmute from a type (`std::vec::Vec`) to itself +error: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:84:27 | 84 | let _: Vec = my_transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^ -warning: transmute from an integer to a pointer +error: 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` -warning: transmute from an integer to a pointer +error: 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` -warning: transmute from a type (`*const Usize`) to the type that it points to (`Usize`) +error: 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: #[warn(crosspointer_transmute)] on by default + = note: `-D crosspointer-transmute` implied by `-D warnings` -warning: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`) +error: 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); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`) +error: 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()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`) +error: 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 + diff --git a/tests/ui/transmute_64bit.stderr b/tests/ui/transmute_64bit.stderr index 595696180457..3a6a6e73f575 100644 --- a/tests/ui/transmute_64bit.stderr +++ b/tests/ui/transmute_64bit.stderr @@ -1,14 +1,16 @@ -warning: transmute from a `f64` to a pointer +error: transmute from a `f64` to a pointer --> $DIR/transmute_64bit.rs:9:31 | 9 | let _: *const usize = std::mem::transmute(6.0f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[warn(wrong_transmute)] on by default + = note: `-D wrong-transmute` implied by `-D warnings` -warning: transmute from a `f64` to a pointer +error: 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 + diff --git a/clippy_tests/examples/unicode.rs b/tests/ui/unicode.rs similarity index 100% rename from clippy_tests/examples/unicode.rs rename to tests/ui/unicode.rs diff --git a/clippy_tests/examples/unicode.stderr b/tests/ui/unicode.stderr similarity index 77% rename from clippy_tests/examples/unicode.stderr rename to tests/ui/unicode.stderr index 3d8841a3d38c..8a173daec9da 100644 --- a/clippy_tests/examples/unicode.stderr +++ b/tests/ui/unicode.stderr @@ -1,15 +1,15 @@ error: zero-width space detected - --> unicode.rs:6:12 + --> $DIR/unicode.rs:6:12 | 6 | print!("Here >​< is a ZWS, and ​another"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = 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 - --> unicode.rs:12:12 + --> $DIR/unicode.rs:12:12 | 12 | print!("̀àh?"); | ^^^^^^^ @@ -19,16 +19,14 @@ error: non-nfc unicode sequence detected ""̀àh?"" error: literal non-ASCII character detected - --> unicode.rs:18:12 + --> $DIR/unicode.rs:18:12 | 18 | print!("Üben!"); | ^^^^^^^ | = 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 - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/unit_cmp.rs b/tests/ui/unit_cmp.rs similarity index 100% rename from clippy_tests/examples/unit_cmp.rs rename to tests/ui/unit_cmp.rs diff --git a/clippy_tests/examples/unit_cmp.stderr b/tests/ui/unit_cmp.stderr similarity index 79% rename from clippy_tests/examples/unit_cmp.stderr rename to tests/ui/unit_cmp.stderr index 9c9f5fc00967..51ad3fca9479 100644 --- a/clippy_tests/examples/unit_cmp.stderr +++ b/tests/ui/unit_cmp.stderr @@ -1,5 +1,5 @@ error: ==-comparison of unit values detected. This will always be true - --> unit_cmp.rs:16:8 + --> $DIR/unit_cmp.rs:16:8 | 16 | if { true; } == { false; } { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,12 +7,10 @@ error: ==-comparison of unit values detected. This will always be true = note: `-D unit-cmp` implied by `-D warnings` error: >-comparison of unit values detected. This will always be false - --> unit_cmp.rs:19:8 + --> $DIR/unit_cmp.rs:19:8 | 19 | if { true; } > { false; } { | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/unneeded_field_pattern.rs b/tests/ui/unneeded_field_pattern.rs similarity index 100% rename from clippy_tests/examples/unneeded_field_pattern.rs rename to tests/ui/unneeded_field_pattern.rs diff --git a/clippy_tests/examples/unneeded_field_pattern.stderr b/tests/ui/unneeded_field_pattern.stderr similarity index 80% rename from clippy_tests/examples/unneeded_field_pattern.stderr rename to tests/ui/unneeded_field_pattern.stderr index b6155853ec62..7e4c3a6cb9cb 100644 --- a/clippy_tests/examples/unneeded_field_pattern.stderr +++ b/tests/ui/unneeded_field_pattern.stderr @@ -1,5 +1,5 @@ error: You matched a field with a wildcard pattern. Consider using `..` instead - --> unneeded_field_pattern.rs:17:15 + --> $DIR/unneeded_field_pattern.rs:17:15 | 17 | Foo { a: _, b: 0, .. } => {} | ^^^^ @@ -8,7 +8,7 @@ error: You matched a field with a wildcard pattern. Consider using `..` instead = help: Try with `Foo { b: 0, .. }` error: All the struct fields are matched to a wildcard pattern, consider using `..`. - --> unneeded_field_pattern.rs:19:9 + --> $DIR/unneeded_field_pattern.rs:19:9 | 19 | Foo { a: _, b: _, c: _ } => {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,5 +17,3 @@ error: All the struct fields are matched to a wildcard pattern, consider using ` error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/unreadable_literal.rs b/tests/ui/unreadable_literal.rs similarity index 100% rename from clippy_tests/examples/unreadable_literal.rs rename to tests/ui/unreadable_literal.rs diff --git a/clippy_tests/examples/unreadable_literal.stderr b/tests/ui/unreadable_literal.stderr similarity index 84% rename from clippy_tests/examples/unreadable_literal.stderr rename to tests/ui/unreadable_literal.stderr index e4c110915d0a..72cb160fafcb 100644 --- a/clippy_tests/examples/unreadable_literal.stderr +++ b/tests/ui/unreadable_literal.stderr @@ -1,5 +1,5 @@ error: long literal lacking separators - --> unreadable_literal.rs:7:16 + --> $DIR/unreadable_literal.rs:7:16 | 7 | let bad = (0b10110_i64, 0x12345678901_usize, 12345_f32, 1.23456_f32); | ^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: long literal lacking separators = help: consider: 0b1_0110_i64 error: long literal lacking separators - --> unreadable_literal.rs:7:29 + --> $DIR/unreadable_literal.rs:7:29 | 7 | let bad = (0b10110_i64, 0x12345678901_usize, 12345_f32, 1.23456_f32); | ^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ error: long literal lacking separators = help: consider: 0x123_4567_8901_usize error: long literal lacking separators - --> unreadable_literal.rs:7:50 + --> $DIR/unreadable_literal.rs:7:50 | 7 | let bad = (0b10110_i64, 0x12345678901_usize, 12345_f32, 1.23456_f32); | ^^^^^^^^^ @@ -24,7 +24,7 @@ error: long literal lacking separators = help: consider: 12_345_f32 error: long literal lacking separators - --> unreadable_literal.rs:7:61 + --> $DIR/unreadable_literal.rs:7:61 | 7 | let bad = (0b10110_i64, 0x12345678901_usize, 12345_f32, 1.23456_f32); | ^^^^^^^^^^^ @@ -33,5 +33,3 @@ error: long literal lacking separators error: aborting due to 4 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/unsafe_removed_from_name.rs b/tests/ui/unsafe_removed_from_name.rs similarity index 100% rename from clippy_tests/examples/unsafe_removed_from_name.rs rename to tests/ui/unsafe_removed_from_name.rs diff --git a/clippy_tests/examples/unsafe_removed_from_name.stderr b/tests/ui/unsafe_removed_from_name.stderr similarity index 81% rename from clippy_tests/examples/unsafe_removed_from_name.stderr rename to tests/ui/unsafe_removed_from_name.stderr index 021af9ccc50c..93f2ddd533fe 100644 --- a/clippy_tests/examples/unsafe_removed_from_name.stderr +++ b/tests/ui/unsafe_removed_from_name.stderr @@ -1,5 +1,5 @@ error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCell` - --> unsafe_removed_from_name.rs:7:1 + --> $DIR/unsafe_removed_from_name.rs:7:1 | 7 | use std::cell::{UnsafeCell as TotallySafeCell}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,18 +7,16 @@ error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCell = note: `-D unsafe-removed-from-name` implied by `-D warnings` error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCellAgain` - --> unsafe_removed_from_name.rs:9:1 + --> $DIR/unsafe_removed_from_name.rs:9:1 | 9 | use std::cell::UnsafeCell as TotallySafeCellAgain; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: removed "unsafe" from the name of `Unsafe` in use as `LieAboutModSafety` - --> unsafe_removed_from_name.rs:23:1 + --> $DIR/unsafe_removed_from_name.rs:23:1 | 23 | use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/unused_io_amount.rs b/tests/ui/unused_io_amount.rs similarity index 100% rename from clippy_tests/examples/unused_io_amount.rs rename to tests/ui/unused_io_amount.rs diff --git a/clippy_tests/examples/unused_io_amount.stderr b/tests/ui/unused_io_amount.stderr similarity index 82% rename from clippy_tests/examples/unused_io_amount.stderr rename to tests/ui/unused_io_amount.stderr index bef5e7b008d6..0ce6887f5f20 100644 --- a/clippy_tests/examples/unused_io_amount.stderr +++ b/tests/ui/unused_io_amount.stderr @@ -1,5 +1,5 @@ error: handle written amount returned or use `Write::write_all` instead - --> unused_io_amount.rs:11:5 + --> $DIR/unused_io_amount.rs:11:5 | 11 | try!(s.write(b"test")); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: handle written amount returned or use `Write::write_all` instead = note: this error originates in a macro outside of the current crate error: handle read amount returned or use `Read::read_exact` instead - --> unused_io_amount.rs:13:5 + --> $DIR/unused_io_amount.rs:13:5 | 13 | try!(s.read(&mut buf)); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,30 +16,28 @@ error: handle read amount returned or use `Read::read_exact` instead = note: this error originates in a macro outside of the current crate error: handle written amount returned or use `Write::write_all` instead - --> unused_io_amount.rs:18:5 + --> $DIR/unused_io_amount.rs:18:5 | 18 | s.write(b"test")?; | ^^^^^^^^^^^^^^^^^ error: handle read amount returned or use `Read::read_exact` instead - --> unused_io_amount.rs:20:5 + --> $DIR/unused_io_amount.rs:20:5 | 20 | s.read(&mut buf)?; | ^^^^^^^^^^^^^^^^^ error: handle written amount returned or use `Write::write_all` instead - --> unused_io_amount.rs:25:5 + --> $DIR/unused_io_amount.rs:25:5 | 25 | s.write(b"test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: handle read amount returned or use `Read::read_exact` instead - --> unused_io_amount.rs:27:5 + --> $DIR/unused_io_amount.rs:27:5 | 27 | s.read(&mut buf).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/unused_labels.rs b/tests/ui/unused_labels.rs similarity index 100% rename from clippy_tests/examples/unused_labels.rs rename to tests/ui/unused_labels.rs diff --git a/clippy_tests/examples/unused_labels.stderr b/tests/ui/unused_labels.stderr similarity index 77% rename from clippy_tests/examples/unused_labels.stderr rename to tests/ui/unused_labels.stderr index 0124ad570d99..19c91e2a6a3c 100644 --- a/clippy_tests/examples/unused_labels.stderr +++ b/tests/ui/unused_labels.stderr @@ -1,5 +1,5 @@ error: unused label `'label` - --> unused_labels.rs:8:5 + --> $DIR/unused_labels.rs:8:5 | 8 | / 'label: for i in 1..2 { 9 | | if i > 4 { continue } @@ -9,13 +9,13 @@ error: unused label `'label` = note: `-D unused-label` implied by `-D warnings` error: unused label `'a` - --> unused_labels.rs:21:5 + --> $DIR/unused_labels.rs:21:5 | 21 | 'a: loop { break } | ^^^^^^^^^^^^^^^^^^ error: unused label `'same_label_in_two_fns` - --> unused_labels.rs:32:5 + --> $DIR/unused_labels.rs:32:5 | 32 | / 'same_label_in_two_fns: loop { 33 | | let _ = 1; @@ -24,5 +24,3 @@ error: unused label `'same_label_in_two_fns` error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/unused_lt.rs b/tests/ui/unused_lt.rs similarity index 100% rename from clippy_tests/examples/unused_lt.rs rename to tests/ui/unused_lt.rs diff --git a/clippy_tests/examples/unused_lt.stderr b/tests/ui/unused_lt.stderr similarity index 78% rename from clippy_tests/examples/unused_lt.stderr rename to tests/ui/unused_lt.stderr index a71904a8af4b..b1fcebe6eed5 100644 --- a/clippy_tests/examples/unused_lt.stderr +++ b/tests/ui/unused_lt.stderr @@ -1,5 +1,5 @@ error: this lifetime isn't used in the function definition - --> unused_lt.rs:16:14 + --> $DIR/unused_lt.rs:16:14 | 16 | fn unused_lt<'a>(x: u8) { | ^^ @@ -7,18 +7,16 @@ error: this lifetime isn't used in the function definition = note: `-D unused-lifetimes` implied by `-D warnings` error: this lifetime isn't used in the function definition - --> unused_lt.rs:20:25 + --> $DIR/unused_lt.rs:20:25 | 20 | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) { | ^^ error: this lifetime isn't used in the function definition - --> unused_lt.rs:50:10 + --> $DIR/unused_lt.rs:50:10 | 50 | fn x<'a>(&self) {} | ^^ error: aborting due to 3 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/used_underscore_binding.rs b/tests/ui/used_underscore_binding.rs similarity index 100% rename from clippy_tests/examples/used_underscore_binding.rs rename to tests/ui/used_underscore_binding.rs diff --git a/clippy_tests/examples/used_underscore_binding.stderr b/tests/ui/used_underscore_binding.stderr similarity index 81% rename from clippy_tests/examples/used_underscore_binding.stderr rename to tests/ui/used_underscore_binding.stderr index 4b2783496744..712f81c1b6ff 100644 --- a/clippy_tests/examples/used_underscore_binding.stderr +++ b/tests/ui/used_underscore_binding.stderr @@ -1,5 +1,5 @@ error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> used_underscore_binding.rs:17:5 + --> $DIR/used_underscore_binding.rs:17:5 | 17 | _foo + 1 | ^^^^ @@ -7,30 +7,28 @@ error: used binding `_foo` which is prefixed with an underscore. A leading under = 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. - --> used_underscore_binding.rs:22:20 + --> $DIR/used_underscore_binding.rs:22:20 | 22 | println!("{}", _foo); | ^^^^ error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> used_underscore_binding.rs:23:16 + --> $DIR/used_underscore_binding.rs:23:16 | 23 | assert_eq!(_foo, _foo); | ^^^^ error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> used_underscore_binding.rs:23:22 + --> $DIR/used_underscore_binding.rs:23:22 | 23 | assert_eq!(_foo, _foo); | ^^^^ error: used binding `_underscore_field` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> used_underscore_binding.rs:36:5 + --> $DIR/used_underscore_binding.rs:36:5 | 36 | s._underscore_field += 1; | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/useless_attribute.rs b/tests/ui/useless_attribute.rs similarity index 100% rename from clippy_tests/examples/useless_attribute.rs rename to tests/ui/useless_attribute.rs diff --git a/tests/ui/useless_attribute.stderr b/tests/ui/useless_attribute.stderr new file mode 100644 index 000000000000..6d990ccf05b7 --- /dev/null +++ b/tests/ui/useless_attribute.stderr @@ -0,0 +1,10 @@ +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: `-D useless-attribute` implied by `-D warnings` + +error: aborting due to previous error + diff --git a/clippy_tests/examples/vec.rs b/tests/ui/vec.rs similarity index 100% rename from clippy_tests/examples/vec.rs rename to tests/ui/vec.rs diff --git a/clippy_tests/examples/vec.stderr b/tests/ui/vec.stderr similarity index 85% rename from clippy_tests/examples/vec.stderr rename to tests/ui/vec.stderr index 968e2ad8d447..6a47eb5b064e 100644 --- a/clippy_tests/examples/vec.stderr +++ b/tests/ui/vec.stderr @@ -1,5 +1,5 @@ error: useless use of `vec!` - --> vec.rs:24:14 + --> $DIR/vec.rs:24:14 | 24 | on_slice(&vec![]); | ^^^^^^^ help: you can use a slice directly: `&[]` @@ -7,36 +7,34 @@ error: useless use of `vec!` = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> vec.rs:27:14 + --> $DIR/vec.rs:27:14 | 27 | on_slice(&vec![1, 2]); | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` - --> vec.rs:30:14 + --> $DIR/vec.rs:30:14 | 30 | on_slice(&vec ![1, 2]); | ^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` - --> vec.rs:33:14 + --> $DIR/vec.rs:33:14 | 33 | on_slice(&vec!(1, 2)); | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` - --> vec.rs:36:14 + --> $DIR/vec.rs:36:14 | 36 | on_slice(&vec![1; 2]); | ^^^^^^^^^^^ help: you can use a slice directly: `&[1; 2]` error: useless use of `vec!` - --> vec.rs:49:14 + --> $DIR/vec.rs:49:14 | 49 | for a in vec![1, 2, 3] { | ^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2, 3]` error: aborting due to 6 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/while_loop.rs b/tests/ui/while_loop.rs similarity index 100% rename from clippy_tests/examples/while_loop.rs rename to tests/ui/while_loop.rs diff --git a/clippy_tests/examples/while_loop.stderr b/tests/ui/while_loop.stderr similarity index 90% rename from clippy_tests/examples/while_loop.stderr rename to tests/ui/while_loop.stderr index f84b55267290..7abdefe881b1 100644 --- a/clippy_tests/examples/while_loop.stderr +++ b/tests/ui/while_loop.stderr @@ -1,5 +1,5 @@ error: this loop could be written as a `while let` loop - --> while_loop.rs:9:5 + --> $DIR/while_loop.rs:9:5 | 9 | / loop { 10 | | if let Some(_x) = y { @@ -13,7 +13,7 @@ error: this loop could be written as a `while let` loop = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> while_loop.rs:22:5 + --> $DIR/while_loop.rs:22:5 | 22 | / loop { 23 | | match y { @@ -24,7 +24,7 @@ error: this loop could be written as a `while let` loop | |_____^ help: try: `while let Some(_x) = y { .. }` error: this loop could be written as a `while let` loop - --> while_loop.rs:28:5 + --> $DIR/while_loop.rs:28:5 | 28 | / loop { 29 | | let x = match y { @@ -36,7 +36,7 @@ error: this loop could be written as a `while let` loop | |_____^ help: try: `while let Some(x) = y { .. }` error: this loop could be written as a `while let` loop - --> while_loop.rs:36:5 + --> $DIR/while_loop.rs:36:5 | 36 | / loop { 37 | | let x = match y { @@ -48,7 +48,7 @@ error: this loop could be written as a `while let` loop | |_____^ help: try: `while let Some(x) = y { .. }` error: this loop could be written as a `while let` loop - --> while_loop.rs:58:5 + --> $DIR/while_loop.rs:58:5 | 58 | / loop { 59 | | let (e, l) = match "".split_whitespace().next() { @@ -60,7 +60,7 @@ error: this loop could be written as a `while let` loop | |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }` error: this loop could be written as a `for` loop - --> while_loop.rs:68:5 + --> $DIR/while_loop.rs:68:5 | 68 | / while let Option::Some(x) = iter.next() { 69 | | println!("{}", x); @@ -70,7 +70,7 @@ error: this loop could be written as a `for` loop = note: `-D while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `for` loop - --> while_loop.rs:73:5 + --> $DIR/while_loop.rs:73:5 | 73 | / while let Some(x) = iter.next() { 74 | | println!("{}", x); @@ -78,13 +78,13 @@ error: this loop could be written as a `for` loop | |_____^ help: try: `for x in iter { .. }` error: this loop could be written as a `for` loop - --> while_loop.rs:78:5 + --> $DIR/while_loop.rs:78:5 | 78 | while let Some(_) = iter.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in iter { .. }` error: this loop could be written as a `while let` loop - --> while_loop.rs:118:5 + --> $DIR/while_loop.rs:118:5 | 118 | / loop { 119 | | let _ = match iter.next() { @@ -96,7 +96,7 @@ error: this loop could be written as a `while let` loop | |_____^ help: try: `while let Some(ele) = iter.next() { .. }` error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body. - --> while_loop.rs:123:9 + --> $DIR/while_loop.rs:123:9 | 123 | loop {} | ^^^^^^^ @@ -105,5 +105,3 @@ error: empty `loop {}` detected. You may want to either use `panic!()` or add `s error: aborting due to 10 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/wrong_self_convention.rs b/tests/ui/wrong_self_convention.rs similarity index 100% rename from clippy_tests/examples/wrong_self_convention.rs rename to tests/ui/wrong_self_convention.rs diff --git a/clippy_tests/examples/wrong_self_convention.stderr b/tests/ui/wrong_self_convention.stderr similarity index 80% rename from clippy_tests/examples/wrong_self_convention.stderr rename to tests/ui/wrong_self_convention.stderr index d13c22f6477e..216fd0bb82b8 100644 --- a/clippy_tests/examples/wrong_self_convention.stderr +++ b/tests/ui/wrong_self_convention.stderr @@ -1,5 +1,5 @@ error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> wrong_self_convention.rs:21:17 + --> $DIR/wrong_self_convention.rs:21:17 | 21 | fn from_i32(self) {} | ^^^^ @@ -7,72 +7,70 @@ error: methods called `from_*` usually take no self; consider choosing a less am = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> wrong_self_convention.rs:27:21 + --> $DIR/wrong_self_convention.rs:27:21 | 27 | pub fn from_i64(self) {} | ^^^^ error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name - --> wrong_self_convention.rs:40:15 + --> $DIR/wrong_self_convention.rs:40:15 | 40 | fn as_i32(self) {} | ^^^^ error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> wrong_self_convention.rs:42:17 + --> $DIR/wrong_self_convention.rs:42:17 | 42 | fn into_i32(&self) {} | ^^^^^ error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name - --> wrong_self_convention.rs:44:15 + --> $DIR/wrong_self_convention.rs:44:15 | 44 | fn is_i32(self) {} | ^^^^ error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> wrong_self_convention.rs:46:15 + --> $DIR/wrong_self_convention.rs:46:15 | 46 | fn to_i32(self) {} | ^^^^ error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> wrong_self_convention.rs:48:17 + --> $DIR/wrong_self_convention.rs:48:17 | 48 | fn from_i32(self) {} | ^^^^ error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name - --> wrong_self_convention.rs:50:19 + --> $DIR/wrong_self_convention.rs:50:19 | 50 | pub fn as_i64(self) {} | ^^^^ error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> wrong_self_convention.rs:51:21 + --> $DIR/wrong_self_convention.rs:51:21 | 51 | pub fn into_i64(&self) {} | ^^^^^ error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name - --> wrong_self_convention.rs:52:19 + --> $DIR/wrong_self_convention.rs:52:19 | 52 | pub fn is_i64(self) {} | ^^^^ error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> wrong_self_convention.rs:53:19 + --> $DIR/wrong_self_convention.rs:53:19 | 53 | pub fn to_i64(self) {} | ^^^^ error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> wrong_self_convention.rs:54:21 + --> $DIR/wrong_self_convention.rs:54:21 | 54 | pub fn from_i64(self) {} | ^^^^ error: aborting due to 12 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/zero_div_zero.rs b/tests/ui/zero_div_zero.rs similarity index 100% rename from clippy_tests/examples/zero_div_zero.rs rename to tests/ui/zero_div_zero.rs diff --git a/clippy_tests/examples/zero_div_zero.stderr b/tests/ui/zero_div_zero.stderr similarity index 85% rename from clippy_tests/examples/zero_div_zero.stderr rename to tests/ui/zero_div_zero.stderr index 3a291bb2f003..b81e59c07f15 100644 --- a/clippy_tests/examples/zero_div_zero.stderr +++ b/tests/ui/zero_div_zero.stderr @@ -1,5 +1,5 @@ error: equal expressions as operands to `/` - --> zero_div_zero.rs:7:15 + --> $DIR/zero_div_zero.rs:7:15 | 7 | let nan = 0.0 / 0.0; | ^^^^^^^^^ @@ -7,7 +7,7 @@ error: equal expressions as operands to `/` = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> zero_div_zero.rs:7:15 + --> $DIR/zero_div_zero.rs:7:15 | 7 | let nan = 0.0 / 0.0; | ^^^^^^^^^ @@ -16,13 +16,13 @@ error: constant division of 0.0 with 0.0 will always result in NaN = help: Consider using `std::f32::NAN` if you would like a constant representing NaN error: equal expressions as operands to `/` - --> zero_div_zero.rs:8:19 + --> $DIR/zero_div_zero.rs:8:19 | 8 | let f64_nan = 0.0 / 0.0f64; | ^^^^^^^^^^^^ error: constant division of 0.0 with 0.0 will always result in NaN - --> zero_div_zero.rs:8:19 + --> $DIR/zero_div_zero.rs:8:19 | 8 | let f64_nan = 0.0 / 0.0f64; | ^^^^^^^^^^^^ @@ -30,13 +30,13 @@ error: constant division of 0.0 with 0.0 will always result in NaN = help: Consider using `std::f64::NAN` if you would like a constant representing NaN error: equal expressions as operands to `/` - --> zero_div_zero.rs:9:25 + --> $DIR/zero_div_zero.rs:9:25 | 9 | let other_f64_nan = 0.0f64 / 0.0; | ^^^^^^^^^^^^ error: constant division of 0.0 with 0.0 will always result in NaN - --> zero_div_zero.rs:9:25 + --> $DIR/zero_div_zero.rs:9:25 | 9 | let other_f64_nan = 0.0f64 / 0.0; | ^^^^^^^^^^^^ @@ -44,13 +44,13 @@ error: constant division of 0.0 with 0.0 will always result in NaN = help: Consider using `std::f64::NAN` if you would like a constant representing NaN error: equal expressions as operands to `/` - --> zero_div_zero.rs:10:28 + --> $DIR/zero_div_zero.rs:10:28 | 10 | let one_more_f64_nan = 0.0f64/0.0f64; | ^^^^^^^^^^^^^ error: constant division of 0.0 with 0.0 will always result in NaN - --> zero_div_zero.rs:10:28 + --> $DIR/zero_div_zero.rs:10:28 | 10 | let one_more_f64_nan = 0.0f64/0.0f64; | ^^^^^^^^^^^^^ @@ -59,5 +59,3 @@ error: constant division of 0.0 with 0.0 will always result in NaN error: aborting due to 8 previous errors - -To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/zero_ptr.rs b/tests/ui/zero_ptr.rs similarity index 100% rename from clippy_tests/examples/zero_ptr.rs rename to tests/ui/zero_ptr.rs diff --git a/clippy_tests/examples/zero_ptr.stderr b/tests/ui/zero_ptr.stderr similarity index 78% rename from clippy_tests/examples/zero_ptr.stderr rename to tests/ui/zero_ptr.stderr index d4d82b36ecae..5155dc401bd1 100644 --- a/clippy_tests/examples/zero_ptr.stderr +++ b/tests/ui/zero_ptr.stderr @@ -1,5 +1,5 @@ error: `0 as *const _` detected. Consider using `ptr::null()` - --> zero_ptr.rs:6:13 + --> $DIR/zero_ptr.rs:6:13 | 6 | let x = 0 as *const usize; | ^^^^^^^^^^^^^^^^^ @@ -7,12 +7,10 @@ error: `0 as *const _` detected. Consider using `ptr::null()` = note: `-D zero-ptr` implied by `-D warnings` error: `0 as *mut _` detected. Consider using `ptr::null_mut()` - --> zero_ptr.rs:7:13 + --> $DIR/zero_ptr.rs:7:13 | 7 | let y = 0 as *mut f64; | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors - -To learn more, run the command again with --verbose.