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

also lint on items after statements in macros #578

Closed
oli-obk opened this issue Jan 24, 2016 · 2 comments · Fixed by #6176
Closed

also lint on items after statements in macros #578

oli-obk opened this issue Jan 24, 2016 · 2 comments · Fixed by #6176
Labels
C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy T-macros Type: Issues with macros and macro expansion

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Jan 24, 2016

This is currently disabled, because it would make e.g. the regex! macro very annoying. Should probably be turned on after regex! has been fixed.

@Manishearth Manishearth added C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages labels Jan 28, 2016
@Ryan1729
Copy link
Contributor

The regex! macro seems to be no more. It's unclear how many other macros would trigger this lint, now though.

Just because I had to edit github urls to find it for context, here's a link to the original lint on items after statements PR

@flip1995
Copy link
Member

#![warn(clippy::items_after_statements)]

macro_rules! m {
    () => {{
        f();
        fn f() { println!("Hi"); }
    }};
}

fn main() {
    m!();
}

Does not emit a warning currently: Playground. I don't see a reason, why we shouldn't lint this in local macros.

@flip1995 flip1995 added good-first-issue These issues are a good way to get started with Clippy T-macros Type: Issues with macros and macro expansion labels Jul 31, 2020
bors added a commit that referenced this issue Oct 29, 2020
Lint items after statements in local macro expansions

The items_after_statements lint was skipping all expansions.  Instead
we should still lint local macros.

Fixes #578

---

*Please keep the line below*
changelog: The items_after_statements now applies to local macro expansions
@bors bors closed this as completed in 32e2021 Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy T-macros Type: Issues with macros and macro expansion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants