Skip to content
This repository was archived by the owner on Jul 14, 2018. It is now read-only.
This repository was archived by the owner on Jul 14, 2018. It is now read-only.

Improved match ergonomics around references #24

Open
@nrc

Description

@nrc

Point of contact

@nrc

Overview

Make match easier to use and less boilerplate-y by auto-dereferencing in the condition expression and inferring refs in the patterns.

E.g.,

fn foo(x: &AnEnum) {
    match x {
        AnEnum::VariantA(y) => { ... }
        AnEnum::VariantB(y, z) => { ... }
    }
}

rather than (currently):

fn foo(x: &AnEnum) {
    match *x {
        AnEnum::VariantA(ref y) => { ... }
        AnEnum::VariantB(ref y, ref z) => { ... }
    }
}

Status

Accepted as RFC 2005.

cc #17

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