diff --git a/mbedtls/src/rng/mod.rs b/mbedtls/src/rng/mod.rs index 770d1a887..5e40e958f 100644 --- a/mbedtls/src/rng/mod.rs +++ b/mbedtls/src/rng/mod.rs @@ -27,8 +27,8 @@ use crate::error::{Result, IntoResult}; use mbedtls_sys::types::raw_types::{c_int, c_uchar}; use mbedtls_sys::types::size_t; -callback!(EntropyCallbackMut,EntropyCallback:Sync(data: *mut c_uchar, len: size_t) -> c_int); -callback!(RngCallbackMut,RngCallback:Sync(data: *mut c_uchar, len: size_t) -> c_int); +callback!(EntropyCallbackMut,EntropyCallback(data: *mut c_uchar, len: size_t) -> c_int); +callback!(RngCallbackMut,RngCallback(data: *mut c_uchar, len: size_t) -> c_int); pub trait Random: RngCallback { fn random(&mut self, data: &mut [u8]) -> Result<()> where Self: Sized { diff --git a/mbedtls/src/rng/os_entropy.rs b/mbedtls/src/rng/os_entropy.rs index 5c72a067b..98eccf506 100644 --- a/mbedtls/src/rng/os_entropy.rs +++ b/mbedtls/src/rng/os_entropy.rs @@ -21,7 +21,7 @@ define!( #[c_ty(entropy_context)] #[repr(C)] struct OsEntropy { - sources: Vec>, + sources: Vec>, }; pub const new: fn() -> Self = entropy_init { sources: Vec::with_capacity(1), }; const drop: fn(&mut Self) = entropy_free; @@ -41,7 +41,7 @@ unsafe impl Sync for OsEntropy {} #[allow(dead_code)] impl OsEntropy { - pub fn add_source( + pub fn add_source( &mut self, source: Arc, threshold: size_t, diff --git a/mbedtls/src/wrapper_macros.rs b/mbedtls/src/wrapper_macros.rs index 832f625d8..b0c027a4d 100644 --- a/mbedtls/src/wrapper_macros.rs +++ b/mbedtls/src/wrapper_macros.rs @@ -15,7 +15,7 @@ macro_rules! as_item { macro_rules! callback { //{ ($($arg:ident: $ty:ty),*) -> $ret:ty } => { //}; - { $n:ident, $m:ident$( : $sync:ident )*($($arg:ident: $ty:ty),*) -> $ret:ty } => { + { $n:ident, $m:ident($($arg:ident: $ty:ty),*) -> $ret:ty } => { #[cfg(not(feature="threading"))] pub trait $n { unsafe extern "C" fn call_mut(user_data: *mut ::mbedtls_sys::types::raw_types::c_void, $($arg:$ty),*) -> $ret where Self: Sized; @@ -24,7 +24,7 @@ macro_rules! callback { } #[cfg(feature="threading")] - pub trait $n $( : $sync )* { + pub trait $n { unsafe extern "C" fn call_mut(user_data: *mut ::mbedtls_sys::types::raw_types::c_void, $($arg:$ty),*) -> $ret where Self: Sized; fn data_ptr_mut(&mut self) -> *mut ::mbedtls_sys::types::raw_types::c_void; @@ -60,7 +60,7 @@ macro_rules! callback { } #[cfg(feature="threading")] - pub trait $m $( : $sync )* { + pub trait $m { unsafe extern "C" fn call(user_data: *mut ::mbedtls_sys::types::raw_types::c_void, $($arg:$ty),*) -> $ret where Self: Sized; fn data_ptr(&self) -> *mut ::mbedtls_sys::types::raw_types::c_void; @@ -89,14 +89,14 @@ macro_rules! callback { } }; ($t:ident: $($bound:tt)*) => { - #[cfg(feature = "threading")] - pub trait $t: $($bound)* {} #[cfg(not(feature = "threading"))] + pub trait $t: $($bound)* {} + #[cfg(feature = "threading")] pub trait $t: $($bound)* + Sync {} - #[cfg(feature = "threading")] - impl $t for F {} #[cfg(not(feature = "threading"))] + impl $t for F {} + #[cfg(feature = "threading")] impl $t for F {} }; }