Skip to content
New issue

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

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

Already on GitHub? # to your account

Bypass anyhow_kind-based dispatch for ensure! with default msg #170

Merged
merged 1 commit into from
Oct 10, 2021

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Oct 10, 2021

For ensure!(1 < 2), Before:

if !(1 < 2) {
    return $crate::private::Err({
        use $crate::private::kind::*;
        match "Condition failed: `1 < 2`" {
            error => (&error).anyhow_kind().new(error),
        }
    });
}

After:

if !(1 < 2) {
    return $crate::private::Err($crate::private::new_adhoc("Condition failed: `1 < 2`"));
}

@dtolnay dtolnay merged commit 74fd4a2 into master Oct 10, 2021
@dtolnay dtolnay deleted the ensure branch October 10, 2021 20:26
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant