rust: Use 2021 eition
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rs"
|
name = "rs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "rs"
|
name = "rs"
|
||||||
|
|||||||
@ -95,56 +95,56 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
/// ```
|
/// ```
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! assert_matches {
|
macro_rules! assert_matches {
|
||||||
( $e:expr , $($pat:pat)|+ ) => {
|
( $e:expr , $($pat:pat_param)|+ ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ => (),
|
$($pat)|+ => (),
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
||||||
e, stringify!($($pat)|+))
|
e, stringify!($($pat)|+))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ if $cond:expr ) => {
|
( $e:expr , $($pat:pat_param)|+ if $cond:expr ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ if $cond => (),
|
$($pat)|+ if $cond => (),
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
||||||
e, stringify!($($pat)|+ if $cond))
|
e, stringify!($($pat)|+ if $cond))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ => $arm:expr ) => {
|
( $e:expr , $($pat:pat_param)|+ => $arm:expr ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ => $arm,
|
$($pat)|+ => $arm,
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
||||||
e, stringify!($($pat)|+))
|
e, stringify!($($pat)|+))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ if $cond:expr => $arm:expr ) => {
|
( $e:expr , $($pat:pat_param)|+ if $cond:expr => $arm:expr ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ if $cond => $arm,
|
$($pat)|+ if $cond => $arm,
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`",
|
||||||
e, stringify!($($pat)|+ if $cond))
|
e, stringify!($($pat)|+ if $cond))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ , $($arg:tt)* ) => {
|
( $e:expr , $($pat:pat_param)|+ , $($arg:tt)* ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ => (),
|
$($pat)|+ => (),
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
||||||
e, stringify!($($pat)|+), format_args!($($arg)*))
|
e, stringify!($($pat)|+), format_args!($($arg)*))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ if $cond:expr , $($arg:tt)* ) => {
|
( $e:expr , $($pat:pat_param)|+ if $cond:expr , $($arg:tt)* ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ if $cond => (),
|
$($pat)|+ if $cond => (),
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
||||||
e, stringify!($($pat)|+ if $cond), format_args!($($arg)*))
|
e, stringify!($($pat)|+ if $cond), format_args!($($arg)*))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ => $arm:expr , $($arg:tt)* ) => {
|
( $e:expr , $($pat:pat_param)|+ => $arm:expr , $($arg:tt)* ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ => $arm,
|
$($pat)|+ => $arm,
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
||||||
e, stringify!($($pat)|+), format_args!($($arg)*))
|
e, stringify!($($pat)|+), format_args!($($arg)*))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
( $e:expr , $($pat:pat)|+ if $cond:expr => $arm:expr , $($arg:tt)* ) => {
|
( $e:expr , $($pat:pat_param)|+ if $cond:expr => $arm:expr , $($arg:tt)* ) => {
|
||||||
match $e {
|
match $e {
|
||||||
$($pat)|+ if $cond => $arm,
|
$($pat)|+ if $cond => $arm,
|
||||||
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
ref e => panic!("assertion failed: `{:?}` does not match `{}`: {}",
|
||||||
|
|||||||
Reference in New Issue
Block a user