Skip to content

FromStr improperly implemented for ISO-3166-2. #6

@zeffron

Description

@zeffron

Describe the bug

ISO-3166-2 codes are parsed only when using an _ as the separator instead of the correct -. This means they don't round trip.

Minimal Reproducible Examples (MRE)

use codes_iso_3166::part_2::SubdivisionCode;

fn main() {
    let subdivision: Result<SubdivisionCode, _> = SubdivisionCode::AD_07.code().parse();
    if subdivision.is_err() {
        panic!("{:?}", subdivision);
    }
}

will output thread 'main' panicked at 'Err(UnknownValue { type_name: "SubdivisionCode", value: "AD-07" })', src/main.rs:6:9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions