Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo-Zhixing committed Mar 19, 2024
1 parent 9fd392d commit 1c5884f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ fn derive_default(
Some(q)
}

fn derive_send_sync(struct_: &vkxml::Struct, has_lifetime: bool) -> Option<TokenStream> {
fn derive_send_sync(struct_: &vkxml::Struct) -> Option<TokenStream> {
if !struct_
.elements
.iter()
Expand All @@ -1809,10 +1809,9 @@ fn derive_send_sync(struct_: &vkxml::Struct, has_lifetime: bool) -> Option<Token
return None;
}
let name = name_to_tokens(&struct_.name);
let lifetime = has_lifetime.then(|| quote!(<'_>));
let q = quote! {
unsafe impl Send for #name #lifetime {}
unsafe impl Sync for #name #lifetime {}
unsafe impl Send for #name <'_> {}
unsafe impl Sync for #name <'_> {}
};
Some(q)
}
Expand Down Expand Up @@ -2457,7 +2456,7 @@ pub fn generate_struct(

let debug_tokens = derive_debug(struct_, &members, union_types, has_lifetime);
let default_tokens = derive_default(struct_, &members, has_lifetime);
let send_sync_tokens = derive_send_sync(struct_, has_lifetime);
let send_sync_tokens = derive_send_sync(struct_);
let setter_tokens = derive_getters_and_setters(struct_, &members, root_structs, has_lifetimes);
let manual_derive_tokens = manual_derives(struct_);
let dbg_str = if debug_tokens.is_none() {
Expand Down

0 comments on commit 1c5884f

Please sign in to comment.