Simplify error-handling in seed generation
This commit is contained in:
parent
a667e6b7f2
commit
7dd0da6628
|
@ -212,7 +212,8 @@ mod test {
|
|||
Some((prefix, mid, suffix))
|
||||
}
|
||||
|
||||
fn array_string(piece_type: &str, values: &[Magic]) -> Result<String, std::fmt::Error> {
|
||||
fn array_string(piece_type: &str, values: &[Magic]) -> String {
|
||||
let inner = || -> Result<String, std::fmt::Error> {
|
||||
let mut res = String::new();
|
||||
|
||||
writeln!(
|
||||
|
@ -231,6 +232,9 @@ mod test {
|
|||
writeln!(&mut res, "];")?;
|
||||
|
||||
Ok(res)
|
||||
};
|
||||
|
||||
inner().unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -243,8 +247,8 @@ mod test {
|
|||
|
||||
let original_text = std::fs::read_to_string(file!()).unwrap();
|
||||
|
||||
let bishop_array = array_string("bishop", &bishop_magics[..]).unwrap();
|
||||
let rook_array = array_string("rook", &rook_magics[..]).unwrap();
|
||||
let bishop_array = array_string("bishop", &bishop_magics[..]);
|
||||
let rook_array = array_string("rook", &rook_magics[..]);
|
||||
|
||||
let new_text = {
|
||||
let start_marker = "// region:sourcegen\n";
|
||||
|
|
Loading…
Reference in a new issue