From af04fc5764c42b1c972442ca1949a796d26d9456 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 8 Aug 2019 11:09:29 +0200 Subject: [PATCH] macro: remove unused add_verifiers Signed-off-by: Wolfgang Bumiller --- proxmox-api-macro/src/api_def.rs | 38 -------------------------------- 1 file changed, 38 deletions(-) diff --git a/proxmox-api-macro/src/api_def.rs b/proxmox-api-macro/src/api_def.rs index b7afe8e2..e21fc191 100644 --- a/proxmox-api-macro/src/api_def.rs +++ b/proxmox-api-macro/src/api_def.rs @@ -202,42 +202,4 @@ impl ParameterDefinition { _ => c_bail!(span, "expected description or field definition"), } } - - pub fn add_verifiers( - &self, - name_str: &str, - this: TokenStream, - verifiers: &mut Vec, - ) { - 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); - } - }); - } - } }