File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -280,7 +280,7 @@ impl FromStr for Mass {
280280 "dwt" => Mass :: from_pennyweights ( float_val. parse :: < f64 > ( ) ?) ,
281281 "oz" => Mass :: from_ounces ( float_val. parse :: < f64 > ( ) ?) ,
282282 "st" => Mass :: from_stones ( float_val. parse :: < f64 > ( ) ?) ,
283- "lbs" => Mass :: from_pounds ( float_val. parse :: < f64 > ( ) ?) ,
283+ "lb" | " lbs" => Mass :: from_pounds ( float_val. parse :: < f64 > ( ) ?) ,
284284 _ => Mass :: from_grams ( float_val. parse :: < f64 > ( ) ?) ,
285285 } ,
286286 ) ;
@@ -602,6 +602,7 @@ mod test {
602602 fn pounds_from_string ( ) {
603603 assert_almost_eq ( 123.0 , Mass :: from_str ( "123lbs" ) . unwrap ( ) . as_pounds ( ) ) ;
604604 assert_almost_eq ( 123.0 , Mass :: from_str ( "123 lbs" ) . unwrap ( ) . as_pounds ( ) ) ;
605+ assert_almost_eq ( 123.0 , Mass :: from_str ( "123 lb" ) . unwrap ( ) . as_pounds ( ) ) ;
605606 }
606607
607608 #[ test]
You can’t perform that action at this time.
0 commit comments