Cleanup some warnings from Clippy#2282
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
src/bin/cargo.rs
Outdated
There was a problem hiding this comment.
Currently in Cargo it's more idiomatic to just remember that .to_string() always works as opposed to switching between one of .to_owned(), .cloned(), or .to_string() as appropriate, so could these be backed out for now?
Fix all Clippy’s needless_lifetimes warnings.
Fix most of Clippy’s needless_return warnings. Remaining cases are false positives.
Fix all Clippy’s len_without_is_empty warnings.
Fix all of Clippy’s len_zero warnings.
Fix all Clippy’s redundant_closure warnings.
Fix all Clippy’s single_match warnings.
Fix all of Clippy’s unnecessary_mut_passed warnings.
Fix some Clippy’s string_to_string warnings.
Fix most of Clippy’s map_clone warnings.
|
@alexcrichton: done. Is there anything else you’d like to change? |
For information, here is the [log before and after](https://gist.github.com/mcarton/684c030321c4c60d6bc9) with Clippy. Remaining warnings from Clippy are mostly false positive or `str` to `string` conversion (too many of them for this PR). ``` warnings before: cmp_owned : 2 cyclomatic_complexity : 1 deprecated : 11 explicit_iter_loop : 57 identity_op : 3 len_without_is_empty : 3 len_zero : 20 let_and_return : 3 map_clone : 14 needless_lifetimes : 4 needless_return : 24 ok_expect : 2 option_map_unwrap_or : 10 private_in_public : 28 redundant_closure : 2 should_implement_trait : 2 single_match : 3 str_to_string : 112 string_to_string : 12 type_complexity : 3 unnecessary_mut_passed : 2 unneeded_field_pattern : 3 unused_lifetimes : 1 unused_variables : 2 while_let_loop : 2 warnings after: cmp_owned : 2 cyclomatic_complexity : 1 identity_op : 1 let_and_return : 3 map_clone : 1 needless_return : 3 ok_expect : 2 option_map_unwrap_or : 1 private_in_public : 28 should_implement_trait : 2 str_to_string : 80 type_complexity : 3 while_let_loop : 2 ```
|
☀️ Test successful - cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
For information, here is the log before and after with Clippy.
Remaining warnings from Clippy are mostly false positive or
strtostringconversion (too many of them for this PR).