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

Replace otry! macro with ? #43

Closed
maxbla opened this issue Apr 19, 2019 · 4 comments
Closed

Replace otry! macro with ? #43

maxbla opened this issue Apr 19, 2019 · 4 comments

Comments

@maxbla
Copy link
Contributor

maxbla commented Apr 19, 2019

lib.rs defines the otry! macro like this:

// Like `std::try!` for Option<T>, unwrap the value or early-return None.
// Since Rust 1.22 this can be replaced by the `?` operator.
macro_rules! otry {
    ($expr:expr) => {
        match $expr {
            Some(val) => val,
            None => return None,
        }
    };
}

Is this project trying to maintain backwards compatibility to before 1.22? Is there some other reason not to replace every instance of otry! with ? ?

It appears as if the otry! macro is used only a handful of times, so it could be fairly easily replaced.

@hauleth
Copy link
Member

hauleth commented Apr 19, 2019

Yes, this library maintain compatibility with Rust 1.15+

@maxbla maxbla mentioned this issue Apr 19, 2019
@maxbla
Copy link
Contributor Author

maxbla commented Apr 19, 2019

Do you mind me asking why?

@hauleth
Copy link
Member

hauleth commented Apr 19, 2019

No, I am telling you that backwards compatibility will stay, so you need to use otry! in #42.

@cuviper
Copy link
Member

cuviper commented Jun 14, 2019

I prefer to maintain compatibility as much as possible. While ? for Option is certainly pleasant, it's not a big deal to just use otry!.

@cuviper cuviper closed this as completed Jun 14, 2019
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

3 participants