mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 14:38:46 +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::{DISPLAY_FMT_METHOD_PATH, FMT_ARGUMENTS_NEWV1_PATH};
|
||||||
use utils::{is_expn_of, match_path, span_lint};
|
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
|
/// **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
|
/// `to_owned` on the string literal or expression. The even worse `&format!("foo")` is often
|
||||||
/// wild.
|
/// encountered in the wild.
|
||||||
///
|
///
|
||||||
/// **Known problems:** None.
|
/// **Known problems:** None.
|
||||||
///
|
///
|
||||||
/// **Example:** `format!("foo")`
|
/// **Examples:** `format!("foo")` and `format!("{}", foo)`
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
pub USELESS_FORMAT,
|
pub USELESS_FORMAT,
|
||||||
Warn,
|
Warn,
|
||||||
|
|
Loading…
Add table
Reference in a new issue