mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 07:10:29 +00:00
Avoid triggering used_underscore_binding on unnamed extern fn args
This commit is contained in:
parent
d717e8a1a0
commit
b4c14554aa
@ -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 })
|
||||
})
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user