mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
13 lines
305 B
Rust
13 lines
305 B
Rust
//@ run-pass
|
|
pub fn main() {
|
|
// sometimes we have had trouble finding
|
|
// the right type for f, as we unified
|
|
// bot and u32 here
|
|
let f = match "1234".parse::<usize>().ok() {
|
|
None => return (),
|
|
Some(num) => num as u32
|
|
};
|
|
assert_eq!(f, 1234);
|
|
println!("{}", f)
|
|
}
|