shepmaster / snafu

Easily assign underlying errors into domain-specific errors while adding context
https://docs.rs/snafu/
Apache License 2.0
1.45k stars 61 forks source link

Enhance `ensure` macro to allow trailing commas #243

Closed shepmaster closed 4 years ago

Henning-K commented 4 years ago

For clarification: Do you mean "trailing comma" as in (drawing on the example from the docs):

ensure!(user_id > 0, InvalidUser {user_id}, );
------------------------------------------^

Or that the part after the first comma can be missing, because that doesn't really make sense.

EDIT 2020-09-18: After nine days of radio silence I'll now just assume the first option of the original comment was the intended modification.

shepmaster commented 4 years ago

Sorry! I marked this notification as read without responding to it. Yes, the goal is to support

ensure!(
    some_long_condition,
    AnotherLongThing { more_long },
    // ---------------------------^
);