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 {
280
280
"dwt" => Mass :: from_pennyweights ( float_val. parse :: < f64 > ( ) ?) ,
281
281
"oz" => Mass :: from_ounces ( float_val. parse :: < f64 > ( ) ?) ,
282
282
"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 > ( ) ?) ,
284
284
_ => Mass :: from_grams ( float_val. parse :: < f64 > ( ) ?) ,
285
285
} ,
286
286
) ;
@@ -602,6 +602,7 @@ mod test {
602
602
fn pounds_from_string ( ) {
603
603
assert_almost_eq ( 123.0 , Mass :: from_str ( "123lbs" ) . unwrap ( ) . as_pounds ( ) ) ;
604
604
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 ( ) ) ;
605
606
}
606
607
607
608
#[ test]
You can’t perform that action at this time.
0 commit comments