Avoid triggering used_underscore_binding on unnamed extern fn args

This commit is contained in:
David Tolnay 2020-12-29 15:44:19 -08:00
parent d717e8a1a0
commit b4c14554aa
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 3 additions and 4 deletions

View File

@ -501,7 +501,7 @@ fn parse_extern_fn(
let ident = match arg.pat.as_ref() {
Pat::Ident(pat) => pat.ident.clone(),
Pat::Wild(pat) => {
Ident::new(&format!("_{}", args.len()), pat.underscore_token.span)
Ident::new(&format!("arg{}", args.len()), pat.underscore_token.span)
}
_ => return Err(Error::new_spanned(arg, "unsupported signature")),
};
@ -1070,7 +1070,7 @@ fn parse_type_fn(ty: &TypeBareFn) -> Result<Type> {
let ty = parse_type(&arg.ty)?;
let ident = match &arg.name {
Some(ident) => ident.0.clone(),
None => format_ident!("_{}", i),
None => format_ident!("arg{}", i),
};
Ok(Var { ident, ty })
})

View File

@ -7,8 +7,7 @@
clippy::ptr_arg,
clippy::trivially_copy_pass_by_ref,
clippy::unnecessary_wraps,
clippy::unused_self,
clippy::used_underscore_binding
clippy::unused_self
)]
pub mod cast;