Skip to content

Strip underscores from function arguments for completion #4510

@YaLTeR

Description

@YaLTeR
fn innermost(_marker: i32) {

}

fn intermediate(marker: i32) {
    innermost<complete here>
}

fn main() {
    let marker = 0;
    intermediate(marker);
}

изображение

I'm using this pattern for statically enforcing "being on the main thread"—the marker is a special struct that's unsafely instantiated at known points "on the main thread" and then passed down as arguments to functions that must only be called from the main thread. Naturally, the inner-most functions accept the marker with an underscore as they don't actually use it (all they need is the fact that the caller has one). However, this means that when completing these innermost functions I get a _marker completion instead of marker and have to fix it manually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions