Skip to content

Commit f907fea

Browse files
remove unreachable code in coulombs law
1 parent 4f862f3 commit f907fea

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/electronics/coulombs_law.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const COULOMBS_CONSTANT: f64 = 8.9875517923e9;
1414
pub enum CoulombsLawError {
1515
ExtraZeroArg(String),
1616
NegativeDistance(String),
17-
NoneZeroArg(String),
1817
}
1918
pub fn coulombs_law(
2019
force: f64,
@@ -51,16 +50,12 @@ pub fn coulombs_law(
5150
"charge2: {}",
5251
calculate_charge(charge1, force, distance)
5352
));
54-
} else if distance == 0.0 {
53+
} else {
5554
return Ok(format!(
5655
"distance: {}",
5756
calculate_distance(charge_product, force)
5857
));
5958
}
60-
61-
Err(CoulombsLawError::NoneZeroArg(String::from(
62-
"Exactly one argument must be 0",
63-
)))
6459
}
6560
fn calculate_distance(charge_product: f64, force: f64) -> f64 {
6661
(COULOMBS_CONSTANT * charge_product / force.abs()).sqrt()

0 commit comments

Comments
 (0)