diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-04-03 22:55:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-03 22:55:02 +0200 |
| commit | 9b22fdc121abfd860e2b7c753aa254f2bf29a1a8 (patch) | |
| tree | 31dbf4ff88f7c4d9a709ee1643761f9294c1ee88 /src/libstd | |
| parent | f6fe99c798cb65280a9a56f442b371adcb7b8aa2 (diff) | |
| parent | c8312659403397c9fe4fcb2fd006268a7031d7a8 (diff) | |
| download | rust-9b22fdc121abfd860e2b7c753aa254f2bf29a1a8.tar.gz rust-9b22fdc121abfd860e2b7c753aa254f2bf29a1a8.zip | |
Rollup merge of #69860 - faern:use-assoc-int-consts, r=dtolnay
Use associated numeric consts in documentation Now when the associated constants on int/float types are stabilized and the recommended way of accessing said constants (#68952). We can start using it in this repository, and recommend it via documentation example code. This PR is the reincarnation of #67913 minus the actual adding + stabilization of said constants. (EDIT: Now it's only changing the documentation. So users will see the new consts, but we don't yet update the internal code) Because of how fast bit rot happens to PRs that touch this many files, it does not try to replace 100% of the old usage of the constants in the entire repo, but a good chunk of them.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/f32.rs | 4 | ||||
| -rw-r--r-- | src/libstd/f64.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 20425aea8d5..ac8f305ae91 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -284,7 +284,7 @@ impl f32 { /// assert_eq!(a.rem_euclid(-b), 3.0); /// assert_eq!((-a).rem_euclid(-b), 1.0); /// // limitation due to round-off error - /// assert!((-std::f32::EPSILON).rem_euclid(3.0) != 0.0); + /// assert!((-f32::EPSILON).rem_euclid(3.0) != 0.0); /// ``` #[must_use = "method returns a new number and does not mutate the original value"] #[inline] @@ -962,7 +962,7 @@ impl f32 { /// assert!((-3.0f32).clamp(-2.0, 1.0) == -2.0); /// assert!((0.0f32).clamp(-2.0, 1.0) == 0.0); /// assert!((2.0f32).clamp(-2.0, 1.0) == 1.0); - /// assert!((std::f32::NAN).clamp(-2.0, 1.0).is_nan()); + /// assert!((f32::NAN).clamp(-2.0, 1.0).is_nan()); /// ``` #[must_use = "method returns a new number and does not mutate the original value"] #[unstable(feature = "clamp", issue = "44095")] diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index a1128a589a6..798738e50a7 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -280,7 +280,7 @@ impl f64 { /// assert_eq!(a.rem_euclid(-b), 3.0); /// assert_eq!((-a).rem_euclid(-b), 1.0); /// // limitation due to round-off error - /// assert!((-std::f64::EPSILON).rem_euclid(3.0) != 0.0); + /// assert!((-f64::EPSILON).rem_euclid(3.0) != 0.0); /// ``` #[must_use = "method returns a new number and does not mutate the original value"] #[inline] @@ -928,7 +928,7 @@ impl f64 { /// assert!((-3.0f64).clamp(-2.0, 1.0) == -2.0); /// assert!((0.0f64).clamp(-2.0, 1.0) == 0.0); /// assert!((2.0f64).clamp(-2.0, 1.0) == 1.0); - /// assert!((std::f64::NAN).clamp(-2.0, 1.0).is_nan()); + /// assert!((f64::NAN).clamp(-2.0, 1.0).is_nan()); /// ``` #[must_use = "method returns a new number and does not mutate the original value"] #[unstable(feature = "clamp", issue = "44095")] |
