Skip to content

Commit 83191c2

Browse files
committed
Update float documentation to use associated consts
1 parent 0869274 commit 83191c2

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/libcore/num/f32.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ impl f32 {
213213
/// Returns `true` if this value is `NaN`.
214214
///
215215
/// ```
216-
/// use std::f32;
217-
///
218216
/// let nan = f32::NAN;
219217
/// let f = 7.0_f32;
220218
///
@@ -239,8 +237,6 @@ impl f32 {
239237
/// `false` otherwise.
240238
///
241239
/// ```
242-
/// use std::f32;
243-
///
244240
/// let f = 7.0f32;
245241
/// let inf = f32::INFINITY;
246242
/// let neg_inf = f32::NEG_INFINITY;
@@ -261,8 +257,6 @@ impl f32 {
261257
/// Returns `true` if this number is neither infinite nor `NaN`.
262258
///
263259
/// ```
264-
/// use std::f32;
265-
///
266260
/// let f = 7.0f32;
267261
/// let inf = f32::INFINITY;
268262
/// let neg_inf = f32::NEG_INFINITY;
@@ -286,8 +280,6 @@ impl f32 {
286280
/// [subnormal], or `NaN`.
287281
///
288282
/// ```
289-
/// use std::f32;
290-
///
291283
/// let min = f32::MIN_POSITIVE; // 1.17549435e-38f32
292284
/// let max = f32::MAX;
293285
/// let lower_than_min = 1.0e-40_f32;
@@ -315,7 +307,6 @@ impl f32 {
315307
///
316308
/// ```
317309
/// use std::num::FpCategory;
318-
/// use std::f32;
319310
///
320311
/// let num = 12.4_f32;
321312
/// let inf = f32::INFINITY;
@@ -375,8 +366,6 @@ impl f32 {
375366
/// Takes the reciprocal (inverse) of a number, `1/x`.
376367
///
377368
/// ```
378-
/// use std::f32;
379-
///
380369
/// let x = 2.0_f32;
381370
/// let abs_difference = (x.recip() - (1.0 / x)).abs();
382371
///
@@ -391,7 +380,7 @@ impl f32 {
391380
/// Converts radians to degrees.
392381
///
393382
/// ```
394-
/// use std::f32::{self, consts};
383+
/// use std::f32::consts;
395384
///
396385
/// let angle = consts::PI;
397386
///
@@ -410,7 +399,7 @@ impl f32 {
410399
/// Converts degrees to radians.
411400
///
412401
/// ```
413-
/// use std::f32::{self, consts};
402+
/// use std::f32::consts;
414403
///
415404
/// let angle = 180.0f32;
416405
///

src/libcore/num/f64.rs

-9
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ impl f64 {
212212
/// Returns `true` if this value is `NaN`.
213213
///
214214
/// ```
215-
/// use std::f64;
216-
///
217215
/// let nan = f64::NAN;
218216
/// let f = 7.0_f64;
219217
///
@@ -238,8 +236,6 @@ impl f64 {
238236
/// `false` otherwise.
239237
///
240238
/// ```
241-
/// use std::f64;
242-
///
243239
/// let f = 7.0f64;
244240
/// let inf = f64::INFINITY;
245241
/// let neg_inf = f64::NEG_INFINITY;
@@ -260,8 +256,6 @@ impl f64 {
260256
/// Returns `true` if this number is neither infinite nor `NaN`.
261257
///
262258
/// ```
263-
/// use std::f64;
264-
///
265259
/// let f = 7.0f64;
266260
/// let inf: f64 = f64::INFINITY;
267261
/// let neg_inf: f64 = f64::NEG_INFINITY;
@@ -285,8 +279,6 @@ impl f64 {
285279
/// [subnormal], or `NaN`.
286280
///
287281
/// ```
288-
/// use std::f64;
289-
///
290282
/// let min = f64::MIN_POSITIVE; // 2.2250738585072014e-308f64
291283
/// let max = f64::MAX;
292284
/// let lower_than_min = 1.0e-308_f64;
@@ -314,7 +306,6 @@ impl f64 {
314306
///
315307
/// ```
316308
/// use std::num::FpCategory;
317-
/// use std::f64;
318309
///
319310
/// let num = 12.4_f64;
320311
/// let inf = f64::INFINITY;

0 commit comments

Comments
 (0)