File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,11 +48,16 @@ fn format_and_write<W: std::io::Write>(
4848 } ;
4949
5050 // Return false if the input is in scientific notation
51- if line. contains ( & 101 ) && line[ line. len ( ) - 1 ] != 69 && line. contains ( & 69 ) && line[ line. len ( ) - 1 ] != 101 && line[ 0 ] >= 48 && line[ 0 ] <= 57 {
52- let err = NumfmtError :: FormattingError ( String :: from_utf8_lossy ( line) . to_string ( ) ) ;
53- let _ = writeln ! ( stderr( ) , "numfmt: invalid number: '{err}'" ) ;
54-
55- return Ok ( false ) ;
51+ if let Some ( pos) = line. iter ( ) . position ( |& b| b == b'E' || b == b'e' ) {
52+ if pos < line. len ( ) - 1 {
53+ if line[ pos + 1 ] >= 48 && line[ pos + 1 ] <= 57 {
54+ let errormsg = format ! (
55+ "invalid suffix in input: '{}'" ,
56+ NumfmtError :: FormattingError ( String :: from_utf8_lossy( line) . to_string( ) )
57+ ) ;
58+ return Err ( Box :: new ( NumfmtError :: FormattingError ( errormsg) ) ) ;
59+ }
60+ }
5661 }
5762
5863 // In non-abort modes we buffer the formatted output so that on error we
You can’t perform that action at this time.
0 commit comments