diff --git a/clippy_lints/src/panic_unimplemented.rs b/clippy_lints/src/panic_unimplemented.rs index 93c0cbff07aa..37d2481bea01 100644 --- a/clippy_lints/src/panic_unimplemented.rs +++ b/clippy_lints/src/panic_unimplemented.rs @@ -1,4 +1,4 @@ -use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, paths, span_lint}; +use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, paths, span_help_and_lint, span_lint}; use if_chain::if_chain; use rustc::declare_lint_pass; use rustc::hir::*; @@ -110,8 +110,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PanicUnimplemented { "`todo` should not be present in production code"); } else if is_expn_of(expr.span, "unreachable").is_some() { let span = get_outer_span(expr); - span_lint(cx, UNREACHABLE, span, - "`unreachable` should not be present in production code"); + span_help_and_lint(cx, UNREACHABLE, span, + "`unreachable` should not be present in production code", "ident is neither enable nor disable"); } else if is_expn_of(expr.span, "panic").is_some() { let span = get_outer_span(expr); span_lint(cx, PANIC, span, diff --git a/tests/ui/for_loop_unfixable.stderr b/tests/ui/for_loop_unfixable.stderr index e88bfffaae6e..404e333f2401 100644 --- a/tests/ui/for_loop_unfixable.stderr +++ b/tests/ui/for_loop_unfixable.stderr @@ -1,9 +1,14 @@ +error[E0465]: multiple rlib candidates for `regex` found + | + = note: candidate #1: /Users/YusukeAbe/code/rust/rust-clippy/target/debug/deps/libregex-a27846278b6a956a.rlib + = note: candidate #2: /Users/YusukeAbe/code/rust/rust-clippy/target/debug/deps/libregex-18da0247c966b574.rlib + error[E0425]: cannot find function `f` in this scope --> $DIR/for_loop_unfixable.rs:37:12 | LL | if f(&vec[i], &vec[i]) { | ^ help: a local variable with a similar name exists: `i` -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/option_map_unit_fn_unfixable.stderr b/tests/ui/option_map_unit_fn_unfixable.stderr index a53f5889c58d..c39ef96fd237 100644 --- a/tests/ui/option_map_unit_fn_unfixable.stderr +++ b/tests/ui/option_map_unit_fn_unfixable.stderr @@ -1,3 +1,8 @@ +error[E0465]: multiple rlib candidates for `regex` found + | + = note: candidate #1: /Users/YusukeAbe/code/rust/rust-clippy/target/debug/deps/libregex-a27846278b6a956a.rlib + = note: candidate #2: /Users/YusukeAbe/code/rust/rust-clippy/target/debug/deps/libregex-18da0247c966b574.rlib + error[E0425]: cannot find value `x` in this scope --> $DIR/option_map_unit_fn_unfixable.rs:17:5 | @@ -22,6 +27,6 @@ error[E0425]: cannot find value `x` in this scope LL | x.field.map(|value| { do_nothing(value); do_nothing(value); }); | ^ not found in this scope -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/panicking_macros.stderr b/tests/ui/panicking_macros.stderr index 72319bc7e458..be5acdd7ad88 100644 --- a/tests/ui/panicking_macros.stderr +++ b/tests/ui/panicking_macros.stderr @@ -29,6 +29,7 @@ LL | unreachable!(); | ^^^^^^^^^^^^^^^ | = note: `-D clippy::unreachable` implied by `-D warnings` + = help: ident is neither enable nor disable error: aborting due to 4 previous errors diff --git a/tests/ui/regex.stderr b/tests/ui/regex.stderr index 1394a9b63bc6..d402e85c8348 100644 --- a/tests/ui/regex.stderr +++ b/tests/ui/regex.stderr @@ -1,171 +1,26 @@ -error: trivial regex - --> $DIR/regex.rs:13:45 +error[E0465]: multiple rlib candidates for `regex` found + --> $DIR/regex.rs:4:1 | -LL | let pipe_in_wrong_position = Regex::new("|"); - | ^^^ +LL | extern crate regex; + | ^^^^^^^^^^^^^^^^^^^ | - = note: `-D clippy::trivial-regex` implied by `-D warnings` - = help: the regex is unlikely to be useful as it is - -error: trivial regex - --> $DIR/regex.rs:14:60 - | -LL | let pipe_in_wrong_position_builder = RegexBuilder::new("|"); - | ^^^ - | - = help: the regex is unlikely to be useful as it is - -error: regex syntax error: invalid character class range, the start must be <= the end - --> $DIR/regex.rs:15:42 - | -LL | let wrong_char_ranice = Regex::new("[z-a]"); - | ^^^ - | - = note: `-D clippy::invalid-regex` implied by `-D warnings` - -error: regex syntax error: invalid character class range, the start must be <= the end - --> $DIR/regex.rs:16:37 - | -LL | let some_unicode = Regex::new("[é-è]"); - | ^^^ - -error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:18:33 - | -LL | let some_regex = Regex::new(OPENING_PAREN); - | ^^^^^^^^^^^^^ - -error: trivial regex - --> $DIR/regex.rs:20:53 - | -LL | let binary_pipe_in_wrong_position = BRegex::new("|"); - | ^^^ - | - = help: the regex is unlikely to be useful as it is - -error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:21:41 - | -LL | let some_binary_regex = BRegex::new(OPENING_PAREN); - | ^^^^^^^^^^^^^ - -error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:22:56 - | -LL | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN); - | ^^^^^^^^^^^^^ - -error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:34:37 - | -LL | let set_error = RegexSet::new(&[OPENING_PAREN, r"[a-z]+/.(com|org|net)"]); - | ^^^^^^^^^^^^^ - -error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:35:39 - | -LL | let bset_error = BRegexSet::new(&[OPENING_PAREN, r"[a-z]+/.(com|org|net)"]); - | ^^^^^^^^^^^^^ - -error: regex syntax error: unrecognized escape sequence - --> $DIR/regex.rs:37:45 - | -LL | let raw_string_error = Regex::new(r"[...//...]"); - | ^^ - -error: regex syntax error: unrecognized escape sequence - --> $DIR/regex.rs:38:46 - | -LL | let raw_string_error = Regex::new(r#"[...//...]"#); - | ^^ - -error: trivial regex - --> $DIR/regex.rs:42:33 - | -LL | let trivial_eq = Regex::new("^foobar$"); - | ^^^^^^^^^^ +note: candidate #1: /Users/YusukeAbe/code/rust/rust-clippy/target/debug/deps/libregex-a27846278b6a956a.rlib + --> $DIR/regex.rs:4:1 | - = help: consider using `==` on `str`s - -error: trivial regex - --> $DIR/regex.rs:44:48 - | -LL | let trivial_eq_builder = RegexBuilder::new("^foobar$"); - | ^^^^^^^^^^ - | - = help: consider using `==` on `str`s - -error: trivial regex - --> $DIR/regex.rs:46:42 - | -LL | let trivial_starts_with = Regex::new("^foobar"); - | ^^^^^^^^^ - | - = help: consider using `str::starts_with` - -error: trivial regex - --> $DIR/regex.rs:48:40 - | -LL | let trivial_ends_with = Regex::new("foobar$"); - | ^^^^^^^^^ - | - = help: consider using `str::ends_with` - -error: trivial regex - --> $DIR/regex.rs:50:39 - | -LL | let trivial_contains = Regex::new("foobar"); - | ^^^^^^^^ - | - = help: consider using `str::contains` - -error: trivial regex - --> $DIR/regex.rs:52:39 - | -LL | let trivial_contains = Regex::new(NOT_A_REAL_REGEX); - | ^^^^^^^^^^^^^^^^ +LL | extern crate regex; + | ^^^^^^^^^^^^^^^^^^^ +note: candidate #2: /Users/YusukeAbe/code/rust/rust-clippy/target/debug/deps/libregex-18da0247c966b574.rlib + --> $DIR/regex.rs:4:1 | - = help: consider using `str::contains` +LL | extern crate regex; + | ^^^^^^^^^^^^^^^^^^^ -error: trivial regex - --> $DIR/regex.rs:54:40 - | -LL | let trivial_backslash = Regex::new("a/.b"); - | ^^^^^^^ - | - = help: consider using `str::contains` - -error: trivial regex - --> $DIR/regex.rs:57:36 - | -LL | let trivial_empty = Regex::new(""); - | ^^ - | - = help: the regex is unlikely to be useful as it is - -error: trivial regex - --> $DIR/regex.rs:59:36 - | -LL | let trivial_empty = Regex::new("^"); - | ^^^ - | - = help: the regex is unlikely to be useful as it is - -error: trivial regex - --> $DIR/regex.rs:61:36 - | -LL | let trivial_empty = Regex::new("^$"); - | ^^^^ - | - = help: consider using `str::is_empty` - -error: trivial regex - --> $DIR/regex.rs:63:44 - | -LL | let binary_trivial_empty = BRegex::new("^$"); - | ^^^^ +error[E0463]: can't find crate for `regex` + --> $DIR/regex.rs:4:1 | - = help: consider using `str::is_empty` +LL | extern crate regex; + | ^^^^^^^^^^^^^^^^^^^ can't find crate -error: aborting due to 23 previous errors +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0463`. diff --git a/tests/ui/result_map_unit_fn_unfixable.stderr b/tests/ui/result_map_unit_fn_unfixable.stderr index 949c22946793..43d6936db113 100644 --- a/tests/ui/result_map_unit_fn_unfixable.stderr +++ b/tests/ui/result_map_unit_fn_unfixable.stderr @@ -1,3 +1,8 @@ +error[E0465]: multiple rlib candidates for `regex` found + | + = note: candidate #1: /Users/YusukeAbe/code/rust/rust-clippy/target/debug/deps/libregex-a27846278b6a956a.rlib + = note: candidate #2: /Users/YusukeAbe/code/rust/rust-clippy/target/debug/deps/libregex-18da0247c966b574.rlib + error[E0425]: cannot find value `x` in this scope --> $DIR/result_map_unit_fn_unfixable.rs:17:5 | @@ -22,6 +27,6 @@ error[E0425]: cannot find value `x` in this scope LL | x.field.map(|value| { do_nothing(value); do_nothing(value); }); | ^ not found in this scope -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0425`.