File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ use std::str::FromStr;
34
34
35
35
extern crate crossbeam_deque;
36
36
extern crate crossbeam_queue;
37
+ #[ cfg( any( debug_assertions, rayon_unstable) ) ]
37
38
#[ macro_use]
38
39
extern crate lazy_static;
39
40
extern crate num_cpus;
Original file line number Diff line number Diff line change 8
8
//! replacement of the now deprecated `RAYON_RS_LOG` environment
9
9
//! variable, which is still supported for backwards compatibility.
10
10
11
+ #[ cfg( debug_assertions) ]
11
12
use std:: env;
12
13
13
- #[ derive( Debug ) ]
14
+ #[ cfg_attr( debug_assertions, derive( Debug ) ) ]
15
+ #[ cfg_attr( not( debug_assertions) , allow( dead_code) ) ]
14
16
pub ( super ) enum Event {
15
17
Tickle {
16
18
worker : usize ,
@@ -87,19 +89,28 @@ pub(super) enum Event {
87
89
} ,
88
90
}
89
91
90
- pub ( super ) const DUMP_LOGS : bool = cfg ! ( debug_assertions) ;
91
-
92
+ #[ cfg( debug_assertions) ]
92
93
lazy_static ! {
93
94
pub ( super ) static ref LOG_ENV : bool =
94
95
env:: var( "RAYON_LOG" ) . is_ok( ) || env:: var( "RAYON_RS_LOG" ) . is_ok( ) ;
95
96
}
96
97
98
+ #[ cfg( debug_assertions) ]
99
+ macro_rules! log {
100
+ ( $event: expr) => {
101
+ if * $crate:: log:: LOG_ENV {
102
+ eprintln!( "{:?}" , $event) ;
103
+ }
104
+ } ;
105
+ }
106
+
107
+ #[ cfg( not( debug_assertions) ) ]
97
108
macro_rules! log {
98
109
( $event: expr) => {
99
- if :: log :: DUMP_LOGS {
100
- if * :: log :: LOG_ENV {
101
- println! ( "{:?}" , $event ) ;
102
- }
110
+ if false {
111
+ // Expand `$event` so it still appears used, but without
112
+ // any of the formatting code to be optimized away.
113
+ $event ;
103
114
}
104
115
} ;
105
116
}
You can’t perform that action at this time.
0 commit comments