mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-05 11:30:46 +00:00
[clippy] macro: remaining clippy lints
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
c241be9e6a
commit
05b432c422
@ -22,7 +22,7 @@ fn handle_error(
|
||||
) -> TokenStream {
|
||||
match err.downcast::<syn::Error>() {
|
||||
Ok(err) => {
|
||||
let err: proc_macro2::TokenStream = err.to_compile_error().into();
|
||||
let err: proc_macro2::TokenStream = err.to_compile_error();
|
||||
item.extend(err);
|
||||
item.into()
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ pub fn optional_visibility(tokens: &mut TokenIter) -> Result<syn::Visibility, Er
|
||||
|
||||
use syn::parse::Parser;
|
||||
let parser = <syn::Visibility as syn::parse::Parse>::parse;
|
||||
return Ok(parser.parse2(visibility)?);
|
||||
|
||||
Ok(parser.parse2(visibility)?)
|
||||
}
|
||||
|
||||
pub fn match_keyword(
|
||||
@ -309,12 +310,7 @@ pub fn parse_object(tokens: TokenStream) -> Result<Object, Error> {
|
||||
let mut out = Object::new(tokens.span());
|
||||
let mut tokens = tokens.into_iter().peekable();
|
||||
|
||||
loop {
|
||||
let key = match parse_object_key(&mut tokens)? {
|
||||
Some(key) => key,
|
||||
None => break,
|
||||
};
|
||||
|
||||
while let Some(key) = parse_object_key(&mut tokens)? {
|
||||
let value = parse_object_value(&mut tokens, &key)?;
|
||||
|
||||
if out.insert(key.clone(), value).is_some() {
|
||||
|
@ -13,11 +13,8 @@ pub fn router_macro(input: TokenStream) -> Result<TokenStream, Error> {
|
||||
|
||||
let mut out = TokenStream::new();
|
||||
|
||||
loop {
|
||||
let mut at_span = match input.peek() {
|
||||
Some(ref val) => val.span(),
|
||||
None => break,
|
||||
};
|
||||
while let Some(ref peek_val) = input.peek() {
|
||||
let mut at_span = peek_val.span();
|
||||
|
||||
let public = optional_visibility(&mut input)?;
|
||||
|
||||
|
@ -29,7 +29,7 @@ impl Name {
|
||||
}
|
||||
|
||||
pub fn span(&self) -> Span {
|
||||
self.1.clone()
|
||||
self.1
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,10 +43,6 @@ impl PartialEq for Name {
|
||||
fn eq(&self, rhs: &Self) -> bool {
|
||||
self.0 == rhs.0
|
||||
}
|
||||
|
||||
fn ne(&self, rhs: &Self) -> bool {
|
||||
self.0 != rhs.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Name {}
|
||||
|
@ -22,13 +22,11 @@ pub fn to_camel_case(text: &str) -> String {
|
||||
for c in text.chars() {
|
||||
if c == '_' {
|
||||
capitalize = true;
|
||||
} else if capitalize {
|
||||
out.extend(c.to_uppercase());
|
||||
capitalize = false;
|
||||
} else {
|
||||
if capitalize {
|
||||
out.extend(c.to_uppercase());
|
||||
capitalize = false;
|
||||
} else {
|
||||
out.push(c);
|
||||
}
|
||||
out.push(c);
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +59,7 @@ pub struct ApiAttr {
|
||||
impl Parse for ApiAttr {
|
||||
fn parse(input: ParseStream) -> syn::Result<Self> {
|
||||
let content;
|
||||
#[allow(clippy::eval_order_dependence)]
|
||||
Ok(ApiAttr {
|
||||
paren_token: parenthesized!(content in input),
|
||||
items: content.parse_terminated(ApiItem::parse)?,
|
||||
|
Loading…
Reference in New Issue
Block a user