Skip to content

Commit 53b5e5e

Browse files
committed
ignore s2n_quic_platform::time::set_local_clock doctests
doctests currently don't work well for conditional features see: rust-lang/rust#67295
1 parent 62d3573 commit 53b5e5e

File tree

1 file changed

+12
-11
lines changed
  • quic/s2n-quic-platform/src/time

1 file changed

+12
-11
lines changed

quic/s2n-quic-platform/src/time/mod.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use cfg_if::cfg_if;
66

77
cfg_if! {
8-
if #[cfg(feature = "testing")] {
8+
if #[cfg(any(feature = "testing", test))] {
99
pub use if_testing::*;
1010
} else if #[cfg(feature = "std")] {
1111
pub use if_std::*;
@@ -60,7 +60,7 @@ mod if_no_std {
6060
static CLOCK_STATE: AtomicUsize = AtomicUsize::new(CLOCK_UNINITIALIZED);
6161

6262
/// Initialize the global Clock for use in `no-std` mode.
63-
/// The configured clock will be queried on all `Timestamp::now()` calls.
63+
/// The configured clock will be queried on all `crate::time::now()` calls.
6464
/// The global clock can only be set once.
6565
pub fn init_global_clock(clock: &'static dyn Clock) -> Result<(), ()> {
6666
unsafe {
@@ -114,9 +114,9 @@ mod if_testing {
114114

115115
cfg_if! {
116116
if #[cfg(feature = "std")] {
117-
pub use super::if_std::now as inner_now;
117+
use super::if_std::now as inner_now;
118118
} else {
119-
pub use super::if_no_std::now as inner_now;
119+
use super::if_no_std::now as inner_now;
120120
}
121121
}
122122

@@ -154,19 +154,20 @@ mod if_testing {
154154
use std::sync::Mutex;
155155

156156
/// Configures a [`Clock`] which will be utilized for the following
157-
/// calls to `Timestamp::now()` on the current thread.
157+
/// calls to `crate::time::now()` on the current thread.
158158
///
159159
/// Example:
160160
///
161-
/// ```
161+
/// ```ignore
162162
/// # use core::time::Duration;
163-
/// use s2n_quic_platform::time::{testing, Timestamp};
164-
/// let clock = std::sync::Arc::new(testing::MockClock::new());
163+
/// use std::sync::Arc;
164+
/// use s2n_quic_platform::time::{self, testing};
165+
/// let clock = Arc::new(testing::MockClock::new());
165166
/// testing::set_local_clock(clock.clone());
166167
///
167-
/// let before = Timestamp::now();
168+
/// let before = time::now();
168169
/// clock.adjust_by(Duration::from_millis(333));
169-
/// let after = Timestamp::now();
170+
/// let after = time::now();
170171
/// assert_eq!(after - before, Duration::from_millis(333));
171172
/// ```
172173
pub fn set_local_clock(clock: Arc<dyn Clock>) {
@@ -177,7 +178,7 @@ mod if_testing {
177178

178179
/// Resets the local clock.
179180
///
180-
/// Following invocations to [`Timestamp::now()`]
181+
/// Following invocations to [`crate::time::now()`]
181182
/// will return the system time again.
182183
pub fn reset_local_clock() {
183184
LOCAL_CLOCK.with(|current_local_clock| {

0 commit comments

Comments
 (0)