about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Bergdoll <lukas.bergdoll@gmail.com>2024-08-03 15:10:27 +0200
committerLukas Bergdoll <lukas.bergdoll@gmail.com>2024-08-03 15:10:27 +0200
commit613155c96ab32daf12514e76476132e6b84adaf8 (patch)
tree29bbd2e893f14f81e983ff50bc5d41e7afed95dd
parenteae7a186b221bb2b4a4bedeb19d5aca658e91c25 (diff)
downloadrust-613155c96ab32daf12514e76476132e6b84adaf8.tar.gz
rust-613155c96ab32daf12514e76476132e6b84adaf8.zip
Apply review comments to PartialOrd section
-rw-r--r--library/alloc/src/slice.rs14
-rw-r--r--library/core/src/slice/mod.rs14
2 files changed, 14 insertions, 14 deletions
diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs
index 21270dbed0c..aaa6a2abbd9 100644
--- a/library/alloc/src/slice.rs
+++ b/library/alloc/src/slice.rs
@@ -189,14 +189,14 @@ impl<T> [T] {
     /// [`sort_unstable`](slice::sort_unstable). The exception are partially sorted slices, which
     /// may be better served with `slice::sort`.
     ///
-    /// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] requires
-    /// additional precautions. For example Rust defines `NaN != NaN`, which doesn't fulfill the
-    /// reflexivity requirement posed by [`Ord`]. By using an alternative comparison function with
+    /// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] require
+    /// additional precautions. For example, `f32::NAN != f32::NAN`, which doesn't fulfill the
+    /// reflexivity requirement of [`Ord`]. By using an alternative comparison function with
     /// [`slice::sort_by`] such as [`f32::total_cmp`] or [`f64::total_cmp`] that defines a [total
-    /// order] users can sort slices containing floating point numbers. Alternatively, if one can
-    /// guarantee that all values in the slice are comparable with [`PartialOrd::partial_cmp`] *and*
-    /// the implementation forms a [total order], it's possible to sort the slice with `sort_by(|a,
-    /// b| a.partial_cmp(b).unwrap())`.
+    /// order] users can sort slices containing floating-point values. Alternatively, if all values
+    /// in the slice are guaranteed to be in a subset for which [`PartialOrd::partial_cmp`] forms a
+    /// [total order], it's possible to sort the slice with `sort_by(|a, b|
+    /// a.partial_cmp(b).unwrap())`.
     ///
     /// # Current implementation
     ///
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
index 862a18c3f4a..e75a9a88045 100644
--- a/library/core/src/slice/mod.rs
+++ b/library/core/src/slice/mod.rs
@@ -2890,14 +2890,14 @@ impl<T> [T] {
     /// slice and any possible modifications via interior mutability are observed in the input. Same
     /// is true if the implementation of [`Ord`] for `T` panics.
     ///
-    /// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] requires
-    /// additional precautions. For example Rust defines `NaN != NaN`, which doesn't fulfill the
-    /// reflexivity requirement posed by [`Ord`]. By using an alternative comparison function with
+    /// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] require
+    /// additional precautions. For example, `f32::NAN != f32::NAN`, which doesn't fulfill the
+    /// reflexivity requirement of [`Ord`]. By using an alternative comparison function with
     /// [`slice::sort_unstable_by`] such as [`f32::total_cmp`] or [`f64::total_cmp`] that defines a
-    /// [total order] users can sort slices containing floating point numbers. Alternatively, if one
-    /// can guarantee that all values in the slice are comparable with [`PartialOrd::partial_cmp`]
-    /// *and* the implementation forms a [total order], it's possible to sort the slice with
-    /// `sort_unstable_by(|a, b| a.partial_cmp(b).unwrap())`.
+    /// [total order] users can sort slices containing floating-point values. Alternatively, if all
+    /// values in the slice are guaranteed to be in a subset for which [`PartialOrd::partial_cmp`]
+    /// forms a [total order], it's possible to sort the slice with `sort_unstable_by(|a, b|
+    /// a.partial_cmp(b).unwrap())`.
     ///
     /// # Current implementation
     ///