From 5300b09d79be066c8082af36b0fb4d7bdc1ea87d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Apr 2016 22:39:40 +0200 Subject: [PATCH] Use unused results --- imag-counter/src/interactive.rs | 14 +++++++++----- imag-counter/src/list.rs | 3 ++- imag-counter/src/main.rs | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/imag-counter/src/interactive.rs b/imag-counter/src/interactive.rs index 2edd89e2..03e6b40e 100644 --- a/imag-counter/src/interactive.rs +++ b/imag-counter/src/interactive.rs @@ -17,7 +17,7 @@ type Result = RResult; pub fn interactive(rt: &Runtime) { let scmd = rt.cli().subcommand_matches("interactive"); if scmd.is_none() { - write!(stderr(), "No subcommand"); + debug!("No subcommand"); exit(1); } let scmd = scmd.unwrap(); @@ -36,7 +36,7 @@ pub fn interactive(rt: &Runtime) { pairs.insert('q', Binding::Function(String::from("quit"), Box::new(quit))); } - stderr().flush(); + stderr().flush().ok(); loop { println!("---"); for (k, v) in &pairs { @@ -58,10 +58,14 @@ pub fn interactive(rt: &Runtime) { Some(&mut Binding::Counter(ref mut ctr)) => { if increment { debug!("Incrementing"); - ctr.inc(); + if let Err(e) = ctr.inc() { + trace_error(&e); + } } else { debug!("Decrementing"); - ctr.dec(); + if let Err(e) = ctr.dec() { + trace_error(&e); + } } true }, @@ -127,7 +131,7 @@ impl<'a> Display for Binding<'a> { fn compute_pair<'a>(rt: &'a Runtime, spec: &str) -> Result<(char, Binding<'a>)> { let kv = String::from(spec).into_kv(); if kv.is_none() { - write!(stderr(), "Key-Value parsing failed!"); + debug!("Key-Value parsing failed!"); exit(1); } let kv = kv.unwrap(); diff --git a/imag-counter/src/list.rs b/imag-counter/src/list.rs index 76e23007..37bdf155 100644 --- a/imag-counter/src/list.rs +++ b/imag-counter/src/list.rs @@ -25,7 +25,8 @@ pub fn list(rt: &Runtime) { } } }) - .map_err(|e| trace_error(&e)); + .map_err(|e| trace_error(&e)) + .ok(); } }) .map_err(|e| trace_error(&e)) diff --git a/imag-counter/src/main.rs b/imag-counter/src/main.rs index 326bff1d..076f5072 100644 --- a/imag-counter/src/main.rs +++ b/imag-counter/src/main.rs @@ -118,7 +118,8 @@ fn main() { }) }, } - .map_err(|e| trace_error(&e)); + .map_err(|e| trace_error(&e)) + .ok(); }, |name| { debug!("Call: {}", name);