mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-07 17:09:27 +00:00
macro: remove unused add_verifiers
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
ccce46eba4
commit
af04fc5764
@ -202,42 +202,4 @@ impl ParameterDefinition {
|
|||||||
_ => c_bail!(span, "expected description or field definition"),
|
_ => c_bail!(span, "expected description or field definition"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_verifiers(
|
|
||||||
&self,
|
|
||||||
name_str: &str,
|
|
||||||
this: TokenStream,
|
|
||||||
verifiers: &mut Vec<TokenStream>,
|
|
||||||
) {
|
|
||||||
verifiers.push(match self.validate {
|
|
||||||
Some(ref ident) => quote! { #ident(&#this)?; },
|
|
||||||
None => quote! { ::proxmox::api::ApiType::verify(&#this)?; },
|
|
||||||
});
|
|
||||||
|
|
||||||
if let Some(ref lit) = self.minimum {
|
|
||||||
let errstr = format!(
|
|
||||||
"parameter '{}' out of range: (must be >= {})",
|
|
||||||
name_str,
|
|
||||||
lit.clone().into_token_stream().to_string(),
|
|
||||||
);
|
|
||||||
verifiers.push(quote! {
|
|
||||||
if #this < #lit {
|
|
||||||
bail!("{}", #errstr);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(ref lit) = self.maximum {
|
|
||||||
let errstr = format!(
|
|
||||||
"parameter '{}' out of range: (must be <= {})",
|
|
||||||
name_str,
|
|
||||||
lit.clone().into_token_stream().to_string(),
|
|
||||||
);
|
|
||||||
verifiers.push(quote! {
|
|
||||||
if #this > #lit {
|
|
||||||
bail!("{}", #errstr);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user