Closed
Description
Description
Hello all,
Is this warning OK - or false positive ?
let r: Result<i32, std::num::ParseIntError> = (|| -> Result<i32, std::num::ParseIntError> {
Ok("1".parse::<i32>()?) })();
Gives:
question mark operator is useless here
for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
#[warn(clippy::needless_question_mark)]
on by default
But of course:
let r: Result<i32, std::num::ParseIntError> = (|| -> Result<i32, std::num::ParseIntError> {
Ok("1".parse::<i32>() ) })();
Gives:
mismatched types
expected typei32
found enumstd::result::Result<i32, std::num::ParseIntError>
And this:
let r: Result<i32, std::num::ParseIntError> = (|| -> Result<i32, std::num::ParseIntError> {
Ok("1".parse::<i32>()? + "2".parse::<i32>()?) })();
does not produce warning.
Version
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
No labels