Skip to content

support partial type hints #9508

Closed
Closed
@thestinger

Description

@thestinger

I want to be able to write this:

let xs: HashSet<_> = iter.collect();

rather than:

let xs: HashSet<SomeLongType<A, B>> = iter.collect();

I really don't like the idea of having special cases like to_owned_vec in std::iter to work around this issue:

fn to_owned_vec(&mut self) -> ~[A] {
    self.collect()
}

It doesn't fix the pain in the general case, and encourages using a specific container we special case rather than the right container for the use case. I think this problem will come up frequently with generic code, and the _ syntax would feel right at home with the usage elsewhere.

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