Skip to content

Commit c831265

Browse files
committed
Replace float module consts with assoc consts in documentation
1 parent c0ec0a2 commit c831265

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

src/libcore/cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
817817
/// When comparison is impossible:
818818
///
819819
/// ```
820-
/// let result = std::f64::NAN.partial_cmp(&1.0);
820+
/// let result = f64::NAN.partial_cmp(&1.0);
821821
/// assert_eq!(result, None);
822822
/// ```
823823
#[must_use]

src/libcore/iter/traits/iterator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2920,7 +2920,7 @@ pub trait Iterator {
29202920
/// assert_eq!([1.].iter().partial_cmp([1., 2.].iter()), Some(Ordering::Less));
29212921
/// assert_eq!([1., 2.].iter().partial_cmp([1.].iter()), Some(Ordering::Greater));
29222922
///
2923-
/// assert_eq!([std::f64::NAN].iter().partial_cmp([1.].iter()), None);
2923+
/// assert_eq!([f64::NAN].iter().partial_cmp([1.].iter()), None);
29242924
/// ```
29252925
#[stable(feature = "iter_order", since = "1.5.0")]
29262926
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
@@ -3170,7 +3170,7 @@ pub trait Iterator {
31703170
/// assert!(![1, 3, 2, 4].iter().is_sorted());
31713171
/// assert!([0].iter().is_sorted());
31723172
/// assert!(std::iter::empty::<i32>().is_sorted());
3173-
/// assert!(![0.0, 1.0, std::f32::NAN].iter().is_sorted());
3173+
/// assert!(![0.0, 1.0, f32::NAN].iter().is_sorted());
31743174
/// ```
31753175
#[inline]
31763176
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
@@ -3197,7 +3197,7 @@ pub trait Iterator {
31973197
/// assert!(![1, 3, 2, 4].iter().is_sorted_by(|a, b| a.partial_cmp(b)));
31983198
/// assert!([0].iter().is_sorted_by(|a, b| a.partial_cmp(b)));
31993199
/// assert!(std::iter::empty::<i32>().is_sorted_by(|a, b| a.partial_cmp(b)));
3200-
/// assert!(![0.0, 1.0, std::f32::NAN].iter().is_sorted_by(|a, b| a.partial_cmp(b)));
3200+
/// assert!(![0.0, 1.0, f32::NAN].iter().is_sorted_by(|a, b| a.partial_cmp(b)));
32013201
/// ```
32023202
///
32033203
/// [`is_sorted`]: trait.Iterator.html#method.is_sorted

src/libcore/ops/range.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
139139
/// ```
140140
/// #![feature(range_is_empty)]
141141
///
142-
/// use std::f32::NAN;
143142
/// assert!(!(3.0..5.0).is_empty());
144-
/// assert!( (3.0..NAN).is_empty());
145-
/// assert!( (NAN..5.0).is_empty());
143+
/// assert!( (3.0..f32::NAN).is_empty());
144+
/// assert!( (f32::NAN..5.0).is_empty());
146145
/// ```
147146
#[unstable(feature = "range_is_empty", reason = "recently added", issue = "48111")]
148147
pub fn is_empty(&self) -> bool {
@@ -496,10 +495,9 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
496495
/// ```
497496
/// #![feature(range_is_empty)]
498497
///
499-
/// use std::f32::NAN;
500498
/// assert!(!(3.0..=5.0).is_empty());
501-
/// assert!( (3.0..=NAN).is_empty());
502-
/// assert!( (NAN..=5.0).is_empty());
499+
/// assert!( (3.0..=f32::NAN).is_empty());
500+
/// assert!( (f32::NAN..=5.0).is_empty());
503501
/// ```
504502
///
505503
/// This method returns `true` after iteration has finished:

src/libcore/slice/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,7 @@ impl<T> [T] {
25882588
/// assert!(![1, 3, 2, 4].is_sorted());
25892589
/// assert!([0].is_sorted());
25902590
/// assert!(empty.is_sorted());
2591-
/// assert!(![0.0, 1.0, std::f32::NAN].is_sorted());
2591+
/// assert!(![0.0, 1.0, f32::NAN].is_sorted());
25922592
/// ```
25932593
#[inline]
25942594
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]

src/libstd/f32.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl f32 {
284284
/// assert_eq!(a.rem_euclid(-b), 3.0);
285285
/// assert_eq!((-a).rem_euclid(-b), 1.0);
286286
/// // limitation due to round-off error
287-
/// assert!((-std::f32::EPSILON).rem_euclid(3.0) != 0.0);
287+
/// assert!((-f32::EPSILON).rem_euclid(3.0) != 0.0);
288288
/// ```
289289
#[must_use = "method returns a new number and does not mutate the original value"]
290290
#[inline]
@@ -962,7 +962,7 @@ impl f32 {
962962
/// assert!((-3.0f32).clamp(-2.0, 1.0) == -2.0);
963963
/// assert!((0.0f32).clamp(-2.0, 1.0) == 0.0);
964964
/// assert!((2.0f32).clamp(-2.0, 1.0) == 1.0);
965-
/// assert!((std::f32::NAN).clamp(-2.0, 1.0).is_nan());
965+
/// assert!((f32::NAN).clamp(-2.0, 1.0).is_nan());
966966
/// ```
967967
#[must_use = "method returns a new number and does not mutate the original value"]
968968
#[unstable(feature = "clamp", issue = "44095")]

src/libstd/f64.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl f64 {
280280
/// assert_eq!(a.rem_euclid(-b), 3.0);
281281
/// assert_eq!((-a).rem_euclid(-b), 1.0);
282282
/// // limitation due to round-off error
283-
/// assert!((-std::f64::EPSILON).rem_euclid(3.0) != 0.0);
283+
/// assert!((-f64::EPSILON).rem_euclid(3.0) != 0.0);
284284
/// ```
285285
#[must_use = "method returns a new number and does not mutate the original value"]
286286
#[inline]
@@ -928,7 +928,7 @@ impl f64 {
928928
/// assert!((-3.0f64).clamp(-2.0, 1.0) == -2.0);
929929
/// assert!((0.0f64).clamp(-2.0, 1.0) == 0.0);
930930
/// assert!((2.0f64).clamp(-2.0, 1.0) == 1.0);
931-
/// assert!((std::f64::NAN).clamp(-2.0, 1.0).is_nan());
931+
/// assert!((f64::NAN).clamp(-2.0, 1.0).is_nan());
932932
/// ```
933933
#[must_use = "method returns a new number and does not mutate the original value"]
934934
#[unstable(feature = "clamp", issue = "44095")]

0 commit comments

Comments
 (0)