warn on empty precision by hkBst · Pull Request #136638 · rust-lang/rust (original) (raw)

@samueltardieu: could you explain whether it is feasible to lint format macro syntax (like in this PR) within clippy?

We can do this as we have access to the parsed format specifier as well as the original source code. However, unless I'm mistaken, this might require an error-prone reparsing because:

This would be easier if the span of the precision was available outside the precision (so that we can get a None precision with an associated Some(_) span containing "."). Would this be worth it? Another option would be to add a FormatCount::Empty variant, but it would complicate the usage logic a bit (I haven't checked the details).