Skip to content

Commit 28c9231

Browse files
committed
Make libcore float constant examples similar to libstd
1 parent daf8afd commit 28c9231

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/libcore/num/f32.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,7 @@ impl f32 {
394394
/// Converts radians to degrees.
395395
///
396396
/// ```
397-
/// use std::f32::consts;
398-
///
399-
/// let angle = consts::PI;
397+
/// let angle = std::f32::consts::PI;
400398
///
401399
/// let abs_difference = (angle.to_degrees() - 180.0).abs();
402400
///
@@ -413,11 +411,9 @@ impl f32 {
413411
/// Converts degrees to radians.
414412
///
415413
/// ```
416-
/// use std::f32::consts;
417-
///
418414
/// let angle = 180.0f32;
419415
///
420-
/// let abs_difference = (angle.to_radians() - consts::PI).abs();
416+
/// let abs_difference = (angle.to_radians() - std::f32::consts::PI).abs();
421417
///
422418
/// assert!(abs_difference <= f32::EPSILON);
423419
/// ```

src/libcore/num/f64.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,7 @@ impl f64 {
407407
/// Converts radians to degrees.
408408
///
409409
/// ```
410-
/// use std::f64::consts;
411-
///
412-
/// let angle = consts::PI;
410+
/// let angle = std::f64::consts::PI;
413411
///
414412
/// let abs_difference = (angle.to_degrees() - 180.0).abs();
415413
///
@@ -427,11 +425,9 @@ impl f64 {
427425
/// Converts degrees to radians.
428426
///
429427
/// ```
430-
/// use std::f64::consts;
431-
///
432428
/// let angle = 180.0_f64;
433429
///
434-
/// let abs_difference = (angle.to_radians() - consts::PI).abs();
430+
/// let abs_difference = (angle.to_radians() - std::f64::consts::PI).abs();
435431
///
436432
/// assert!(abs_difference < 1e-10);
437433
/// ```

0 commit comments

Comments
 (0)