mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 14:40:32 +00:00
Reintroduce #768 so we can publish
This commit is contained in:
parent
3052000c73
commit
f1e905f620
2 changed files with 35 additions and 1 deletions
|
@ -42,7 +42,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
||||||
let ExprPath(ref qpath) = fun.node,
|
let ExprPath(ref qpath) = fun.node,
|
||||||
match_def_path(cx.tcx, resolve_node(cx, qpath, fun.id).def_id(), &paths::BEGIN_PANIC),
|
match_def_path(cx.tcx, resolve_node(cx, qpath, fun.id).def_id(), &paths::BEGIN_PANIC),
|
||||||
let ExprLit(ref lit) = params[0].node,
|
let ExprLit(ref lit) = params[0].node,
|
||||||
is_direct_expn_of(params[0].span, "panic").is_some(),
|
is_direct_expn_of(expr.span, "panic").is_some(),
|
||||||
let LitKind::Str(ref string, _) = lit.node,
|
let LitKind::Str(ref string, _) = lit.node,
|
||||||
let Some(par) = string.as_str().find('{'),
|
let Some(par) = string.as_str().find('{'),
|
||||||
string.as_str()[par..].contains('}')
|
string.as_str()[par..].contains('}')
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
error: you probably are missing some parameter in your format string
|
||||||
|
--> $DIR/panic.rs:8:16
|
||||||
|
|
|
||||||
|
8 | panic!("{}");
|
||||||
|
| ^^^^
|
||||||
|
|
|
||||||
|
note: lint level defined here
|
||||||
|
--> $DIR/panic.rs:4:9
|
||||||
|
|
|
||||||
|
4 | #![deny(panic_params)]
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: you probably are missing some parameter in your format string
|
||||||
|
--> $DIR/panic.rs:10:16
|
||||||
|
|
|
||||||
|
10 | panic!("{:?}");
|
||||||
|
| ^^^^^^
|
||||||
|
|
||||||
|
error: you probably are missing some parameter in your format string
|
||||||
|
--> $DIR/panic.rs:12:23
|
||||||
|
|
|
||||||
|
12 | assert!(true, "here be missing values: {}");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: you probably are missing some parameter in your format string
|
||||||
|
--> $DIR/panic.rs:22:5
|
||||||
|
|
|
||||||
|
22 | assert!("foo bar".contains(&format!("foo {}", "bar")));
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: this error originates in a macro outside of the current crate
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
Loading…
Reference in a new issue