rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Add suggestion to useless_format

Open killercup opened this issue 8 years ago • 1 comments

Just saw this code produce this error

warning: useless use of `format!`
 --> src/main.rs:2:39
  |
2 |     let _foo = Some(42).ok_or_else(|| format!("baz"));
  |                                       ^^^^^^^^^^^^^^
  |
  = note: #[warn(useless_format)] on by default
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.187/index.html#useless_format

which has no suggestion. We should add one that suggests "baz".to_string().

killercup avatar Mar 04 '18 16:03 killercup

I'd like to work on this issue if that's alright!

Baelyk avatar Mar 16 '18 23:03 Baelyk