You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying types
Currently, the str_to_string lint and the needless_closure lint miss the following: x.map(|s| s.to_string()) (where x is an iterator of &str). This can be replaced with x.map(str::to_owned), to both remove the closure and change the function.
The text was updated successfully, but these errors were encountered:
Manishearth
added
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
T-middle
Type: Probably requires verifiying types
A-lint
Area: New lints
labels
Sep 7, 2015
It should be possible to special-case eta_reduction for this. Perhaps with a sort of whitelist of { input_ref: &[RefType], input_type: &[&'static str], method_name: &'static str, replacement: &'static str } or some such. Though I struggle to find more examples than the above and maybe x.map(|s| s.to_string())(where x is already a IntoIter<Item=&String>), which can be completely removed, or changed to clone.
This actually doesn't always work, since autoderef is usually acting when running s.to_owned() over an iterator (it's probably an &String or something since iterators often end up adding more &ptrs)
A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying types
Currently, the
str_to_string
lint and theneedless_closure
lint miss the following:x.map(|s| s.to_string())
(wherex
is an iterator of&str
). This can be replaced withx.map(str::to_owned)
, to both remove the closure and change the function.The text was updated successfully, but these errors were encountered: