Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Commit

Permalink
Allow using _underscore vars in async ffi calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
rustonaut committed Jan 7, 2022
1 parent e59ad02 commit a13085f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions async-bindgen-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn parse_gen_api(attrs: TokenStream2, item: TokenStream2) -> Result<AsyncBindgen

let mut file_tokens = quote! {
#![doc(hidden)]
#![allow(clippy::unused_unit, clippy::semicolon_if_nothing_returned)]
#![allow(clippy::unused_unit, clippy::semicolon_if_nothing_returned, clippy::used_underscore_binding)]
};
file_tokens.extend(api.header_code().clone());
file_tokens.extend(generate_type(&api));
Expand Down Expand Up @@ -167,7 +167,7 @@ mod tests {
"#,
r##"
#![doc(hidden)]
#![allow(clippy::unused_unit, clippy::semicolon_if_nothing_returned)]
#![allow(clippy::unused_unit, clippy::semicolon_if_nothing_returned, clippy::used_underscore_binding)]
pub struct BarFoot;
#[doc = r" Initializes the dart api."]
#[doc = r""]
Expand Down Expand Up @@ -231,7 +231,7 @@ mod tests {
"#,
r##"
#![doc(hidden)]
#![allow(clippy::unused_unit, clippy::semicolon_if_nothing_returned)]
#![allow(clippy::unused_unit, clippy::semicolon_if_nothing_returned, clippy::used_underscore_binding)]
pub struct BarFoot;
#[doc = r" Initializes the dart api."]
#[doc = r""]
Expand Down Expand Up @@ -299,7 +299,7 @@ mod tests {
"#,
r##"
#![doc(hidden)]
#![allow(clippy::unused_unit, clippy::semicolon_if_nothing_returned)]
#![allow(clippy::unused_unit, clippy::semicolon_if_nothing_returned, clippy::used_underscore_binding)]
pub struct BarFoot;
#[doc = r" Initializes the dart api."]
#[doc = r""]
Expand Down
8 changes: 2 additions & 6 deletions integration-tests-bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
clippy::module_name_repetitions
)]

use std::mem::forget;

pub mod async_bindings;

#[async_bindgen::api(
Expand All @@ -49,10 +47,8 @@ impl AsyncApi {
x - y
}

/// Does nothing, leaks the box.
pub async fn foo(bar: Box<c_void>) {
forget(bar);
}
/// Does nothing
pub async fn foo(_bar: Option<&'static mut c_void>) {}
}

#[async_bindgen::api]
Expand Down

0 comments on commit a13085f

Please sign in to comment.