Skip to content

Commit 613155c

Browse files
committed
Apply review comments to PartialOrd section
1 parent eae7a18 commit 613155c

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

library/alloc/src/slice.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ impl<T> [T] {
189189
/// [`sort_unstable`](slice::sort_unstable). The exception are partially sorted slices, which
190190
/// may be better served with `slice::sort`.
191191
///
192-
/// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] requires
193-
/// additional precautions. For example Rust defines `NaN != NaN`, which doesn't fulfill the
194-
/// reflexivity requirement posed by [`Ord`]. By using an alternative comparison function with
192+
/// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] require
193+
/// additional precautions. For example, `f32::NAN != f32::NAN`, which doesn't fulfill the
194+
/// reflexivity requirement of [`Ord`]. By using an alternative comparison function with
195195
/// [`slice::sort_by`] such as [`f32::total_cmp`] or [`f64::total_cmp`] that defines a [total
196-
/// order] users can sort slices containing floating point numbers. Alternatively, if one can
197-
/// guarantee that all values in the slice are comparable with [`PartialOrd::partial_cmp`] *and*
198-
/// the implementation forms a [total order], it's possible to sort the slice with `sort_by(|a,
199-
/// b| a.partial_cmp(b).unwrap())`.
196+
/// order] users can sort slices containing floating-point values. Alternatively, if all values
197+
/// in the slice are guaranteed to be in a subset for which [`PartialOrd::partial_cmp`] forms a
198+
/// [total order], it's possible to sort the slice with `sort_by(|a, b|
199+
/// a.partial_cmp(b).unwrap())`.
200200
///
201201
/// # Current implementation
202202
///

library/core/src/slice/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2890,14 +2890,14 @@ impl<T> [T] {
28902890
/// slice and any possible modifications via interior mutability are observed in the input. Same
28912891
/// is true if the implementation of [`Ord`] for `T` panics.
28922892
///
2893-
/// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] requires
2894-
/// additional precautions. For example Rust defines `NaN != NaN`, which doesn't fulfill the
2895-
/// reflexivity requirement posed by [`Ord`]. By using an alternative comparison function with
2893+
/// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] require
2894+
/// additional precautions. For example, `f32::NAN != f32::NAN`, which doesn't fulfill the
2895+
/// reflexivity requirement of [`Ord`]. By using an alternative comparison function with
28962896
/// [`slice::sort_unstable_by`] such as [`f32::total_cmp`] or [`f64::total_cmp`] that defines a
2897-
/// [total order] users can sort slices containing floating point numbers. Alternatively, if one
2898-
/// can guarantee that all values in the slice are comparable with [`PartialOrd::partial_cmp`]
2899-
/// *and* the implementation forms a [total order], it's possible to sort the slice with
2900-
/// `sort_unstable_by(|a, b| a.partial_cmp(b).unwrap())`.
2897+
/// [total order] users can sort slices containing floating-point values. Alternatively, if all
2898+
/// values in the slice are guaranteed to be in a subset for which [`PartialOrd::partial_cmp`]
2899+
/// forms a [total order], it's possible to sort the slice with `sort_unstable_by(|a, b|
2900+
/// a.partial_cmp(b).unwrap())`.
29012901
///
29022902
/// # Current implementation
29032903
///

0 commit comments

Comments
 (0)