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

Fix false positives for implicit_return and empty_loop on macro expansion. #3577

Merged
merged 4 commits into from
Dec 27, 2018
Merged

Fix false positives for implicit_return and empty_loop on macro expansion. #3577

merged 4 commits into from
Dec 27, 2018

Conversation

daxpedda
Copy link
Contributor

This PR only fixes implicit_return and empty_loop.
But I suspect this bug may affect a lot of other lints.

@flip1995
Copy link
Member

LGTM! We already have a convenience function to check for macro expansions:

/// Returns true if this `expn_info` was expanded by any macro.
pub fn in_macro(span: Span) -> bool {
span.ctxt().outer().expn_info().is_some()
}

Please use this function instead of the macro_backtrace function.

@daxpedda
Copy link
Contributor Author

Done.

clippy_lints/src/loops.rs Outdated Show resolved Hide resolved
Co-Authored-By: daxpedda <1645124+daxpedda@users.noreply.github.com>
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Thanks! There's currently something wrong with travis. I'll merge this as soon as travis works again.

@flip1995 flip1995 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 25, 2018
@daxpedda
Copy link
Contributor Author

Yeah: rust-lang/rust#57111.
Hopefully nightly will work tomorrow again.

@flip1995

This comment has been minimized.

bors added a commit that referenced this pull request Dec 25, 2018
Fix false positives for `implicit_return` and `empty_loop` on macro expansion.

This PR only fixes `implicit_return` and `empty_loop`.
But I suspect this bug may affect a lot of other lints.
@bors

This comment has been minimized.

@bors

This comment has been minimized.

@flip1995
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 26, 2018

📌 Commit 1979144 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Dec 26, 2018

⌛ Testing commit 1979144 with merge 71c5a0d...

bors added a commit that referenced this pull request Dec 26, 2018
Fix false positives for `implicit_return` and `empty_loop` on macro expansion.

This PR only fixes `implicit_return` and `empty_loop`.
But I suspect this bug may affect a lot of other lints.
@bors
Copy link
Contributor

bors commented Dec 26, 2018

💔 Test failed - status-appveyor

@daxpedda
Copy link
Contributor Author

😕 that's not me is it?
https://ci.appveyor.com/project/rust-lang-libs/rust-clippy/builds/21236656#L766

+error: type parameter `u32` should have a camel case name such as `U32`
+  --> $DIR/builtin-type-shadow.rs:12:8
+   |
+12 | fn foo<u32>(a: u32) -> u32 {
+   |        ^^^
+   |
+   = note: `-D non-camel-case-types` implied by `-D warnings`
+

@flip1995
Copy link
Member

Oh yeah this is fixed in #3581

@flip1995
Copy link
Member

@bors rollup

flip1995 added a commit to flip1995/rust-clippy that referenced this pull request Dec 26, 2018
Fix false positives for `implicit_return` and `empty_loop` on macro expansion.

This PR only fixes `implicit_return` and `empty_loop`.
But I suspect this bug may affect a lot of other lints.
bors added a commit that referenced this pull request Dec 26, 2018
Rollup of 2 pull requests

Successful merges:

 - #3577 (Fix false positives for `implicit_return` and `empty_loop` on macro expansion.)
 - #3579 (update CARGO_CLIPPY_HELP string to suggest tool lints.)

Failed merges:

r? @ghost
@flip1995
Copy link
Member

Please run rustfmt

@flip1995 flip1995 added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Dec 26, 2018
@daxpedda
Copy link
Contributor Author

And here I was sure I didn't forget anything this time.
Thanks for being so meticulous.

@flip1995
Copy link
Member

Thanks for being so meticulous.

That's not me, that's our CI 😄

@bors r+ Thanks!

@bors
Copy link
Contributor

bors commented Dec 27, 2018

📌 Commit 2d96ef1 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Dec 27, 2018

⌛ Testing commit 2d96ef1 with merge 721f688...

bors added a commit that referenced this pull request Dec 27, 2018
Fix false positives for `implicit_return` and `empty_loop` on macro expansion.

This PR only fixes `implicit_return` and `empty_loop`.
But I suspect this bug may affect a lot of other lints.
@bors
Copy link
Contributor

bors commented Dec 27, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: flip1995
Pushing 721f688 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants