fn foo(ok: bool) -> Result<i32, i32> {
if ok { Ok(0) } else { Err(0) }
}
fn main() {
let Ok(x) | Err(x) = foo(true); // rust-analyzer error: top-level or-patterns are not allowed in `let` bindings
if let Ok(x) | Err(x) = foo(true) { // rust-analyzer warn: irrefutable `if let` pattern
println!("Working!");
}
}
Or is this a rust-analyzer bug? I tried to Google but couldn't find anything.