-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
nonstandard_macro_braces false positive #7434
Comments
This also seems to happen with my crate Issue I got: Lymia/enumset#25 |
And another data point:
with the source: #[pymethods]
impl Instruction {
/// the length in bytes of the instruction.
#[getter]
pub fn length(&self) -> u8 {
self.inner.length as u8
} |
I wonder if this was introduced with #7431. @DevinR528 does this look familiar? |
I'm making the assumption that that commit (#7431) is not in a released version of clippy? There was this issue #7422 and then the PR to close it so hopefully, the problem is that the fix just hasn't gotten into a release. It also shouldn't be warning without the lint being explicitly turned on because it was moved to |
Although I don't know the details of that lint, we perform the sync between Clippy and rust-lang/rust every other week. So that fixes might not be applied in latest nightly yet. |
This warning is firing for Mockall, too. It looks like every project that uses Mockall will trigger the warning, and Clippy's suggested replacement code doesn't even compile. |
Also seems to happen for Rocket attributes like |
This likely happens for any procedural macro that uses one of the macros checked by this lint. This jives with what is described in #7431 For example, in SNAFU, the procedural macro does: let match_arm = quote! {
#pattern_ident { #field_names } => {
write!(#FORMATTER_ARG, #format)
}
}; This generates code like Error :: Leaf { ref user_id } =>
{ write! (__snafu_display_formatter, stringify! (Leaf)) } Note the spaces between |
It seems this issue was fixed, probably by #7431 . Can it be closed? |
Yes, so I'm closing this. Thanks for the reports! |
Lint name: nonstandard_macro_braces
I tried this code:
I expected to see no warnings
Instead, this happened (
cargo +nightly clippy
):context macro sources
Meta
cargo clippy -V
: clippy 0.1.53 (53cb7b0 2021-06-17)cargo +nightly clippy -V
: clippy 0.1.55 (b3d11f9 2021-07-04)rustc -Vv
:The text was updated successfully, but these errors were encountered: