Skip to content

false positive nonstandard_macro_braces in derive macro #7547

Closed
@caudate-julie

Description

@caudate-julie

Lint name:
nonstandard_macro_braces

I tried this code:

// [dependencies]
// postgres-types = { version = "0.2.1", features = ["derive"] }

#[derive(postgres_types::FromSql)]
enum Example {
    Hello,
    World
}

I expected to see no clippy lints.

Instead, I got:

warning: use of irregular braces for `format!` macro
 --> src\main.rs:1:10
  |
1 | #[derive(postgres_types::FromSql)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(clippy::nonstandard_macro_braces)]` on by default
help: consider writing `postgres_types::FromSql`
 --> src\main.rs:1:10
  |
1 | #[derive(postgres_types::FromSql)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonstandard_macro_braces
  = note: this warning originates in the derive macro `postgres_types::FromSql` (in Nightly builds, run with -Z macro-backtrace for more info)

Issue was reported in postgres, but they say it's probably a bug on clippy side.

Meta

  • cargo clippy -V: clippy 0.1.55 (d2b04f0 2021-07-07)
  • rustc -Vv:
rustc 1.55.0-nightly (d2b04f075 2021-07-07)
binary: rustc
commit-hash: d2b04f075c0ce010758c4c8674152ff89d1d73f3
commit-date: 2021-07-07
host: x86_64-pc-windows-msvc
release: 1.55.0-nightly
LLVM version: 12.0.1

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