Skip to content

Commit 915f3f7

Browse files
committed
update to 2018 edition
1 parent 66646d4 commit 915f3f7

32 files changed

+58
-113
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ keywords = ["measurements", "lengths", "weights", "temperatures", "volumes"]
1313
description = "Handle metric, imperial, and other measurements with ease! Types: Length, Temperature, Weight, Volume, Pressure"
1414
license = "MIT"
1515
readme = "README.md"
16+
edition = "2018"
1617

1718
[features]
1819
std = []

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ measurements = "0.11"
5252
In your code...
5353

5454
```rust
55-
extern crate measurements;
56-
5755
use measurements::{Length, Pressure, Temperature, Volume, Mass};
5856

5957
fn main() {

examples/engine.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
extern crate measurements;
21
use measurements::{AngularVelocity, Power};
32

43
fn main() {

examples/format_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
extern crate measurements;
21
use measurements::*;
32

43
fn main() {

examples/frequency.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate measurements;
2-
31
fn main() {
42
// Sinusiodal Oscilator moves at 5 Hz across 50 mm
53
let f = measurements::Frequency::from_hertz(5.0);

src/acceleration.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Types and constants for handling acceleration.
22
3-
use super::length;
4-
use super::measurement::*;
3+
use crate::{length, measurement::*};
54
#[cfg(feature = "from_str")]
65
use regex::Regex;
76
#[cfg(feature = "from_str")]
@@ -13,7 +12,6 @@ use std::str::FromStr;
1312
/// # Example
1413
///
1514
/// ```
16-
/// extern crate measurements;
1715
/// use measurements::{Acceleration, Length, Speed};
1816
/// use std::time::Duration;
1917
///
@@ -120,15 +118,13 @@ implement_measurement! { Acceleration }
120118
#[cfg(test)]
121119
mod test {
122120

123-
use super::*;
124-
use speed::Speed;
125-
use test_utils::assert_almost_eq;
121+
use crate::{speed::Speed, test_utils::assert_almost_eq, *};
126122

127123
// Metric
128124
#[test]
129125
fn speed_over_time() {
130126
let s1 = Speed::from_meters_per_second(10.0);
131-
let t1 = ::time::Duration::new(5, 0);
127+
let t1 = crate::time::Duration::new(5, 0);
132128
let i1 = s1 / t1;
133129
let r1 = i1.as_meters_per_second_per_second();
134130
assert_almost_eq(r1, 2.0);

src/angle.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub struct Angle {
2828
impl Angle {
2929
/// Create a new Angle from a floating point value in degrees
3030
pub fn from_degrees(degrees: f64) -> Self {
31-
Angle::from_radians(degrees * ::PI / 180.0)
31+
Angle::from_radians(degrees * crate::PI / 180.0)
3232
}
3333

3434
/// Create a new Angle from a floating point value in radians
@@ -38,7 +38,7 @@ impl Angle {
3838

3939
/// Convert this Angle to a floating point value in degrees
4040
pub fn as_degrees(&self) -> f64 {
41-
self.radians * 180.0 / ::PI
41+
self.radians * 180.0 / crate::PI
4242
}
4343

4444
/// Convert this Angle to a floating point value in radians
@@ -134,9 +134,7 @@ implement_measurement! { Angle }
134134

135135
#[cfg(test)]
136136
mod test {
137-
use angle::*;
138-
use std::f64::consts::PI;
139-
use test_utils::assert_almost_eq;
137+
use crate::{angle::*, test_utils::assert_almost_eq, PI};
140138

141139
#[test]
142140
fn radians() {

src/angular_velocity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//! Types and constants for handling speed of rotation (angular velocity)
22
33
use super::measurement::*;
4+
use crate::PI;
45
#[cfg(feature = "from_str")]
56
use regex::Regex;
67
#[cfg(feature = "from_str")]
78
use std::str::FromStr;
8-
use PI;
99

1010
/// The 'AngularVelocity' struct can be used to deal with angular velocities in a common way.
1111
///
@@ -106,7 +106,7 @@ implement_measurement! { AngularVelocity }
106106
#[cfg(test)]
107107
mod test {
108108
use super::*;
109-
use test_utils::assert_almost_eq;
109+
use crate::test_utils::assert_almost_eq;
110110

111111
#[test]
112112
fn rpm() {

src/area.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,7 @@ implement_measurement! { Area }
359359

360360
#[cfg(test)]
361361
mod test {
362-
use area::*;
363-
use test_utils::assert_almost_eq;
362+
use crate::{area::*, test_utils::assert_almost_eq};
364363

365364
#[test]
366365
fn square_meters() {

src/current.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ implement_measurement! { Current }
100100

101101
#[cfg(test)]
102102
mod test {
103-
use current::*;
104-
use test_utils::assert_almost_eq;
103+
use crate::{current::*, test_utils::assert_almost_eq};
105104

106105
#[test]
107106
pub fn as_amperes() {

0 commit comments

Comments
 (0)