Skip to content

Commit

Permalink
Remove log4rs workaround from bail macro
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 21, 2022
1 parent 6833150 commit 4c198e3
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,8 @@
/// # Ok(())
/// # }
/// ```
#[cfg(doc)]
#[macro_export]
macro_rules! bail {
($msg:literal $(,)?) => {
return $crate::private::Err($crate::__anyhow!($msg))
};
($err:expr $(,)?) => {
return $crate::private::Err($crate::__anyhow!($err))
};
($fmt:expr, $($arg:tt)*) => {
return $crate::private::Err($crate::__anyhow!($fmt, $($arg)*))
};
}

// Workaround for crates that intentionally contained `{}` in an error message
// prior to https://github.com/dtolnay/anyhow/issues/55 catching the missing
// format args.
#[cfg(not(doc))]
#[macro_export]
macro_rules! bail {
// https://github.com/estk/log4rs/blob/afa0351af56b3bfd1780389700051d7e4d8bbdc9/src/append/rolling_file/policy/compound/roll/fixed_window.rs#L261
("pattern does not contain `{}`") => {
return $crate::private::Err($crate::Error::msg("pattern does not contain `{}`"))
};
($msg:literal $(,)?) => {
return $crate::private::Err($crate::__anyhow!($msg))
};
Expand Down

0 comments on commit 4c198e3

Please sign in to comment.