Skip to content

Commit

Permalink
Rollup merge of rust-lang#129947 - LiterallyVoid:duration-docs-digit-…
Browse files Browse the repository at this point in the history
…separators, r=tgross35

Add digit separators in `Duration` examples

```@rustbot``` label A-docs
  • Loading branch information
workingjubilee authored Sep 6, 2024
2 parents a161a4b + e2484be commit 84fad23
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions library/core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl Duration {
/// ```
/// use std::time::Duration;
///
/// let duration = Duration::from_millis(2569);
/// let duration = Duration::from_millis(2_569);
///
/// assert_eq!(2, duration.as_secs());
/// assert_eq!(569_000_000, duration.subsec_nanos());
Expand Down Expand Up @@ -279,7 +279,7 @@ impl Duration {
/// let duration = Duration::from_micros(1_000_002);
///
/// assert_eq!(1, duration.as_secs());
/// assert_eq!(2000, duration.subsec_nanos());
/// assert_eq!(2_000, duration.subsec_nanos());
/// ```
#[stable(feature = "duration_from_micros", since = "1.27.0")]
#[must_use]
Expand Down Expand Up @@ -472,7 +472,7 @@ impl Duration {
/// ```
/// use std::time::Duration;
///
/// let duration = Duration::new(5, 730023852);
/// let duration = Duration::new(5, 730_023_852);
/// assert_eq!(duration.as_secs(), 5);
/// ```
///
Expand Down Expand Up @@ -501,7 +501,7 @@ impl Duration {
/// ```
/// use std::time::Duration;
///
/// let duration = Duration::from_millis(5432);
/// let duration = Duration::from_millis(5_432);
/// assert_eq!(duration.as_secs(), 5);
/// assert_eq!(duration.subsec_millis(), 432);
/// ```
Expand Down Expand Up @@ -547,7 +547,7 @@ impl Duration {
/// ```
/// use std::time::Duration;
///
/// let duration = Duration::from_millis(5010);
/// let duration = Duration::from_millis(5_010);
/// assert_eq!(duration.as_secs(), 5);
/// assert_eq!(duration.subsec_nanos(), 10_000_000);
/// ```
Expand All @@ -566,8 +566,8 @@ impl Duration {
/// ```
/// use std::time::Duration;
///
/// let duration = Duration::new(5, 730023852);
/// assert_eq!(duration.as_millis(), 5730);
/// let duration = Duration::new(5, 730_023_852);
/// assert_eq!(duration.as_millis(), 5_730);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
#[rustc_const_stable(feature = "duration_as_u128", since = "1.33.0")]
Expand All @@ -584,8 +584,8 @@ impl Duration {
/// ```
/// use std::time::Duration;
///
/// let duration = Duration::new(5, 730023852);
/// assert_eq!(duration.as_micros(), 5730023);
/// let duration = Duration::new(5, 730_023_852);
/// assert_eq!(duration.as_micros(), 5_730_023);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
#[rustc_const_stable(feature = "duration_as_u128", since = "1.33.0")]
Expand All @@ -602,8 +602,8 @@ impl Duration {
/// ```
/// use std::time::Duration;
///
/// let duration = Duration::new(5, 730023852);
/// assert_eq!(duration.as_nanos(), 5730023852);
/// let duration = Duration::new(5, 730_023_852);
/// assert_eq!(duration.as_nanos(), 5_730_023_852);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
#[rustc_const_stable(feature = "duration_as_u128", since = "1.33.0")]
Expand Down Expand Up @@ -879,7 +879,7 @@ impl Duration {
/// use std::time::Duration;
///
/// let dur = Duration::new(2, 345_678_000);
/// assert_eq!(dur.as_millis_f64(), 2345.678);
/// assert_eq!(dur.as_millis_f64(), 2_345.678);
/// ```
#[unstable(feature = "duration_millis_float", issue = "122451")]
#[must_use]
Expand All @@ -900,7 +900,7 @@ impl Duration {
/// use std::time::Duration;
///
/// let dur = Duration::new(2, 345_678_000);
/// assert_eq!(dur.as_millis_f32(), 2345.678);
/// assert_eq!(dur.as_millis_f32(), 2_345.678);
/// ```
#[unstable(feature = "duration_millis_float", issue = "122451")]
#[must_use]
Expand Down Expand Up @@ -1017,7 +1017,7 @@ impl Duration {
///
/// let dur = Duration::new(2, 700_000_000);
/// assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_641));
/// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847800, 0));
/// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847_800, 0));
/// ```
#[stable(feature = "duration_float", since = "1.38.0")]
#[must_use = "this returns the result of the operation, \
Expand Down

0 comments on commit 84fad23

Please sign in to comment.