From 35c250c70529d654fda8372c8c48a762fca61166 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 7 Aug 2020 09:25:40 +0200 Subject: [PATCH] do not silently ingnore peerstate error in repl; in repl it is okay to panic/unwrap --- examples/repl/cmdline.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/repl/cmdline.rs b/examples/repl/cmdline.rs index 14f5b338d..8df9358a9 100644 --- a/examples/repl/cmdline.rs +++ b/examples/repl/cmdline.rs @@ -284,13 +284,14 @@ async fn log_contactlist(context: &Context, contacts: &[u32]) { "addr unset" } ); - if let Ok(peerstate) = Peerstate::from_addr(context, &addr).await { - if peerstate.is_some() && contact_id != 1 as libc::c_uint { - line2 = format!( - ", prefer-encrypt={}", - peerstate.as_ref().unwrap().prefer_encrypt - ); - } + let peerstate = Peerstate::from_addr(context, &addr) + .await + .expect("peerstate error"); + if peerstate.is_some() && contact_id != 1 as libc::c_uint { + line2 = format!( + ", prefer-encrypt={}", + peerstate.as_ref().unwrap().prefer_encrypt + ); } println!("Contact#{}: {}{}", contact_id, line, line2);