diff --git a/tests/compile-test.rs b/tests/compile-test.rs index c67b6f08c9f0..b6a4beff0469 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -133,7 +133,6 @@ fn prepare_env() { #[test] fn compile_test() { prepare_env(); - run_mode("run-pass", "tests/run-pass".into()); run_mode("ui", "tests/ui".into()); run_ui_toml(); } diff --git a/tests/run-pass/ice-2727.rs b/tests/run-pass/ice-2727.rs deleted file mode 100644 index 79c6f1c55db6..000000000000 --- a/tests/run-pass/ice-2727.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub fn f(new: fn()) { - new(); -} - -fn main() {} diff --git a/tests/run-pass/ice-700.rs b/tests/run-pass/ice-700.rs deleted file mode 100644 index 105468506111..000000000000 --- a/tests/run-pass/ice-700.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![deny(clippy::all)] - -fn core() {} - -fn main() { - core(); -} diff --git a/tests/run-pass/associated-constant-ice.rs b/tests/ui/crashes/associated-constant-ice.rs similarity index 68% rename from tests/run-pass/associated-constant-ice.rs rename to tests/ui/crashes/associated-constant-ice.rs index 2c5c90683cce..948deba3ea6e 100644 --- a/tests/run-pass/associated-constant-ice.rs +++ b/tests/ui/crashes/associated-constant-ice.rs @@ -1,3 +1,5 @@ +/// Test for https://github.com/rust-lang/rust-clippy/issues/1698 + pub trait Trait { const CONSTANT: u8; } diff --git a/tests/run-pass/cc_seme.rs b/tests/ui/crashes/cc_seme.rs similarity index 85% rename from tests/run-pass/cc_seme.rs rename to tests/ui/crashes/cc_seme.rs index 169403df5628..98588be9cf82 100644 --- a/tests/run-pass/cc_seme.rs +++ b/tests/ui/crashes/cc_seme.rs @@ -1,4 +1,7 @@ #[allow(dead_code)] + +/// Test for https://github.com/rust-lang/rust-clippy/issues/478 + enum Baz { One, Two, diff --git a/tests/run-pass/enum-glob-import-crate.rs b/tests/ui/crashes/enum-glob-import-crate.rs similarity index 100% rename from tests/run-pass/enum-glob-import-crate.rs rename to tests/ui/crashes/enum-glob-import-crate.rs diff --git a/tests/run-pass/ice-1588.rs b/tests/ui/crashes/ice-1588.rs similarity index 67% rename from tests/run-pass/ice-1588.rs rename to tests/ui/crashes/ice-1588.rs index 6a5bf429f2d0..b0a3d11bce46 100644 --- a/tests/run-pass/ice-1588.rs +++ b/tests/ui/crashes/ice-1588.rs @@ -1,5 +1,7 @@ #![allow(clippy::all)] +/// Test for https://github.com/rust-lang/rust-clippy/issues/1588 + fn main() { match 1 { 1 => {}, diff --git a/tests/run-pass/ice-1782.rs b/tests/ui/crashes/ice-1782.rs similarity index 100% rename from tests/run-pass/ice-1782.rs rename to tests/ui/crashes/ice-1782.rs diff --git a/tests/run-pass/ice-1969.rs b/tests/ui/crashes/ice-1969.rs similarity index 71% rename from tests/run-pass/ice-1969.rs rename to tests/ui/crashes/ice-1969.rs index eab4f338f974..96a8fe6c24d5 100644 --- a/tests/run-pass/ice-1969.rs +++ b/tests/ui/crashes/ice-1969.rs @@ -1,5 +1,7 @@ #![allow(clippy::all)] +/// Test for https://github.com/rust-lang/rust-clippy/issues/1969 + fn main() {} pub trait Convert { diff --git a/tests/run-pass/ice-2499.rs b/tests/ui/crashes/ice-2499.rs similarity index 100% rename from tests/run-pass/ice-2499.rs rename to tests/ui/crashes/ice-2499.rs diff --git a/tests/run-pass/ice-2594.rs b/tests/ui/crashes/ice-2594.rs similarity index 100% rename from tests/run-pass/ice-2594.rs rename to tests/ui/crashes/ice-2594.rs diff --git a/tests/ui/crashes/ice-2727.rs b/tests/ui/crashes/ice-2727.rs new file mode 100644 index 000000000000..56024abc8f58 --- /dev/null +++ b/tests/ui/crashes/ice-2727.rs @@ -0,0 +1,7 @@ +/// Test for https://github.com/rust-lang/rust-clippy/issues/2727 + +pub fn f(new: fn()) { + new(); +} + +fn main() {} diff --git a/tests/run-pass/ice-2760.rs b/tests/ui/crashes/ice-2760.rs similarity index 57% rename from tests/run-pass/ice-2760.rs rename to tests/ui/crashes/ice-2760.rs index 949e273997c5..fddf82523299 100644 --- a/tests/run-pass/ice-2760.rs +++ b/tests/ui/crashes/ice-2760.rs @@ -5,11 +5,11 @@ dead_code )] -// This should not compile-fail with: -// -// error[E0277]: the trait bound `T: Foo` is not satisfied -// -// See https://github.com/rust-lang/rust-clippy/issues/2760 +/// This should not compile-fail with: +/// +/// error[E0277]: the trait bound `T: Foo` is not satisfied +/// +/// See https://github.com/rust-lang/rust-clippy/issues/2760 trait Foo { type Bar; diff --git a/tests/run-pass/ice-2774.rs b/tests/ui/crashes/ice-2774.rs similarity index 91% rename from tests/run-pass/ice-2774.rs rename to tests/ui/crashes/ice-2774.rs index 2cc19ae32b80..fdc671a84e08 100644 --- a/tests/run-pass/ice-2774.rs +++ b/tests/ui/crashes/ice-2774.rs @@ -1,6 +1,6 @@ use std::collections::HashSet; -// See https://github.com/rust-lang/rust-clippy/issues/2774 +/// See https://github.com/rust-lang/rust-clippy/issues/2774 #[derive(Eq, PartialEq, Debug, Hash)] pub struct Bar { diff --git a/tests/run-pass/ice-2865.rs b/tests/ui/crashes/ice-2865.rs similarity index 76% rename from tests/run-pass/ice-2865.rs rename to tests/ui/crashes/ice-2865.rs index 64092afd53d2..6b1ceb505693 100644 --- a/tests/run-pass/ice-2865.rs +++ b/tests/ui/crashes/ice-2865.rs @@ -1,4 +1,7 @@ #[allow(dead_code)] + +/// Test for https://github.com/rust-lang/rust-clippy/issues/2865 + struct Ice { size: String, } diff --git a/tests/run-pass/ice-3151.rs b/tests/ui/crashes/ice-3151.rs similarity index 72% rename from tests/run-pass/ice-3151.rs rename to tests/ui/crashes/ice-3151.rs index a03dd05e7d31..fef4d7db84dd 100644 --- a/tests/run-pass/ice-3151.rs +++ b/tests/ui/crashes/ice-3151.rs @@ -1,3 +1,5 @@ +/// Test for https://github.com/rust-lang/rust-clippy/issues/2865 + #[derive(Clone)] pub struct HashMap { hash_builder: S, diff --git a/tests/run-pass/ice-3462.rs b/tests/ui/crashes/ice-3462.rs similarity index 79% rename from tests/run-pass/ice-3462.rs rename to tests/ui/crashes/ice-3462.rs index d4f6f355c856..7d62e315da2f 100644 --- a/tests/run-pass/ice-3462.rs +++ b/tests/ui/crashes/ice-3462.rs @@ -2,6 +2,8 @@ #![allow(clippy::blacklisted_name)] #![allow(unused)] +/// Test for https://github.com/rust-lang/rust-clippy/issues/3462 + enum Foo { Bar, Baz, diff --git a/tests/ui/crashes/ice-700.rs b/tests/ui/crashes/ice-700.rs new file mode 100644 index 000000000000..0cbceedbd6bd --- /dev/null +++ b/tests/ui/crashes/ice-700.rs @@ -0,0 +1,9 @@ +#![deny(clippy::all)] + +/// Test for https://github.com/rust-lang/rust-clippy/issues/700 + +fn core() {} + +fn main() { + core(); +} diff --git a/tests/run-pass/ice_exacte_size.rs b/tests/ui/crashes/ice_exacte_size.rs similarity index 79% rename from tests/run-pass/ice_exacte_size.rs rename to tests/ui/crashes/ice_exacte_size.rs index ac643fafabc6..30e4b11ec0bd 100644 --- a/tests/run-pass/ice_exacte_size.rs +++ b/tests/ui/crashes/ice_exacte_size.rs @@ -1,5 +1,7 @@ #![deny(clippy::all)] +/// Test for https://github.com/rust-lang/rust-clippy/issues/1336 + #[allow(dead_code)] struct Foo; diff --git a/tests/run-pass/if_same_then_else.rs b/tests/ui/crashes/if_same_then_else.rs similarity index 76% rename from tests/run-pass/if_same_then_else.rs rename to tests/ui/crashes/if_same_then_else.rs index e6ab7cc9d8c7..7b3b881316df 100644 --- a/tests/run-pass/if_same_then_else.rs +++ b/tests/ui/crashes/if_same_then_else.rs @@ -1,5 +1,7 @@ #![deny(clippy::if_same_then_else)] +/// Test for https://github.com/rust-lang/rust-clippy/issues/2426 + fn main() {} pub fn foo(a: i32, b: i32) -> Option<&'static str> { diff --git a/tests/run-pass/issue-2862.rs b/tests/ui/crashes/issue-2862.rs similarity index 76% rename from tests/run-pass/issue-2862.rs rename to tests/ui/crashes/issue-2862.rs index b35df667f27a..38e2341e2782 100644 --- a/tests/run-pass/issue-2862.rs +++ b/tests/ui/crashes/issue-2862.rs @@ -1,3 +1,5 @@ +/// Test for https://github.com/rust-lang/rust-clippy/issues/2826 + pub trait FooMap { fn map B>(&self, f: F) -> B; } diff --git a/tests/run-pass/issue-825.rs b/tests/ui/crashes/issue-825.rs similarity index 89% rename from tests/run-pass/issue-825.rs rename to tests/ui/crashes/issue-825.rs index b1339212e6e1..05696e3d7d56 100644 --- a/tests/run-pass/issue-825.rs +++ b/tests/ui/crashes/issue-825.rs @@ -1,5 +1,7 @@ #![allow(warnings)] +/// Test for https://github.com/rust-lang/rust-clippy/issues/825 + // this should compile in a reasonable amount of time fn rust_type_id(name: &str) { if "bool" == &name[..] diff --git a/tests/run-pass/issues_loop_mut_cond.rs b/tests/ui/crashes/issues_loop_mut_cond.rs similarity index 100% rename from tests/run-pass/issues_loop_mut_cond.rs rename to tests/ui/crashes/issues_loop_mut_cond.rs diff --git a/tests/run-pass/match_same_arms_const.rs b/tests/ui/crashes/match_same_arms_const.rs similarity index 83% rename from tests/run-pass/match_same_arms_const.rs rename to tests/ui/crashes/match_same_arms_const.rs index 507324755628..94c939665e61 100644 --- a/tests/run-pass/match_same_arms_const.rs +++ b/tests/ui/crashes/match_same_arms_const.rs @@ -1,5 +1,7 @@ #![deny(clippy::match_same_arms)] +/// Test for https://github.com/rust-lang/rust-clippy/issues/2427 + const PRICE_OF_SWEETS: u32 = 5; const PRICE_OF_KINDNESS: u32 = 0; const PRICE_OF_DRINKS: u32 = 5; diff --git a/tests/run-pass/mut_mut_macro.rs b/tests/ui/crashes/mut_mut_macro.rs similarity index 63% rename from tests/run-pass/mut_mut_macro.rs rename to tests/ui/crashes/mut_mut_macro.rs index af11c29d9b04..6ce3b37a855f 100644 --- a/tests/run-pass/mut_mut_macro.rs +++ b/tests/ui/crashes/mut_mut_macro.rs @@ -1,14 +1,16 @@ #![deny(clippy::mut_mut, clippy::zero_ptr, clippy::cmp_nan)] #![allow(dead_code)] -// compiletest + extern crates doesn't work together -//#[macro_use] -//extern crate lazy_static; +// FIXME: compiletest + extern crates doesn't work together. To make this test work, it would need +// the following three lines and the lazy_static crate. +// +// #[macro_use] +// extern crate lazy_static; +// use std::collections::HashMap; -//use std::collections::HashMap; +/// ensure that we don't suggest `is_nan` and `is_null` inside constants +/// FIXME: once const fn is stable, suggest these functions again in constants -// ensure that we don't suggest `is_nan` and `is_null` inside constants -// FIXME: once const fn is stable, suggest these functions again in constants const BAA: *const i32 = 0 as *const i32; static mut BAR: *const i32 = BAA; static mut FOO: *const i32 = 0 as *const i32; diff --git a/tests/run-pass/needless_borrow_fp.rs b/tests/ui/crashes/needless_borrow_fp.rs similarity index 100% rename from tests/run-pass/needless_borrow_fp.rs rename to tests/ui/crashes/needless_borrow_fp.rs diff --git a/tests/run-pass/needless_lifetimes_impl_trait.rs b/tests/ui/crashes/needless_lifetimes_impl_trait.rs similarity index 100% rename from tests/run-pass/needless_lifetimes_impl_trait.rs rename to tests/ui/crashes/needless_lifetimes_impl_trait.rs diff --git a/tests/run-pass/procedural_macro.rs b/tests/ui/crashes/procedural_macro.rs similarity index 100% rename from tests/run-pass/procedural_macro.rs rename to tests/ui/crashes/procedural_macro.rs diff --git a/tests/run-pass/regressions.rs b/tests/ui/crashes/regressions.rs similarity index 100% rename from tests/run-pass/regressions.rs rename to tests/ui/crashes/regressions.rs diff --git a/tests/run-pass/returns.rs b/tests/ui/crashes/returns.rs similarity index 81% rename from tests/run-pass/returns.rs rename to tests/ui/crashes/returns.rs index d6b2a4ef1701..8021ed4607dd 100644 --- a/tests/run-pass/returns.rs +++ b/tests/ui/crashes/returns.rs @@ -1,3 +1,5 @@ +/// Test for https://github.com/rust-lang/rust-clippy/issues/1346 + #[deny(warnings)] fn cfg_return() -> i32 { #[cfg(unix)] diff --git a/tests/run-pass/single-match-else.rs b/tests/ui/crashes/single-match-else.rs similarity index 71% rename from tests/run-pass/single-match-else.rs rename to tests/ui/crashes/single-match-else.rs index efcc6363eb02..1ba7ac082132 100644 --- a/tests/run-pass/single-match-else.rs +++ b/tests/ui/crashes/single-match-else.rs @@ -1,5 +1,7 @@ #![warn(clippy::single_match_else)] +//! Test for https://github.com/rust-lang/rust-clippy/issues/1588 + fn main() { let n = match (42, 43) { (42, n) => n, diff --git a/tests/run-pass/used_underscore_binding_macro.rs b/tests/ui/crashes/used_underscore_binding_macro.rs similarity index 100% rename from tests/run-pass/used_underscore_binding_macro.rs rename to tests/ui/crashes/used_underscore_binding_macro.rs diff --git a/tests/run-pass/whitelist/clippy.toml b/tests/ui/crashes/whitelist/clippy.toml similarity index 100% rename from tests/run-pass/whitelist/clippy.toml rename to tests/ui/crashes/whitelist/clippy.toml diff --git a/tests/run-pass/whitelist/conf_whitelisted.rs b/tests/ui/crashes/whitelist/conf_whitelisted.rs similarity index 100% rename from tests/run-pass/whitelist/conf_whitelisted.rs rename to tests/ui/crashes/whitelist/conf_whitelisted.rs