mirror of
https://github.com/nushell/nushell.git
synced 2025-01-11 08:48:23 +01:00
fix small bug converting string to int (#6031)
This commit is contained in:
parent
8b6232ac87
commit
c2f8f4bd9b
@ -291,7 +291,7 @@ fn int_from_string(a_string: &str, span: Span) -> Result<i64, ShellError> {
|
||||
};
|
||||
Ok(num)
|
||||
}
|
||||
_ => match a_string.parse::<i64>() {
|
||||
_ => match trimmed.parse::<i64>() {
|
||||
Ok(n) => Ok(n),
|
||||
Err(_) => match a_string.parse::<f64>() {
|
||||
Ok(f) => Ok(f as i64),
|
||||
@ -299,7 +299,10 @@ fn int_from_string(a_string: &str, span: Span) -> Result<i64, ShellError> {
|
||||
"int".to_string(),
|
||||
"string".to_string(),
|
||||
span,
|
||||
None,
|
||||
Some(format!(
|
||||
r#"string "{}" does not represent a valid integer"#,
|
||||
trimmed
|
||||
)),
|
||||
)),
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user