Enum path inference with `_Variant` syntax

Well, the whole existence of inference is about not writing types, as is method syntax.

It's interesting that it's .map(|x| x.ok()), but .map(Result::ok). If _::Variant works, though, should .map(_::ok) work too? I don't know.

Here's a previous post with a bunch of examples of places where inference already allows APIs that can do things without saying the types involved:

But the situation that seems most clear to me is in struct literals.

Options {
    cookie_handling: CookieHandling::Skip,
    ..
}

That's pretty repetitive. Having just

```rust
Options {
    cookie_handling: .Skip,
    ..
}

seems quite reasonable to me.

2 Likes