Apply suggestions from code review

Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
This commit is contained in:
puuuuh 2023-02-06 13:04:00 +03:00 committed by GitHub
parent 27ef3409c2
commit c7f38981a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,7 +92,7 @@ macro_rules! match_prefix {
("") => {{ ("") => {{
|data: &str| Some(data.to_owned()) |data: &str| Some(data.to_owned())
}}; }};
($prefix: literal) => {{ ($prefix:literal) => {{
|data: &str| { |data: &str| {
if data.starts_with($prefix) { if data.starts_with($prefix) {
Some(data.to_owned()) Some(data.to_owned())
@ -105,10 +105,14 @@ macro_rules! match_prefix {
macro_rules! impl_api_error { macro_rules! impl_api_error {
( (
$(#[$meta: meta])* $( #[$meta:meta] )*
$vis: vis enum $ident: ident { $vis:vis enum $ident:ident {
$($(#[$var_meta: meta])* $(
$var_name: ident$(($var_inner: ty))? = $var_string: literal $(with $var_parser: block)?),* } ) => { $( #[$var_meta:meta] )*
$var_name:ident $( ($var_inner:ty) )? = $var_string:literal $(with $var_parser: block)?
),*
}
) => {
$(#[$meta])* $(#[$meta])*
#[derive(Error)] #[derive(Error)]