Don't use additional scope

next
Sayan Nandan 3 years ago
parent fb503e2981
commit d9af302417

@ -335,7 +335,7 @@ where
#[cfg(windows)] #[cfg(windows)]
Err(e) => match e.kind() { Err(e) => match e.kind() {
ErrorKind::ConnectionReset => return Ok(()), ErrorKind::ConnectionReset => return Ok(()),
_ => return Err(e.into()) _ => return Err(e.into()),
}, },
Err(e) => return Err(e.into()), Err(e) => return Err(e.into()),
} }

@ -394,26 +394,25 @@ pub async fn run(
if let Err(e) = lock.unlock().await { if let Err(e) = lock.unlock().await {
log::error!("Failed to release lock on data file with '{}'", e); log::error!("Failed to release lock on data file with '{}'", e);
process::exit(0x100); process::exit(0x100);
} else { }
if let Err(e) = flush_db!(db) { if let Err(e) = flush_db!(db) {
log::error!("Failed to flush data to disk with '{}'", e); log::error!("Failed to flush data to disk with '{}'", e);
loop { loop {
// Keep looping until we successfully write the in-memory table to disk // Keep looping until we successfully write the in-memory table to disk
log::warn!("Press enter to try again..."); log::warn!("Press enter to try again...");
io::stdout().flush().unwrap(); io::stdout().flush().unwrap();
io::stdin().read(&mut [0]).unwrap(); io::stdin().read(&mut [0]).unwrap();
if let Ok(_) = flush_db!(db) { if let Ok(_) = flush_db!(db) {
log::info!("Successfully saved data to disk"); log::info!("Successfully saved data to disk");
break; break;
} else { } else {
continue; continue;
}
} }
} else {
log::info!("Successfully saved data to disk");
} }
terminal::write_info("Goodbye :)\n").unwrap(); } else {
log::info!("Successfully saved data to disk");
} }
terminal::write_info("Goodbye :)\n").unwrap();
} }
/// This is a **test only** function /// This is a **test only** function

Loading…
Cancel
Save