Remove .unwrap() shit
This commit is contained in:
parent
e4001c99c7
commit
194d6f5df2
12
src/main.rs
12
src/main.rs
@ -29,9 +29,15 @@ fn parse_config(conf: String, pool: &mut Vec<robot::Robot>) -> Result<world::Wor
|
||||
Some(raw) => raw,
|
||||
};
|
||||
let mut tokens = raw_line.split_whitespace();
|
||||
let token1 = tokens.next();
|
||||
let token2 = tokens.next();
|
||||
println!("{}, {}", token1.unwrap(), token2.unwrap());
|
||||
let token1 = match tokens.next() {
|
||||
None => return Err("Could not read the first token of the first line !"),
|
||||
Some(raw) => raw,
|
||||
};
|
||||
let token2 = match tokens.next() {
|
||||
None => return Err("Could not read the second token of the first line !"),
|
||||
Some(raw) => raw,
|
||||
};
|
||||
println!("{}, {}", token1, token2);
|
||||
Ok(world::World { x: 5, y: 5 })
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user