Skip to content

Commit

Permalink
Merge pull request #13 from MirkoCovizzi/master
Browse files Browse the repository at this point in the history
Adaptations based on clippy for stable 1.43
  • Loading branch information
m-hilgendorf authored Apr 26, 2020
2 parents 5380bda + a8d25f9 commit dfe5e17
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 24 deletions.
8 changes: 4 additions & 4 deletions com/macros/support/src/co_class/class_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ pub fn gen_lock_server() -> HelperTokenStream {
}
}

pub fn gen_iunknown_impl(
pub fn gen_iunknown_impl<S: ::std::hash::BuildHasher>(
base_interface_idents: &[Ident],
aggr_map: &HashMap<Ident, Vec<Ident>>,
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
class_factory_ident: &Ident,
) -> HelperTokenStream {
let query_interface = gen_query_interface();
Expand All @@ -107,9 +107,9 @@ pub fn gen_iunknown_impl(
}
}

pub fn gen_release(
pub fn gen_release<S: ::std::hash::BuildHasher>(
base_interface_idents: &[Ident],
aggr_map: &HashMap<Ident, Vec<Ident>>,
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
struct_ident: &Ident,
) -> HelperTokenStream {
let ref_count_ident = crate::utils::ref_count_ident();
Expand Down
8 changes: 5 additions & 3 deletions com/macros/support/src/co_class/com_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use syn::{Fields, Ident, ItemStruct};
/// ..ref count..
/// ..init struct..
/// }
pub fn generate(
aggr_map: &HashMap<Ident, Vec<Ident>>,
pub fn generate<S: ::std::hash::BuildHasher>(
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
base_interface_idents: &[Ident],
struct_item: &ItemStruct,
) -> HelperTokenStream {
Expand Down Expand Up @@ -47,7 +47,9 @@ pub fn gen_ref_count_field() -> HelperTokenStream {
quote!(#ref_count_ident: std::cell::Cell<u32>,)
}

pub fn gen_aggregate_fields(aggr_map: &HashMap<Ident, Vec<Ident>>) -> HelperTokenStream {
pub fn gen_aggregate_fields<S: ::std::hash::BuildHasher>(
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
) -> HelperTokenStream {
let aggregates = aggr_map.iter().map(|(aggr_field_ident, _)| {
quote!(
#aggr_field_ident: *mut *const <dyn vst3_com::interfaces::iunknown::IUnknown as vst3_com::ComInterface>::VTable
Expand Down
16 changes: 10 additions & 6 deletions com/macros/support/src/co_class/com_struct_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use quote::{format_ident, quote};
use std::collections::HashMap;
use syn::{Fields, Ident, ItemStruct};

pub fn generate(
aggr_map: &HashMap<Ident, Vec<Ident>>,
pub fn generate<S: ::std::hash::BuildHasher>(
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
base_interface_idents: &[Ident],
struct_item: &ItemStruct,
) -> HelperTokenStream {
Expand All @@ -24,8 +24,8 @@ pub fn generate(
}

/// Function used to instantiate the COM fields, such as vpointers for the COM object.
pub fn gen_allocate_fn(
aggr_map: &HashMap<Ident, Vec<Ident>>,
pub fn gen_allocate_fn<S: ::std::hash::BuildHasher>(
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
base_interface_idents: &[Ident],
struct_item: &ItemStruct,
) -> HelperTokenStream {
Expand Down Expand Up @@ -68,7 +68,9 @@ pub fn gen_allocate_function_parameters_signature(struct_item: &ItemStruct) -> H
quote!(#fields)
}

pub fn gen_allocate_aggregate_fields(aggr_map: &HashMap<Ident, Vec<Ident>>) -> HelperTokenStream {
pub fn gen_allocate_aggregate_fields<S: ::std::hash::BuildHasher>(
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
) -> HelperTokenStream {
let aggregate_inits = aggr_map.iter().map(|(aggr_field_ident, _)| {
quote!(
#aggr_field_ident: std::ptr::null_mut()
Expand Down Expand Up @@ -147,7 +149,9 @@ pub fn gen_get_class_object_fn(struct_item: &ItemStruct) -> HelperTokenStream {
)
}

pub fn gen_set_aggregate_fns(aggr_map: &HashMap<Ident, Vec<Ident>>) -> HelperTokenStream {
pub fn gen_set_aggregate_fns<S: ::std::hash::BuildHasher>(
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
) -> HelperTokenStream {
let mut fns = Vec::new();
for (aggr_field_ident, aggr_base_interface_idents) in aggr_map.iter() {
for base in aggr_base_interface_idents {
Expand Down
24 changes: 14 additions & 10 deletions com/macros/support/src/co_class/iunknown_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use syn::{Ident, ItemStruct};
/// Generates the IUnknown implementation for the COM Object.
/// Takes into account the base interfaces exposed, as well as
/// any interfaces exposed through an aggregated object.
pub fn generate(
pub fn generate<S: ::std::hash::BuildHasher>(
base_interface_idents: &[Ident],
aggr_map: &HashMap<Ident, Vec<Ident>>,
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
struct_item: &ItemStruct,
) -> HelperTokenStream {
let struct_ident = &struct_item.ident;
Expand Down Expand Up @@ -45,9 +45,9 @@ pub fn gen_add_ref_implementation() -> HelperTokenStream {
)
}

pub fn gen_release(
pub fn gen_release<S: ::std::hash::BuildHasher>(
base_interface_idents: &[Ident],
aggr_map: &HashMap<Ident, Vec<Ident>>,
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
struct_ident: &Ident,
) -> HelperTokenStream {
let ref_count_ident = crate::utils::ref_count_ident();
Expand All @@ -71,9 +71,9 @@ pub fn gen_release(
}
}

pub fn gen_release_drops(
pub fn gen_release_drops<S: ::std::hash::BuildHasher>(
base_interface_idents: &[Ident],
aggr_map: &HashMap<Ident, Vec<Ident>>,
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
struct_ident: &Ident,
) -> HelperTokenStream {
let vptr_drops = gen_vptr_drops(base_interface_idents);
Expand All @@ -87,7 +87,9 @@ pub fn gen_release_drops(
)
}

fn gen_aggregate_drops(aggr_map: &HashMap<Ident, Vec<Ident>>) -> HelperTokenStream {
fn gen_aggregate_drops<S: ::std::hash::BuildHasher>(
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
) -> HelperTokenStream {
let aggregate_drops = aggr_map.iter().map(|(aggr_field_ident, _)| {
quote!(
if !self.#aggr_field_ident.is_null() {
Expand Down Expand Up @@ -139,9 +141,9 @@ pub fn gen_new_count_var_zero_check(new_count_ident: &Ident) -> HelperTokenStrea
)
}

pub fn gen_query_interface(
pub fn gen_query_interface<S: ::std::hash::BuildHasher>(
base_interface_idents: &[Ident],
aggr_map: &HashMap<Ident, Vec<Ident>>,
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
) -> HelperTokenStream {
let first_vptr_field = crate::utils::vptr_field_ident(&base_interface_idents[0]);

Expand Down Expand Up @@ -189,7 +191,9 @@ pub fn gen_base_match_arms(base_interface_idents: &[Ident]) -> HelperTokenStream
quote!(#(#base_match_arms)*)
}

pub fn gen_aggregate_match_arms(aggr_map: &HashMap<Ident, Vec<Ident>>) -> HelperTokenStream {
pub fn gen_aggregate_match_arms<S: ::std::hash::BuildHasher>(
aggr_map: &HashMap<Ident, Vec<Ident>, S>,
) -> HelperTokenStream {
let aggr_match_arms = aggr_map.iter().map(|(aggr_field_ident, aggr_base_interface_idents)| {

// Construct the OR match conditions for a single aggregated object.
Expand Down
1 change: 0 additions & 1 deletion com/macros/support/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(clippy::ptr_arg)]
#![allow(clippy::implicit_hasher)]
extern crate proc_macro;

pub mod aggr_co_class;
Expand Down

0 comments on commit dfe5e17

Please sign in to comment.