Skip to content

getopts copy parameters #4017

Closed
Closed
@Aatch

Description

@Aatch

Rust 0.4 throws warnings about non-implicitly copyable types when using getopts in (what I consider) to be normal usage

let matches = match getopts(args, opts) {
   result::Ok(m)  => copy m, //Need to copy... Not expected, but understandable
   result::Err(f) => fail fail_str(copy f) //Need to copy here too, but it's a failure!
}

let thing = if opt_present(copy matches, "o") { // Not expected here either
    "o given"
} else {
    "o not given"
}

I'm sure some of it is me failing at the language, but it's a major toe-stub since I'm not expecting to have to copy everything around, especially when I'm not expecting any of the functions to change the data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions