Skip to content

Commit 594838d

Browse files
committed
smarter way to avoid 'unused' warning when building for tests
1 parent 600ac69 commit 594838d

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

library/std/src/thread/mod.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@
150150
151151
#![stable(feature = "rust1", since = "1.0.0")]
152152
#![deny(unsafe_op_in_unsafe_fn)]
153+
// Under `test`, `__FastLocalKeyInner` seems unused.
154+
#![cfg_attr(test, allow(dead_code))]
153155

154156
#[cfg(all(test, not(target_os = "emscripten")))]
155157
mod tests;
@@ -218,15 +220,6 @@ pub use self::local::fast::Key as __FastLocalKeyInner;
218220
))]
219221
pub use realstd::thread::__FastLocalKeyInner;
220222

221-
// but import the local one anyway to silence 'unused' warnings
222-
#[unstable(feature = "libstd_thread_internals", issue = "none")]
223-
#[cfg(test)]
224-
#[cfg(all(
225-
target_thread_local,
226-
not(all(target_family = "wasm", not(target_feature = "atomics"))),
227-
))]
228-
pub use self::local::fast::Key as __FastLocalKeyInnerUnused;
229-
230223
#[unstable(feature = "libstd_thread_internals", issue = "none")]
231224
#[cfg(all(
232225
not(target_thread_local),

0 commit comments

Comments
 (0)