Skip to content

Commit b7d8417

Browse files
committed
Expose tests for {f32,f64}.total_cmp in docs
Uncomment the helpful assert_eq! line, which is stripped out completely in docs, and leaves the reader to mentally play through the algorithm, or go to the playground and add a println!, to see what the result will be. (If these tests are known to fail on some platforms, is there some mechanism to conditionalize this or escape the comments so the assert_eq! source will be visible on the web?)
1 parent 784916c commit b7d8417

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

library/core/src/num/f32.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1385,9 +1385,9 @@ impl f32 {
13851385
/// ];
13861386
///
13871387
/// bois.sort_by(|a, b| a.weight.total_cmp(&b.weight));
1388-
/// # assert!(bois.into_iter().map(|b| b.weight)
1389-
/// # .zip([-5.0, 0.1, 10.0, 99.0, f32::INFINITY, f32::NAN].iter())
1390-
/// # .all(|(a, b)| a.to_bits() == b.to_bits()))
1388+
/// assert!(bois.into_iter().map(|b| b.weight)
1389+
/// .zip([-5.0, 0.1, 10.0, 99.0, f32::INFINITY, f32::NAN].iter())
1390+
/// .all(|(a, b)| a.to_bits() == b.to_bits()))
13911391
/// ```
13921392
#[stable(feature = "total_cmp", since = "1.62.0")]
13931393
#[must_use]

library/core/src/num/f64.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1383,9 +1383,9 @@ impl f64 {
13831383
/// ];
13841384
///
13851385
/// bois.sort_by(|a, b| a.weight.total_cmp(&b.weight));
1386-
/// # assert!(bois.into_iter().map(|b| b.weight)
1387-
/// # .zip([-5.0, 0.1, 10.0, 99.0, f64::INFINITY, f64::NAN].iter())
1388-
/// # .all(|(a, b)| a.to_bits() == b.to_bits()))
1386+
/// assert!(bois.into_iter().map(|b| b.weight)
1387+
/// .zip([-5.0, 0.1, 10.0, 99.0, f64::INFINITY, f64::NAN].iter())
1388+
/// .all(|(a, b)| a.to_bits() == b.to_bits()))
13891389
/// ```
13901390
#[stable(feature = "total_cmp", since = "1.62.0")]
13911391
#[must_use]

0 commit comments

Comments
 (0)