questionable write_literal warning: write!(f, "{}", "{integer}") #6768
Labels
C-bug
Category: Clippy is not doing the correct thing
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Lint name: write_literal
I tried this code:
In this code we use dummy format string
{}
to insert the string literal "{integer}" because if we hadwrite!(f, "{ìnteger}")
, the{integer}
would not be parsed as a raw literal(?):This is quite an interesting edge-case :)
I'm not sure what the best solution is here, if we can somehow provide a better suggestion or should just ignore literals that enclose anything in curly braces.
Meta
cargo clippy -V
:clippy 0.1.52 (9b471a3 2021-02-19)
rustc -Vv
:rustc 1.52.0-nightly (9b471a3 2021-02-19)
binary: rustc
commit-hash: 9b471a3
commit-date: 2021-02-19
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1
The text was updated successfully, but these errors were encountered: