mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Fix USELESS_FORMAT
wiki
This commit is contained in:
parent
9c36736f51
commit
d77ccdc338
1 changed files with 5 additions and 4 deletions
|
@ -5,15 +5,16 @@ use syntax::ast::LitKind;
|
|||
use utils::{DISPLAY_FMT_METHOD_PATH, FMT_ARGUMENTS_NEWV1_PATH};
|
||||
use utils::{is_expn_of, match_path, span_lint};
|
||||
|
||||
/// **What it does:** This lints about use of `format!("string literal with no argument")`.
|
||||
/// **What it does:** This lints about use of `format!("string literal with no argument")` and
|
||||
/// `format!("{}", foo)`.
|
||||
///
|
||||
/// **Why is this bad?** There is no point of doing that. If you want a `String` you can use
|
||||
/// `to_owned` on the string literal. The even worse `&format!("foo")` is often encountered in the
|
||||
/// wild.
|
||||
/// `to_owned` on the string literal or expression. The even worse `&format!("foo")` is often
|
||||
/// encountered in the wild.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:** `format!("foo")`
|
||||
/// **Examples:** `format!("foo")` and `format!("{}", foo)`
|
||||
declare_lint! {
|
||||
pub USELESS_FORMAT,
|
||||
Warn,
|
||||
|
|
Loading…
Reference in a new issue