Skip to content

Cleanup some warnings from Clippy#2282

Merged
bors merged 9 commits intorust-lang:masterfrom
mcarton:clippy
Jan 19, 2016
Merged

Cleanup some warnings from Clippy#2282
bors merged 9 commits intorust-lang:masterfrom
mcarton:clippy

Conversation

@mcarton
Copy link
Contributor

@mcarton mcarton commented Jan 15, 2016

For information, here is the log before and after 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

@rust-highfive
Copy link

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@mcarton
Copy link
Contributor Author

mcarton commented Jan 19, 2016

@alexcrichton: done. Is there anything else you’d like to change?

@alexcrichton
Copy link
Member

@bors: r+ ebceb9b

Thanks!

bors added a commit that referenced this pull request Jan 19, 2016
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
```
@bors
Copy link
Contributor

bors commented Jan 19, 2016

⌛ Testing commit ebceb9b with merge 2cb4e91...

@bors
Copy link
Contributor

bors commented Jan 19, 2016

@bors bors merged commit ebceb9b into rust-lang:master Jan 19, 2016
@mcarton mcarton deleted the clippy branch January 19, 2016 23:19
ehuss added a commit to ehuss/cargo that referenced this pull request Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants