Skip to content

Commit 18286e1

Browse files
committed
clean up imports and docs to pass with current rustc
1 parent b4aa14c commit 18286e1

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/density.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub const LBCF_KGCM_FACTOR: f64 = 0.062427973725314;
2626
/// let mans_weight = Mass::from_stones(12.0);
2727
/// let water_volume = mans_weight / body_density;
2828
/// println!("{} gallons of water spilled on the floor", water_volume.as_gallons());
29-
///}
29+
/// }
3030
/// ```
3131
/// # Example2 - converting to ad-hoc units of density
3232
///
@@ -40,9 +40,8 @@ pub const LBCF_KGCM_FACTOR: f64 = 0.062427973725314;
4040
/// let density: Density = Mass::from_grams(3.0) / Volume:: from_litres(1.0);
4141
/// let ounces = (density * Volume::from_quarts(1.0)).as_ounces();
4242
/// println!("Answer is {} ounces per quart", ounces);
43-
///}
43+
/// }
4444
/// ```
45-
4645
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4746
#[derive(Copy, Clone, Debug, Default)]
4847
pub struct Density {

src/measurement.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
/// The `Measurement` trait and the `implement_measurement!` macro
2-
/// provides a common way for various measurements to be implemented.
1+
//! The `Measurement` trait and the `implement_measurement!` macro
2+
//! provides a common way for various measurements to be implemented.
3+
///
4+
/// All measurements implement this.
5+
///
6+
/// It provides conversion functions to and from raw numbers.
37
///
48
/// # Example
59
/// ```
6-
/// #![no_std]
710
/// // Importing the `implement_measurement` macro from the external crate is important
811
/// #[macro_use]
912
/// extern crate measurements;
@@ -35,16 +38,9 @@
3538
/// // You should't need it in your own code.
3639
/// fn main() { }
3740
/// ```
38-
39-
#[cfg(feature = "no-std")]
40-
use core as std;
41-
42-
#[cfg(feature = "no-std")]
43-
use core::num::Float;
44-
45-
/// All measurements implement this.
4641
///
47-
/// It provides conversion functions to and from raw numbers.
42+
/// *Note*: If you are in a `no_std` environment, you have to
43+
/// `use core as std;` for the macros to run.
4844
pub trait Measurement {
4945
/// Returns a string containing the most appropriate units for this quantity,
5046
/// and a floating point value representing this quantity in those units.

0 commit comments

Comments
 (0)