-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Summary of the issue
When taking input into my program, I ran into a situation where the user would pass "TRUE" into a field that I was attempting to use the .parse() method into a boolean:
fn input(value: &str) -> Result<(), MyErrorType> {
let new_val: bool = value.parse().map_err(|_| MyErrorType{})?;
Ok(())
}
when I split this specific line of code into a fresh rust project:
fn main() {
let x: bool = "TRUE".parse().expect("NOPE");
}
I got the output:
thread 'main' panicked at 'NOPE: ParseBoolError', src/main.rs:20:34
What I expect to happen
I would expect rust to see the string value "TRUE" and read that as a boolean with the value true
What actually happens
I am getting an error return with MyErrorType
xTachyon
Metadata
Metadata
Assignees
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.