Skip to content

Commit be2d18f

Browse files
committed
Clippy fixes
1 parent c4d23da commit be2d18f

17 files changed

+20
-34
lines changed

src/acceleration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl Acceleration {
3636
/// Create a new Acceleration from a floating point value in meters per second per second
3737
pub fn from_meters_per_second_per_second(meters_per_second_per_second: f64) -> Acceleration {
3838
Acceleration {
39-
meters_per_second_per_second: meters_per_second_per_second,
39+
meters_per_second_per_second,
4040
}
4141
}
4242

src/angle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl Angle {
3333

3434
/// Create a new Angle from a floating point value in radians
3535
pub fn from_radians(radians: f64) -> Self {
36-
Angle { radians: radians }
36+
Angle { radians }
3737
}
3838

3939
/// Convert this Angle to a floating point value in degrees

src/angular_velocity.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ pub struct AngularVelocity {
2727
impl AngularVelocity {
2828
/// Create a new AngularVelocity from a floating point value in radians per second
2929
pub fn from_radians_per_second(radians_per_second: f64) -> Self {
30-
AngularVelocity {
31-
radians_per_second: radians_per_second,
32-
}
30+
AngularVelocity { radians_per_second }
3331
}
3432

3533
/// Create a new AngularVelocity from a floating point value in revolutions per minute (RPM)

src/area.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ pub struct Area {
3131
impl Area {
3232
/// Create new area from floating point value in Square Meters
3333
pub fn from_square_meters(square_meters: f64) -> Self {
34-
Area {
35-
square_meters: square_meters,
36-
}
34+
Area { square_meters }
3735
}
3836

3937
/// Create new area from floating point value in Square Metres

src/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct Data {
3838
impl Data {
3939
/// Create new Data from floating point value in Octets
4040
pub fn from_octets(octets: f64) -> Self {
41-
Data { octets: octets }
41+
Data { octets }
4242
}
4343

4444
/// Create new Data from floating point value in Bits

src/density.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Density {
5353
/// Create a new Density from a floating point value in kilograms per cubic meter
5454
pub fn from_kilograms_per_cubic_meter(kilograms_per_cubic_meter: f64) -> Density {
5555
Density {
56-
kilograms_per_cubic_meter: kilograms_per_cubic_meter,
56+
kilograms_per_cubic_meter,
5757
}
5858
}
5959

src/energy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct Energy {
2222
impl Energy {
2323
/// Create a new Energy from a floating point value in Joules (or watt-seconds)
2424
pub fn from_joules(joules: f64) -> Energy {
25-
Energy { joules: joules }
25+
Energy { joules }
2626
}
2727

2828
/// Create a new Energy from a floating point value in Kilocalories (often just called calories)
@@ -37,7 +37,7 @@ impl Energy {
3737

3838
/// Create a new Energy from a floating point value in electron Volts (eV).
3939
pub fn from_e_v(e_v: f64) -> Energy {
40-
Self::from_joules(e_v / 6.241509479607718e+18)
40+
Self::from_joules(e_v / 6.241_509_479_607_718e18)
4141
}
4242

4343
/// Create a new Energy from a floating point value in Watt-hours (Wh)
@@ -67,7 +67,7 @@ impl Energy {
6767

6868
/// Convert this Energy into a floating point value in electron volts (eV)
6969
pub fn as_e_v(&self) -> f64 {
70-
self.joules * 6.241509479607718e+18
70+
self.joules * 6.241_509_479_607_718e18
7171
}
7272

7373
/// Convert this Energy into a floating point value in Watt-hours (Wh)

src/force.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub struct Force {
3737
impl Force {
3838
/// Create a Force from a floating point value in Newtons
3939
pub fn from_newtons(newtons: f64) -> Self {
40-
Force { newtons: newtons }
40+
Force { newtons }
4141
}
4242

4343
/// Create a Force from a floating point value in Micronewtons

src/frequency.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub type Distance = Frequency;
4141
impl Frequency {
4242
/// Create a new Frequency from a floating point value in hertz
4343
pub fn from_hertz(hertz: f64) -> Self {
44-
Frequency { hertz: hertz }
44+
Frequency { hertz }
4545
}
4646

4747
/// Create a new Frequency from a floating point value in Nanohertz.

src/length.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub type Distance = Length;
5656
impl Length {
5757
/// Create a new Length from a floating point value in meters
5858
pub fn from_meters(meters: f64) -> Self {
59-
Length { meters: meters }
59+
Length { meters }
6060
}
6161

6262
/// Create a new Length from a floating point value in metres.

0 commit comments

Comments
 (0)