Skip to content

Hide type inlay hints for enum variant constructors and tuple struct constructors with annoated generics #10446

Closed
@Veykril

Description

@Veykril

Improvement for #10441

struct Struct<T, U>(T, U);

enum Enum {
    Variant(u32)
}

fn main() {
    let foo = Struct::<u32, u32>(0, 0);
    let foo = Enum::Variant(0);
}

This will currently give type hints for the two let bindings but ideally we shouldn't need to show these here either.

This should be simple to fix, for the enum case we just need to special case a branch here https://github.com/rust-analyzer/rust-analyzer/blob/4b7675fcc30d3e2c05eafc68a5724db66b58142c/crates/ide/src/inlay_hints.rs#L268-L274
to instead check for the paths qualifier segment instead of the immediate, that is check the enum part instead of the variant.

For the tuple struct part we need to basically just do whats being down a few lines below that snippet for the immediate path segment instead of the qualifier.

Metadata

Metadata

Assignees

Labels

A-inlay-hintsinlay/inline hintsE-easyE-has-instructionsIssue has some instructions and pointers to code to get startedS-actionableSomeone could pick this issue up and work on it right nowgood first issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions