File tree Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ const COULOMBS_CONSTANT: f64 = 8.9875517923e9;
1414pub enum CoulombsLawError {
1515 ExtraZeroArg ( String ) ,
1616 NegativeDistance ( String ) ,
17- NoneZeroArg ( String ) ,
1817}
1918pub 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}
6560fn calculate_distance ( charge_product : f64 , force : f64 ) -> f64 {
6661 ( COULOMBS_CONSTANT * charge_product / force. abs ( ) ) . sqrt ( )
You can’t perform that action at this time.
0 commit comments