From 8db83a46b1d335c565ac225cf97119767c703468 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 21 May 2021 14:03:01 +0100 Subject: [PATCH] otter(1) reset: Bundle scanning: Improve messages and style Signed-off-by: Ian Jackson --- src/bin/otter.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/bin/otter.rs b/src/bin/otter.rs index 76b398cd..3f2430f4 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -802,10 +802,16 @@ mod reset_game { use EitherOrBoth::*; use bundles::State::*; match eob { - Left(local) => Err(format!("server is missing {}", local.file)), - Right(_) => Ok(()), - Both(_local, (id, Uploading)) - => Err(format!("server has incomplete upload :{}", id)), + Right(_) => { + Ok(()) + }, + Left(local) => { + Err(format!("server is missing {} {} {}", + local.kind, local.hash, local.file)) + }, + Both(_local, (id, Uploading)) => { + Err(format!("server has incomplete upload :{}", id)) + }, Both(local, (id, Loaded(remote))) => { if (local.size, local.hash) != (remote.size, remote.hash) { @@ -815,11 +821,11 @@ mod reset_game { } } } - }).find_map(Result::err) { - None => { + }).find_map(Result::err).map_or_else(|| Ok(()), Err) { + Ok(()) => { eprintln!("Reusing server's existing bundles"); }, - Some(why) => { + Err(why) => { if ma.verbose >= 0 { eprintln!("Re-uploading bundles: {}", why); } -- 2.30.2