Rust-clippy: panic_params: Don't lint non-format-string `{}`

Created on 28 Apr 2017  Â·  6Comments  Â·  Source: rust-lang/rust-clippy

± cargo --version
    cargo 0.19.0-nightly (03efb7fc8 2017-04-23)
± rustc --version
    rustc 1.18.0-nightly (94e884b63 2017-04-27)
± cargo clippy --version
    0.0.128

The following code:

assert!({ true });

triggers the following lint:

warning: you probably are missing some parameter in your format string
 --> src/lib.rs:2:5
  |
2 |     assert!({ true });
  |     ^^^^^^^^^^^^^^^^^^
  |

This is a false positive, because the curly braces are rust code identifiers, not format string tokens.
I use this syntax with the braces to put complex expressions inside the assert!s which should not be part of the regular code.

A-musing L-bug T-AST good-first-issue

Most helpful comment

We should have an A-musing label

All 6 comments

We should have an A-musing label

@oli-obk You can do that by yourself in Issues → Labels (on the right of the search bar).
(took me a while to find that)

xD I know, but I wasn't sure about the resonance I'd get if I start throwing around useless labels

This is now being triggered in UNIC for this assertion: https://github.com/behnam/rust-unic/blob/master/unic/ucd/age/tests/age_tests.rs#L35-L42

I think the problem is that we just get the source for the contained token tree and look there for brackets.

should be easy enough to check whether the token tree starts and ends with quotes

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Riateche picture Riateche  Â·  3Comments

kornelski picture kornelski  Â·  3Comments

matthiaskrgr picture matthiaskrgr  Â·  3Comments

pickfire picture pickfire  Â·  3Comments

0e4ef622 picture 0e4ef622  Â·  3Comments