@@ -23,30 +23,30 @@ use std::hash::{BuildHasher, Hash};
2323pub use std:: sync:: atomic:: Ordering ;
2424pub use std:: sync:: atomic:: Ordering :: SeqCst ;
2525
26- pub use std:: marker:: Send as Send ;
27- pub use std:: marker:: Sync as Sync ;
26+ pub use std:: marker:: Send ;
27+ pub use std:: marker:: Sync ;
2828
29- pub use parking_lot:: RwLockReadGuard as ReadGuard ;
30- pub use parking_lot:: MappedRwLockReadGuard as MappedReadGuard ;
31- pub use parking_lot:: RwLockWriteGuard as WriteGuard ;
32- pub use parking_lot:: MappedRwLockWriteGuard as MappedWriteGuard ;
29+ pub use parking_lot:: MappedRwLockReadGuard as MappedReadGuard ;
30+ pub use parking_lot:: MappedRwLockWriteGuard as MappedWriteGuard ;
31+ pub use parking_lot:: RwLockReadGuard as ReadGuard ;
32+ pub use parking_lot:: RwLockWriteGuard as WriteGuard ;
3333
34- pub use parking_lot:: MutexGuard as LockGuard ;
35- pub use parking_lot:: MappedMutexGuard as MappedLockGuard ;
34+ pub use parking_lot:: MappedMutexGuard as MappedLockGuard ;
35+ pub use parking_lot:: MutexGuard as LockGuard ;
3636
37- pub use std:: sync:: atomic:: { AtomicBool , AtomicUsize , AtomicU32 , AtomicU64 } ;
37+ pub use std:: sync:: atomic:: { AtomicBool , AtomicU32 , AtomicU64 , AtomicUsize } ;
3838
39- pub use std:: sync:: Arc as Lrc ;
40- pub use std:: sync:: Weak as Weak ;
39+ pub use std:: sync:: Arc as Lrc ;
40+ pub use std:: sync:: Weak ;
4141
42- pub type MTRef < ' a , T > = & ' a T ;
42+ pub type MTRef < ' a , T > = & ' a T ;
4343
44- pub use rayon:: { join, scope} ;
44+ pub use rayon:: { join, scope} ;
4545
46- /// Runs a list of blocks in parallel. The first block is executed immediately on
47- /// the current thread. Use that for the longest running block.
48- #[ macro_export]
49- macro_rules! parallel {
46+ /// Runs a list of blocks in parallel. The first block is executed immediately on
47+ /// the current thread. Use that for the longest running block.
48+ #[ macro_export]
49+ macro_rules! parallel {
5050 ( impl $fblock: tt [ $( $c: tt, ) * ] [ $block: tt $( , $rest: tt) * ] ) => {
5151 parallel!( impl $fblock [ $block, $( $c, ) * ] [ $( $rest) ,* ] )
5252 } ;
@@ -66,31 +66,27 @@ pub use std::sync::atomic::Ordering::SeqCst;
6666 } ;
6767 }
6868
69- pub use rayon_core:: WorkerLocal ;
69+ pub use rayon_core:: WorkerLocal ;
7070
71- pub use rayon:: iter:: ParallelIterator ;
72- use rayon:: iter:: IntoParallelIterator ;
71+ use rayon:: iter:: IntoParallelIterator ;
72+ pub use rayon:: iter:: ParallelIterator ;
7373
74- pub fn par_iter < T : IntoParallelIterator > ( t : T ) -> T :: Iter {
75- t. into_par_iter ( )
76- }
77-
78- pub fn par_for_each_in < T : IntoParallelIterator > (
79- t : T ,
80- for_each : impl Fn ( T :: Item ) + Sync + Send ,
81- ) {
82- t. into_par_iter ( ) . for_each ( for_each)
83- }
74+ pub fn par_iter < T : IntoParallelIterator > ( t : T ) -> T :: Iter {
75+ t. into_par_iter ( )
76+ }
8477
85- #[ macro_export]
86- macro_rules! rustc_erase_owner {
87- ( $v: expr) => { {
88- let v = $v;
89- :: rustc_data_structures:: sync:: assert_send_val( & v) ;
90- v. erase_send_sync_owner( )
91- } }
92- }
78+ pub fn par_for_each_in < T : IntoParallelIterator > ( t : T , for_each : impl Fn ( T :: Item ) + Sync + Send ) {
79+ t. into_par_iter ( ) . for_each ( for_each)
80+ }
9381
82+ #[ macro_export]
83+ macro_rules! rustc_erase_owner {
84+ ( $v: expr) => { {
85+ let v = $v;
86+ :: rustc_data_structures:: sync:: assert_send_val( & v) ;
87+ v. erase_send_sync_owner( )
88+ } } ;
89+ }
9490
9591pub fn assert_sync < T : ?Sized + Sync > ( ) { }
9692pub fn assert_send < T : ?Sized + Send > ( ) { }
@@ -105,6 +101,8 @@ pub trait HashMapExt<K, V> {
105101
106102impl < K : Eq + Hash , V : Eq , S : BuildHasher > HashMapExt < K , V > for HashMap < K , V , S > {
107103 fn insert_same ( & mut self , key : K , value : V ) {
108- self . entry ( key) . and_modify ( |old| assert ! ( * old == value) ) . or_insert ( value) ;
104+ self . entry ( key)
105+ . and_modify ( |old| assert ! ( * old == value) )
106+ . or_insert ( value) ;
109107 }
110108}
0 commit comments