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

literal_string_with_formatting_args triggered by cfg_attr feature #14041

Closed
messense opened this issue Jan 20, 2025 · 2 comments
Closed

literal_string_with_formatting_args triggered by cfg_attr feature #14041

messense opened this issue Jan 20, 2025 · 2 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@messense
Copy link
Contributor

messense commented Jan 20, 2025

Summary

Beta clippy starts to trigger this in pyo3/pyo3

Lint Name

literal_string_with_formatting_args

Reproducer

I tried this code:

#![warn(missing_docs)]
#![cfg_attr(
    feature = "nightly",
    feature(auto_traits, negative_impls, try_trait_v2)
)]

I saw this happen:

error: this looks like a formatting argument but it is not part of a formatting macro
   --> src/lib.rs:3:22
    |
  3 |       feature = "nightly",
    |  ______________________^
  4 | |     feature(auto_traits, negative_impls, try_trait_v2)
    | |_^
    |

I expected to see this happen: no warning/error

Version

rustc 1.85.0-beta.4 (752fecf80 2025-01-17)
binary: rustc
commit-hash: 752fecf8005cd7a7ae8c0b74d0f8fc3cd3cd86fe
commit-date: 2025-01-17
host: x86_64-unknown-linux-gnu
release: 1.85.0-beta.4
LLVM version: 19.1.7

Additional Labels

No response

@messense messense added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Jan 20, 2025
@y21
Copy link
Member

y21 commented Jan 20, 2025

Probably a duplicate of #13885. That is, the issue is likely not related to cfg_attr, but that it emits a warning on a dummy span, as you can tell by the fact the warning points somewhere in the middle of a string.

@messense
Copy link
Contributor Author

@y21 Thanks for the reply, marked as duplicate.

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 I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

No branches or pull requests

2 participants