@@ -21,42 +21,6 @@ macro_rules! e {
2121 } ;
2222}
2323
24- /// Constructs an error enum/struct value and wraps it in `Err(err)`.
25- ///
26- /// See [`e`] for supported syntax.
27- #[ deprecated]
28- #[ macro_export]
29- macro_rules! Err {
30- ( $( $tt: tt) * ) => {
31- :: core:: result:: Result :: Err ( $crate:: e!( $( $tt) * ) )
32- }
33- }
34-
35- /// Propagates an error, adding formatted context.
36- ///
37- /// - `whatever!("msg")` returns `Err(format_err!(...))`.
38- /// - `whatever!(source, "msg {x}", x)` unwraps `source` or returns with context.
39- #[ deprecated]
40- #[ macro_export]
41- macro_rules! whatever {
42- ( $fmt: literal$( , $( $arg: expr) ,* $( , ) ?) ?) => {
43- return :: core:: result:: Result :: Err ( {
44- $crate:: format_err!( $fmt$( , $( $arg) ,* ) * )
45- } ) ;
46- } ;
47- ( $result: expr, $fmt: literal$( , $( $arg: expr) ,* $( , ) ?) * ) => {
48- match $result {
49- :: core:: result:: Result :: Ok ( v) => v,
50- :: core:: result:: Result :: Err ( e) => {
51- let context = :: std:: format!( $fmt$( , $( $arg) ,* ) * ) ;
52- return :: core:: result:: Result :: Err (
53- $crate:: anyerr!( e) . context( context)
54- ) ;
55- }
56- }
57- } ;
58- }
59-
6024/// Unwraps a result, returning in the error case while converting the error.
6125///
6226/// If the result is the error variant, this will construct a new error with [`e`]
0 commit comments