Skip to content

Regression in semicolon_if_nothing_returned involving macros #7768

Closed
@dtolnay

Description

@dtolnay

This is minimized from various callers of the quote crate's quote macro. This regression currently affects pretty much all crates that depend on the quote crate.

macro_rules! repro {
    () => {
        while false {
        }
    };
}

fn main() {
    repro!();
}
$ cargo +nightly-2021-10-04 clippy -- -Dclippy::pedantic
    Checking repro v0.0.0
    Finished dev [unoptimized + debuginfo] target(s) in 0.27s

$ cargo +nightly-2021-10-05 clippy -- -Dclippy::pedantic
    Checking repro v0.0.0

error: consider adding a `;` to the last statement for consistent formatting
 --> src/main.rs:9:5
  |
9 |     repro!();
  |     ^^^^^^^^^ help: add a `;` here: `repro!();;`
  |
  = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

error: could not compile `testing` due to previous error

Meta

Rust version (rustc -Vv):

rustc 1.57.0-nightly (003d8d3f5 2021-10-04)
binary: rustc
commit-hash: 003d8d3f56848b6f3833340e859b089a09aea36a
commit-date: 2021-10-04
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions