Rust doesn't do type analysis like TypeScript or new instanceof in Java.
Type of a variable stays the same, even if you checked what is in it.
Result/Err is not special in Rust. It's just an enum, like enum R { A, B, C }, so if you checked that variable == R::A, it wouldn't change it to be R::B.
You need to pattern match on Result::Ok to get the non-error value, or use ? (Try) operator that does this match itself.