rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

False positive of `just_underscores_and_digits` when missing R_ANGLE when ending type prameters

Open liquidhelium opened this issue 2 years ago • 1 comments

Summary

As it's said in the title, something like Type<T will trigger this bug.

Lint Name

clippy::just_underscores_and_digits

Reproducer

pub struct Aa<T>(PhantomData<T>);

fn aa(a: Aa<String) {

}

I saw this happen:

warning: consider choosing a more descriptive name
   --> rizlium_editor/src/extensions/editing/world_view/cam_response.rs:130:13
    |
130 | fn aa(a: Aa<String) {
    |             ^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#just_underscores_and_digits
    = note: `#[warn(clippy::just_underscores_and_digits)]` on by default

also, regular "Syntax error" did worked.

Version

rustc 1.75.0 (82e1608df 2023-12-21)
binary: rustc
commit-hash: 82e1608dfa6e0b5569232559e3d385fea5a93112
commit-date: 2023-12-21
host: x86_64-unknown-linux-gnu
release: 1.75.0
LLVM version: 17.0.6

Additional Labels

No response

liquidhelium avatar Feb 16 '24 13:02 liquidhelium

My best guess is that the parser tries to recover while giving the type parameters dummy values (probably using DummyAstNode). I don't really know if it's worth it to fix this

Centri3 avatar Feb 17 '24 09:02 Centri3