Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Clippy suggestions #5070

Merged
merged 4 commits into from
Feb 27, 2018
Merged

Some Clippy suggestions #5070

merged 4 commits into from
Feb 27, 2018

Conversation

Eh2406
Copy link
Contributor

@Eh2406 Eh2406 commented Feb 24, 2018

This is just some suggestions from Clippy and intellij rust.

Clippy still has a lot to say, but this is some of the simple things.

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

@bors
Copy link
Contributor

bors commented Feb 24, 2018

☔ The latest upstream changes (presumably #4978) made this pull request unmergeable. Please resolve the merge conflicts.

@Eh2406
Copy link
Contributor Author

Eh2406 commented Feb 25, 2018

rebased

@bors
Copy link
Contributor

bors commented Feb 25, 2018

☔ The latest upstream changes (presumably #5044) made this pull request unmergeable. Please resolve the merge conflicts.

@Eh2406
Copy link
Contributor Author

Eh2406 commented Feb 25, 2018

rebased

@@ -454,7 +454,7 @@ impl<'cfg> Registry for PackageRegistry<'cfg> {
// If we don't have an override then we just ship
// everything upstairs after locking the summary
(None, Some(source)) => {
for patch in patches.iter() {
for patch in &patches {
Copy link
Member

Choose a reason for hiding this comment

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

Historically, I believe @alexcrichton preferred the .iter form, because it is more explicit. I personally also favor .iter().

However this definitely contradicts clippy's default, and there's certain benefit in sticking with defaults...

@alexcrichton do you have any plan here? Should we

  1. Persuade clippy folks that .iter() is better and switch clippy's default :)
  2. Give up on our preferences and just switch from .iter to & everywhere?
  3. Configure clippy in Cargo.toml, so that it does not give this warning
  4. Continue to reject PRs with this change once in a while

Copy link
Contributor Author

@Eh2406 Eh2406 Feb 25, 2018

Choose a reason for hiding this comment

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

Continue to reject PRs with this change once in a while

I am sorry. I should have checked whether this has come up before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once this is decided I am happy to redo the other changes in this PR and re submit.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I personally prefer .iter() as I find for x in &foo to be less clear and also slightly less readable, but again that's mostly personal preference

Copy link
Member

Choose a reason for hiding this comment

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

@alexcrichton @Eh2406 let's try to add an exception for this rule to Cargo.toml than?

Although we don't run Clippy on Cargo on CI, it'll help people who do so locally!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will re do this pr without all of them, next time I have spare cycles. :-)

Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks @Eh2406!

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I'd be fine adding an exception!

find_candidate(&mut backtrack_stack,
&mut cx,
&mut remaining_deps,
&mut parent,
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the formatting got funky around here?

(cherry picked from commit 24836e9)
(cherry picked from commit de9a7b9)
@Eh2406
Copy link
Contributor Author

Eh2406 commented Feb 27, 2018

Redone mostly by hand, sorry about the force push. This time with allow(explicit_iter_loop)

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Feb 27, 2018

📌 Commit 1ef675e has been approved by alexcrichton

bors added a commit that referenced this pull request Feb 27, 2018
Some Clippy suggestions

This is just some suggestions from Clippy and intellij rust.

Clippy still has a lot to say, but this is some of the simple things.
@bors
Copy link
Contributor

bors commented Feb 27, 2018

⌛ Testing commit 1ef675e with merge 3361918...

@bors
Copy link
Contributor

bors commented Feb 27, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 3361918 to master...

@bors bors merged commit 1ef675e into rust-lang:master Feb 27, 2018
@Eh2406 Eh2406 deleted the clippy branch February 27, 2018 14:45
@@ -2,6 +2,11 @@
#![cfg_attr(test, deny(warnings))]
#![recursion_limit="128"]

// Currently, Cargo does not use clippy for its source code.
// But if someone runs it they should know that
// @alexcrichton disagree with clippy on some style things
Copy link
Member

Choose a reason for hiding this comment

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

lol 😂

@ehuss ehuss added this to the 1.26.0 milestone Feb 6, 2022
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.

7 participants