lint: port non-fmt-panic diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
48e4bf115f
commit
7ee4aa7003
5 changed files with 132 additions and 91 deletions
|
@ -72,3 +72,39 @@ lint-mixed-script-confusables =
|
||||||
the usage of Script Group `{$set}` in this crate consists solely of mixed script confusables
|
the usage of Script Group `{$set}` in this crate consists solely of mixed script confusables
|
||||||
.includes-note = the usage includes {$includes}
|
.includes-note = the usage includes {$includes}
|
||||||
.note = please recheck to make sure their usages are indeed what you want
|
.note = please recheck to make sure their usages are indeed what you want
|
||||||
|
|
||||||
|
lint-non-fmt-panic = panic message is not a string literal
|
||||||
|
.note = this usage of `{$name}!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
|
.more-info-note = for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
|
.supports-fmt-note = the `{$name}!()` macro supports formatting, so there's no need for the `format!()` macro here
|
||||||
|
.supports-fmt-suggestion = remove the `format!(..)` macro call
|
||||||
|
.display-suggestion = add a "{"{"}{"}"}" format string to `Display` the message
|
||||||
|
.debug-suggestion =
|
||||||
|
add a "{"{"}:?{"}"}" format string to use the `Debug` implementation of `{$ty}`
|
||||||
|
.panic-suggestion = {$already_suggested ->
|
||||||
|
[true] or use
|
||||||
|
*[false] use
|
||||||
|
} std::panic::panic_any instead
|
||||||
|
|
||||||
|
lint-non-fmt-panic-unused =
|
||||||
|
panic message contains {$count ->
|
||||||
|
[one] an unused
|
||||||
|
*[other] unused
|
||||||
|
} formatting {$count ->
|
||||||
|
[one] placeholder
|
||||||
|
*[other] placeholders
|
||||||
|
}
|
||||||
|
.note = this message is not used as a format string when given without arguments, but will be in Rust 2021
|
||||||
|
.add-args-suggestion = add the missing {$count ->
|
||||||
|
[one] argument
|
||||||
|
*[other] arguments
|
||||||
|
}
|
||||||
|
.add-fmt-suggestion = or add a "{"{"}{"}"}" format string to use the message literally
|
||||||
|
|
||||||
|
lint-non-fmt-panic-braces =
|
||||||
|
panic message contains {$count ->
|
||||||
|
[one] a brace
|
||||||
|
*[other] braces
|
||||||
|
}
|
||||||
|
.note = this message is not used as a format string, but will be in Rust 2021
|
||||||
|
.suggestion = add a "{"{"}{"}"}" format string to use the message literally
|
||||||
|
|
|
@ -39,6 +39,16 @@ pub trait IntoDiagnosticArg {
|
||||||
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static>;
|
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IntoDiagnosticArg for bool {
|
||||||
|
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
||||||
|
if self {
|
||||||
|
DiagnosticArgValue::Str(Cow::Borrowed("true"))
|
||||||
|
} else {
|
||||||
|
DiagnosticArgValue::Str(Cow::Borrowed("false"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl IntoDiagnosticArg for String {
|
impl IntoDiagnosticArg for String {
|
||||||
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
||||||
DiagnosticArgValue::Str(Cow::Owned(self))
|
DiagnosticArgValue::Str(Cow::Owned(self))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{LateContext, LateLintPass, LintContext};
|
use crate::{LateContext, LateLintPass, LintContext};
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_errors::{pluralize, Applicability};
|
use rustc_errors::{fluent, Applicability};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_infer::infer::TyCtxtInferExt;
|
use rustc_infer::infer::TyCtxtInferExt;
|
||||||
use rustc_middle::lint::in_external_macro;
|
use rustc_middle::lint::in_external_macro;
|
||||||
|
@ -120,9 +120,10 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
|
||||||
}
|
}
|
||||||
|
|
||||||
cx.struct_span_lint(NON_FMT_PANICS, arg_span, |lint| {
|
cx.struct_span_lint(NON_FMT_PANICS, arg_span, |lint| {
|
||||||
let mut l = lint.build("panic message is not a string literal");
|
let mut l = lint.build(fluent::lint::non_fmt_panic);
|
||||||
l.note(&format!("this usage of {}!() is deprecated; it will be a hard error in Rust 2021", symbol));
|
l.set_arg("name", symbol);
|
||||||
l.note("for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>");
|
l.note(fluent::lint::note);
|
||||||
|
l.note(fluent::lint::more_info_note);
|
||||||
if !is_arg_inside_call(arg_span, span) {
|
if !is_arg_inside_call(arg_span, span) {
|
||||||
// No clue where this argument is coming from.
|
// No clue where this argument is coming from.
|
||||||
l.emit();
|
l.emit();
|
||||||
|
@ -130,10 +131,10 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
|
||||||
}
|
}
|
||||||
if arg_macro.map_or(false, |id| cx.tcx.is_diagnostic_item(sym::format_macro, id)) {
|
if arg_macro.map_or(false, |id| cx.tcx.is_diagnostic_item(sym::format_macro, id)) {
|
||||||
// A case of `panic!(format!(..))`.
|
// A case of `panic!(format!(..))`.
|
||||||
l.note(format!("the {}!() macro supports formatting, so there's no need for the format!() macro here", symbol).as_str());
|
l.note(fluent::lint::supports_fmt_note);
|
||||||
if let Some((open, close, _)) = find_delimiters(cx, arg_span) {
|
if let Some((open, close, _)) = find_delimiters(cx, arg_span) {
|
||||||
l.multipart_suggestion(
|
l.multipart_suggestion(
|
||||||
"remove the `format!(..)` macro call",
|
fluent::lint::supports_fmt_suggestion,
|
||||||
vec![
|
vec![
|
||||||
(arg_span.until(open.shrink_to_hi()), "".into()),
|
(arg_span.until(open.shrink_to_hi()), "".into()),
|
||||||
(close.until(arg_span.shrink_to_hi()), "".into()),
|
(close.until(arg_span.shrink_to_hi()), "".into()),
|
||||||
|
@ -153,11 +154,17 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
|
||||||
);
|
);
|
||||||
|
|
||||||
let (suggest_display, suggest_debug) = cx.tcx.infer_ctxt().enter(|infcx| {
|
let (suggest_display, suggest_debug) = cx.tcx.infer_ctxt().enter(|infcx| {
|
||||||
let display = is_str || cx.tcx.get_diagnostic_item(sym::Display).map(|t| {
|
let display = is_str
|
||||||
infcx.type_implements_trait(t, ty, InternalSubsts::empty(), cx.param_env).may_apply()
|
|| cx.tcx.get_diagnostic_item(sym::Display).map(|t| {
|
||||||
|
infcx
|
||||||
|
.type_implements_trait(t, ty, InternalSubsts::empty(), cx.param_env)
|
||||||
|
.may_apply()
|
||||||
}) == Some(true);
|
}) == Some(true);
|
||||||
let debug = !display && cx.tcx.get_diagnostic_item(sym::Debug).map(|t| {
|
let debug = !display
|
||||||
infcx.type_implements_trait(t, ty, InternalSubsts::empty(), cx.param_env).may_apply()
|
&& cx.tcx.get_diagnostic_item(sym::Debug).map(|t| {
|
||||||
|
infcx
|
||||||
|
.type_implements_trait(t, ty, InternalSubsts::empty(), cx.param_env)
|
||||||
|
.may_apply()
|
||||||
}) == Some(true);
|
}) == Some(true);
|
||||||
(display, debug)
|
(display, debug)
|
||||||
});
|
});
|
||||||
|
@ -175,17 +182,15 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
|
||||||
if suggest_display {
|
if suggest_display {
|
||||||
l.span_suggestion_verbose(
|
l.span_suggestion_verbose(
|
||||||
arg_span.shrink_to_lo(),
|
arg_span.shrink_to_lo(),
|
||||||
"add a \"{}\" format string to Display the message",
|
fluent::lint::display_suggestion,
|
||||||
"\"{}\", ",
|
"\"{}\", ",
|
||||||
fmt_applicability,
|
fmt_applicability,
|
||||||
);
|
);
|
||||||
} else if suggest_debug {
|
} else if suggest_debug {
|
||||||
|
l.set_arg("ty", ty);
|
||||||
l.span_suggestion_verbose(
|
l.span_suggestion_verbose(
|
||||||
arg_span.shrink_to_lo(),
|
arg_span.shrink_to_lo(),
|
||||||
&format!(
|
fluent::lint::debug_suggestion,
|
||||||
"add a \"{{:?}}\" format string to use the Debug implementation of `{}`",
|
|
||||||
ty,
|
|
||||||
),
|
|
||||||
"\"{:?}\", ",
|
"\"{:?}\", ",
|
||||||
fmt_applicability,
|
fmt_applicability,
|
||||||
);
|
);
|
||||||
|
@ -193,15 +198,9 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
|
||||||
|
|
||||||
if suggest_panic_any {
|
if suggest_panic_any {
|
||||||
if let Some((open, close, del)) = find_delimiters(cx, span) {
|
if let Some((open, close, del)) = find_delimiters(cx, span) {
|
||||||
|
l.set_arg("already_suggested", suggest_display || suggest_debug);
|
||||||
l.multipart_suggestion(
|
l.multipart_suggestion(
|
||||||
&format!(
|
fluent::lint::panic_suggestion,
|
||||||
"{}use std::panic::panic_any instead",
|
|
||||||
if suggest_display || suggest_debug {
|
|
||||||
"or "
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if del == '(' {
|
if del == '(' {
|
||||||
vec![(span.until(open), "std::panic::panic_any".into())]
|
vec![(span.until(open), "std::panic::panic_any".into())]
|
||||||
} else {
|
} else {
|
||||||
|
@ -260,21 +259,19 @@ fn check_panic_str<'tcx>(
|
||||||
.collect(),
|
.collect(),
|
||||||
};
|
};
|
||||||
cx.struct_span_lint(NON_FMT_PANICS, arg_spans, |lint| {
|
cx.struct_span_lint(NON_FMT_PANICS, arg_spans, |lint| {
|
||||||
let mut l = lint.build(match n_arguments {
|
let mut l = lint.build(fluent::lint::non_fmt_panic_unused);
|
||||||
1 => "panic message contains an unused formatting placeholder",
|
l.set_arg("count", n_arguments);
|
||||||
_ => "panic message contains unused formatting placeholders",
|
l.note(fluent::lint::note);
|
||||||
});
|
|
||||||
l.note("this message is not used as a format string when given without arguments, but will be in Rust 2021");
|
|
||||||
if is_arg_inside_call(arg.span, span) {
|
if is_arg_inside_call(arg.span, span) {
|
||||||
l.span_suggestion(
|
l.span_suggestion(
|
||||||
arg.span.shrink_to_hi(),
|
arg.span.shrink_to_hi(),
|
||||||
&format!("add the missing argument{}", pluralize!(n_arguments)),
|
fluent::lint::add_args_suggestion,
|
||||||
", ...",
|
", ...",
|
||||||
Applicability::HasPlaceholders,
|
Applicability::HasPlaceholders,
|
||||||
);
|
);
|
||||||
l.span_suggestion(
|
l.span_suggestion(
|
||||||
arg.span.shrink_to_lo(),
|
arg.span.shrink_to_lo(),
|
||||||
"or add a \"{}\" format string to use the message literally",
|
fluent::lint::add_fmt_suggestion,
|
||||||
"\"{}\", ",
|
"\"{}\", ",
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
);
|
);
|
||||||
|
@ -289,17 +286,15 @@ fn check_panic_str<'tcx>(
|
||||||
.map(|(i, _)| fmt_span.from_inner(InnerSpan { start: i, end: i + 1 }))
|
.map(|(i, _)| fmt_span.from_inner(InnerSpan { start: i, end: i + 1 }))
|
||||||
.collect()
|
.collect()
|
||||||
});
|
});
|
||||||
let msg = match &brace_spans {
|
let count = brace_spans.as_ref().map(|v| v.len()).unwrap_or(/* any number >1 */ 2);
|
||||||
Some(v) if v.len() == 1 => "panic message contains a brace",
|
|
||||||
_ => "panic message contains braces",
|
|
||||||
};
|
|
||||||
cx.struct_span_lint(NON_FMT_PANICS, brace_spans.unwrap_or_else(|| vec![span]), |lint| {
|
cx.struct_span_lint(NON_FMT_PANICS, brace_spans.unwrap_or_else(|| vec![span]), |lint| {
|
||||||
let mut l = lint.build(msg);
|
let mut l = lint.build(fluent::lint::non_fmt_panic_braces);
|
||||||
l.note("this message is not used as a format string, but will be in Rust 2021");
|
l.set_arg("count", count);
|
||||||
|
l.note(fluent::lint::note);
|
||||||
if is_arg_inside_call(arg.span, span) {
|
if is_arg_inside_call(arg.span, span) {
|
||||||
l.span_suggestion(
|
l.span_suggestion(
|
||||||
arg.span.shrink_to_lo(),
|
arg.span.shrink_to_lo(),
|
||||||
"add a \"{}\" format string to use the message literally",
|
fluent::lint::suggestion,
|
||||||
"\"{}\", ",
|
"\"{}\", ",
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,9 +5,9 @@ LL | panic!({ "foo" });
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: `#[warn(non_fmt_panics)]` on by default
|
= note: `#[warn(non_fmt_panics)]` on by default
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | panic!("{}", { "foo" });
|
LL | panic!("{}", { "foo" });
|
||||||
| +++++
|
| +++++
|
||||||
|
|
|
@ -73,9 +73,9 @@ warning: panic message is not a string literal
|
||||||
LL | assert!(false, S);
|
LL | assert!(false, S);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | assert!(false, "{}", S);
|
LL | assert!(false, "{}", S);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -86,9 +86,9 @@ warning: panic message is not a string literal
|
||||||
LL | assert!(false, 123);
|
LL | assert!(false, 123);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | assert!(false, "{}", 123);
|
LL | assert!(false, "{}", 123);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -99,9 +99,9 @@ warning: panic message is not a string literal
|
||||||
LL | assert!(false, Some(123));
|
LL | assert!(false, Some(123));
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{:?}" format string to use the Debug implementation of `Option<i32>`
|
help: add a "{:?}" format string to use the `Debug` implementation of `Option<i32>`
|
||||||
|
|
|
|
||||||
LL | assert!(false, "{:?}", Some(123));
|
LL | assert!(false, "{:?}", Some(123));
|
||||||
| +++++++
|
| +++++++
|
||||||
|
@ -124,9 +124,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!(C);
|
LL | panic!(C);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | panic!("{}", C);
|
LL | panic!("{}", C);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -137,9 +137,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!(S);
|
LL | panic!(S);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | panic!("{}", S);
|
LL | panic!("{}", S);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -150,9 +150,9 @@ warning: panic message is not a string literal
|
||||||
LL | unreachable!(S);
|
LL | unreachable!(S);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `unreachable!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | unreachable!("{}", S);
|
LL | unreachable!("{}", S);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -163,9 +163,9 @@ warning: panic message is not a string literal
|
||||||
LL | unreachable!(S);
|
LL | unreachable!(S);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `unreachable!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | unreachable!("{}", S);
|
LL | unreachable!("{}", S);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -176,9 +176,9 @@ warning: panic message is not a string literal
|
||||||
LL | std::panic!(123);
|
LL | std::panic!(123);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= note: this usage of std::panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `std::panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | std::panic!("{}", 123);
|
LL | std::panic!("{}", 123);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -193,9 +193,9 @@ warning: panic message is not a string literal
|
||||||
LL | core::panic!(&*"abc");
|
LL | core::panic!(&*"abc");
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of core::panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `core::panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | core::panic!("{}", &*"abc");
|
LL | core::panic!("{}", &*"abc");
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -206,9 +206,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!(Some(123));
|
LL | panic!(Some(123));
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{:?}" format string to use the Debug implementation of `Option<i32>`
|
help: add a "{:?}" format string to use the `Debug` implementation of `Option<i32>`
|
||||||
|
|
|
|
||||||
LL | panic!("{:?}", Some(123));
|
LL | panic!("{:?}", Some(123));
|
||||||
| +++++++
|
| +++++++
|
||||||
|
@ -259,9 +259,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!(a!());
|
LL | panic!(a!());
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | panic!("{}", a!());
|
LL | panic!("{}", a!());
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -276,9 +276,9 @@ warning: panic message is not a string literal
|
||||||
LL | unreachable!(a!());
|
LL | unreachable!(a!());
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `unreachable!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | unreachable!("{}", a!());
|
LL | unreachable!("{}", a!());
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -289,9 +289,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!(format!("{}", 1));
|
LL | panic!(format!("{}", 1));
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
= note: the panic!() macro supports formatting, so there's no need for the format!() macro here
|
= note: the `panic!()` macro supports formatting, so there's no need for the `format!()` macro here
|
||||||
help: remove the `format!(..)` macro call
|
help: remove the `format!(..)` macro call
|
||||||
|
|
|
|
||||||
LL - panic!(format!("{}", 1));
|
LL - panic!(format!("{}", 1));
|
||||||
|
@ -304,9 +304,9 @@ warning: panic message is not a string literal
|
||||||
LL | unreachable!(format!("{}", 1));
|
LL | unreachable!(format!("{}", 1));
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `unreachable!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
= note: the unreachable!() macro supports formatting, so there's no need for the format!() macro here
|
= note: the `unreachable!()` macro supports formatting, so there's no need for the `format!()` macro here
|
||||||
help: remove the `format!(..)` macro call
|
help: remove the `format!(..)` macro call
|
||||||
|
|
|
|
||||||
LL - unreachable!(format!("{}", 1));
|
LL - unreachable!(format!("{}", 1));
|
||||||
|
@ -319,9 +319,9 @@ warning: panic message is not a string literal
|
||||||
LL | assert!(false, format!("{}", 1));
|
LL | assert!(false, format!("{}", 1));
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
= note: the assert!() macro supports formatting, so there's no need for the format!() macro here
|
= note: the `assert!()` macro supports formatting, so there's no need for the `format!()` macro here
|
||||||
help: remove the `format!(..)` macro call
|
help: remove the `format!(..)` macro call
|
||||||
|
|
|
|
||||||
LL - assert!(false, format!("{}", 1));
|
LL - assert!(false, format!("{}", 1));
|
||||||
|
@ -334,9 +334,9 @@ warning: panic message is not a string literal
|
||||||
LL | debug_assert!(false, format!("{}", 1));
|
LL | debug_assert!(false, format!("{}", 1));
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this usage of debug_assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `debug_assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
= note: the debug_assert!() macro supports formatting, so there's no need for the format!() macro here
|
= note: the `debug_assert!()` macro supports formatting, so there's no need for the `format!()` macro here
|
||||||
help: remove the `format!(..)` macro call
|
help: remove the `format!(..)` macro call
|
||||||
|
|
|
|
||||||
LL - debug_assert!(false, format!("{}", 1));
|
LL - debug_assert!(false, format!("{}", 1));
|
||||||
|
@ -349,9 +349,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic![123];
|
LL | panic![123];
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | panic!["{}", 123];
|
LL | panic!["{}", 123];
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -366,9 +366,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!{123};
|
LL | panic!{123};
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | panic!{"{}", 123};
|
LL | panic!{"{}", 123};
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -385,7 +385,7 @@ LL | panic!(v);
|
||||||
| |
|
| |
|
||||||
| help: use std::panic::panic_any instead: `std::panic::panic_any`
|
| help: use std::panic::panic_any instead: `std::panic::panic_any`
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
|
|
||||||
warning: panic message is not a string literal
|
warning: panic message is not a string literal
|
||||||
|
@ -394,7 +394,7 @@ warning: panic message is not a string literal
|
||||||
LL | assert!(false, v);
|
LL | assert!(false, v);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
|
|
||||||
warning: panic message is not a string literal
|
warning: panic message is not a string literal
|
||||||
|
@ -403,9 +403,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!(v);
|
LL | panic!(v);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{:?}" format string to use the Debug implementation of `T`
|
help: add a "{:?}" format string to use the `Debug` implementation of `T`
|
||||||
|
|
|
|
||||||
LL | panic!("{:?}", v);
|
LL | panic!("{:?}", v);
|
||||||
| +++++++
|
| +++++++
|
||||||
|
@ -420,9 +420,9 @@ warning: panic message is not a string literal
|
||||||
LL | assert!(false, v);
|
LL | assert!(false, v);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{:?}" format string to use the Debug implementation of `T`
|
help: add a "{:?}" format string to use the `Debug` implementation of `T`
|
||||||
|
|
|
|
||||||
LL | assert!(false, "{:?}", v);
|
LL | assert!(false, "{:?}", v);
|
||||||
| +++++++
|
| +++++++
|
||||||
|
@ -433,9 +433,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!(v);
|
LL | panic!(v);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | panic!("{}", v);
|
LL | panic!("{}", v);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -450,9 +450,9 @@ warning: panic message is not a string literal
|
||||||
LL | assert!(false, v);
|
LL | assert!(false, v);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | assert!(false, "{}", v);
|
LL | assert!(false, "{}", v);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -463,9 +463,9 @@ warning: panic message is not a string literal
|
||||||
LL | panic!(v);
|
LL | panic!(v);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | panic!("{}", v);
|
LL | panic!("{}", v);
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -480,9 +480,9 @@ warning: panic message is not a string literal
|
||||||
LL | assert!(false, v);
|
LL | assert!(false, v);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
|
= note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021
|
||||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||||
help: add a "{}" format string to Display the message
|
help: add a "{}" format string to `Display` the message
|
||||||
|
|
|
|
||||||
LL | assert!(false, "{}", v);
|
LL | assert!(false, "{}", v);
|
||||||
| +++++
|
| +++++
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue