@@ -9,7 +9,7 @@ use rustc_span::edition::Edition;
9
9
use rustc_span:: { hygiene, sym, symbol:: kw, symbol:: SymbolStr , InnerSpan , Span , Symbol } ;
10
10
11
11
declare_lint ! {
12
- /// The `non_fmt_panic ` lint detects `panic!(..)` invocations where the first
12
+ /// The `non_fmt_panics ` lint detects `panic!(..)` invocations where the first
13
13
/// argument is not a formatting string.
14
14
///
15
15
/// ### Example
@@ -29,7 +29,7 @@ declare_lint! {
29
29
/// an `i32` as message.
30
30
///
31
31
/// Rust 2021 always interprets the first argument as format string.
32
- NON_FMT_PANIC ,
32
+ NON_FMT_PANICS ,
33
33
Warn ,
34
34
"detect single-argument panic!() invocations in which the argument is not a format string" ,
35
35
@future_incompatible = FutureIncompatibleInfo {
@@ -39,7 +39,7 @@ declare_lint! {
39
39
report_in_external_macro
40
40
}
41
41
42
- declare_lint_pass ! ( NonPanicFmt => [ NON_FMT_PANIC ] ) ;
42
+ declare_lint_pass ! ( NonPanicFmt => [ NON_FMT_PANICS ] ) ;
43
43
44
44
impl < ' tcx > LateLintPass < ' tcx > for NonPanicFmt {
45
45
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' tcx > ) {
@@ -91,7 +91,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
91
91
arg_span = expn. call_site ;
92
92
}
93
93
94
- cx. struct_span_lint ( NON_FMT_PANIC , arg_span, |lint| {
94
+ cx. struct_span_lint ( NON_FMT_PANICS , arg_span, |lint| {
95
95
let mut l = lint. build ( "panic message is not a string literal" ) ;
96
96
l. note ( "this usage of panic!() is deprecated; it will be a hard error in Rust 2021" ) ;
97
97
l. note ( "for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>" ) ;
@@ -174,7 +174,7 @@ fn check_panic_str<'tcx>(
174
174
[ ] => vec ! [ fmt_span] ,
175
175
v => v. iter ( ) . map ( |span| fmt_span. from_inner ( * span) ) . collect ( ) ,
176
176
} ;
177
- cx. struct_span_lint ( NON_FMT_PANIC , arg_spans, |lint| {
177
+ cx. struct_span_lint ( NON_FMT_PANICS , arg_spans, |lint| {
178
178
let mut l = lint. build ( match n_arguments {
179
179
1 => "panic message contains an unused formatting placeholder" ,
180
180
_ => "panic message contains unused formatting placeholders" ,
@@ -208,7 +208,7 @@ fn check_panic_str<'tcx>(
208
208
Some ( v) if v. len ( ) == 1 => "panic message contains a brace" ,
209
209
_ => "panic message contains braces" ,
210
210
} ;
211
- cx. struct_span_lint ( NON_FMT_PANIC , brace_spans. unwrap_or_else ( || vec ! [ span] ) , |lint| {
211
+ cx. struct_span_lint ( NON_FMT_PANICS , brace_spans. unwrap_or_else ( || vec ! [ span] ) , |lint| {
212
212
let mut l = lint. build ( msg) ;
213
213
l. note ( "this message is not used as a format string, but will be in Rust 2021" ) ;
214
214
if span. contains ( arg. span ) {
0 commit comments