Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn foo(s: &str) -> Result<i32, &str> {
- // it's just small temporary value
- let tmp = match s {
- "a" => 0,
- "b" => 42,
- _ => panic!("unexpected string"),
- // _ => return Err("unexpected string"),
- };
- // some more computations that uses `tmp` variable to produce actual result
- Ok(tmp)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement