Skip to content

Resolve some Clippy warnings#5835

Merged
bors merged 9 commits into
rust-lang:masterfrom
dwijnand:clippy
Jul 31, 2018
Merged

Resolve some Clippy warnings#5835
bors merged 9 commits into
rust-lang:masterfrom
dwijnand:clippy

Conversation

@dwijnand

Copy link
Copy Markdown
Contributor

I'm not sure how these popped up since my PR 8 days ago.

My current hypotheses:

  • changes in latest nightly rust/clippy
  • new or changed cargo code
  • I missed these as I was only touching src/bin/cargo/main.rs

For future reference I now iterate with:

touch src/bin/cargo/main.rs src/cargo/lib.rs && cargo +nightly clippy

dwijnand added 2 commits July 31, 2018 09:58
I'm confused.  Now this is duplicated with src/bin/cargo/main.rs and I
don't know how to avoid that.  Tips welcome.
@rust-highfive

Copy link
Copy Markdown

r? @matklad

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

@dwijnand

Copy link
Copy Markdown
Contributor Author

Feedback welcome 🙂

@alexcrichton

Copy link
Copy Markdown
Member

FWIW I'm personally not a huge fan of #[cfg] annotations all through for various clippy lints, it's sort of the exact reason why I'm not a fan of clippy in general (it's too overzealous in linting). This certainly isn't specific to this PR though! In general I'm not a huge fan of clippy, so nothing against this PR itself :)

Is there perhaps a different location (not in the source code) that lints could be turned off?

@dwijnand

Copy link
Copy Markdown
Contributor Author

Maybe after #5728 is merged and we're dogfooding that? Though that would only work for the ones we're happy to toggle "globally".

dwijnand added 6 commits July 31, 2018 15:12
TIL Rust doesn't have equational reasoning.. :-/
(can't inline the new "exec" bindings)
.. by inlining & removing `Members::is_empty`.

For details see
https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#wrong_self_convention

Asides from opt-ing out, the alternative I saw was calling it
"into_empty" and make it return a little

    enum Empty { Empty, NonEmpty }

type.
@dwijnand

Copy link
Copy Markdown
Contributor Author

Fixed up a commit where I'd forgotten to adapt the test sources too.

@dwijnand

Copy link
Copy Markdown
Contributor Author

Now that I think of it, @alexcrichton, clippy configuration is also being discussed in the Clippy 1.0 RFC (rust-lang/rfcs#2476), if you want to get stuck in. 😄

@alexcrichton

Copy link
Copy Markdown
Member

Perhaps for now the lints could all be applied globally in src/cargo/lib.rs and grouped there? It will turn off unnecessarily in some circumstances but I think that's fine.

@alexcrichton

Copy link
Copy Markdown
Member

@bors: r+

Thanks!

@bors

bors commented Jul 31, 2018

Copy link
Copy Markdown
Contributor

📌 Commit 0807730 has been approved by alexcrichton

@bors

bors commented Jul 31, 2018

Copy link
Copy Markdown
Contributor

⌛ Testing commit 0807730 with merge 72eee12...

bors added a commit that referenced this pull request Jul 31, 2018
Resolve some Clippy warnings

I'm not sure how these popped up since my PR 8 days ago.

My current hypotheses:
* changes in latest nightly rust/clippy
* new or changed cargo code
* I missed these as I was only touching `src/bin/cargo/main.rs`

For future reference I now iterate with:

    touch src/bin/cargo/main.rs src/cargo/lib.rs && cargo +nightly clippy
@bors

bors commented Jul 31, 2018

Copy link
Copy Markdown
Contributor

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

@bors bors merged commit 0807730 into rust-lang:master Jul 31, 2018
@dwijnand dwijnand deleted the clippy branch August 1, 2018 05:49
@ehuss ehuss added this to the 1.29.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.

6 participants