Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update (1.5.5 -> 2.1.1) broke my code #430

Closed
matthiasbeyer opened this issue Feb 20, 2016 · 1 comment
Closed

Update (1.5.5 -> 2.1.1) broke my code #430

matthiasbeyer opened this issue Feb 20, 2016 · 1 comment

Comments

@matthiasbeyer
Copy link
Contributor

Nothing critical, though you might want to know:

if let Some(spec) = matches.values_of("header") {
    // ...
    debug!("{:?}", spec);
}

As the return value of the ArgMatches::values_of() now returns something which does not implement Debug, the update ended in a compile error.

ArgMatches::values_of returns an Values now which implements Iterator (should not break any code)

As said, this is nothing serious for me, and this issue is just FYI. Feel free to close this issue after reading.

@kbknapp
Copy link
Member

kbknapp commented Feb 22, 2016

Yeah, there were a few breaking changes from 1x to 2x, hence the major version bump. 😄

Now for your specific issue, instead of returning a Vec like we used to, that method now returns an iterator which is far more flexible, but it does have the downside like you noted. To fix that code, all you need to do is add

if let Some(spec) = matches.values_of("header") {
    // ...
    debug!("{:?}", spec.collect::<Vec<_>>());
}

I'll leave this open until you confirm that works for you 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants