Open
Description
Clippy rightfully suggests to simplify a map
with a as_str ()
in the closure to us as_str
directly. However the given suggestion is a bit too complicated and verbose given that the String
module is always imported:
warning: redundant closure found
--> src/main.rs:317:30
|
317 | version.as_ref().map(|v| v.as_str()),
| ^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::String::as_str`
|
= note: #[warn(clippy::redundant_closure)] on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
It would be gread if the lint would say:
^^^^^^^^^^^^^^ help: remove closure as shown: `String::as_str`
instead.
The version is:
clippy 0.0.212 (1fac3808 2019-02-20)