From f45f00cbbe32d473deb4e23e8944a5a61e5f8e45 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 27 Apr 2016 16:46:07 -0400 Subject: main: Ignore errors, don't write to STDERR Well, after all that error handling I'm going to have to remove error output. The problem was that this STDERR output interfered with the output of the email in Mutt. When viewing a message, the screen would become mangled (for certain messages), and I'd have to refresh (Ctrl-L) the view. After initially thinking this was because I was using `println!` instead of flushing a full buffer to STDOUT, I just now realised that my output to STDERR could be causing the problem. Sure enough, removing the STDERR output fixed the issue. This is certainly not ideal, so in the long term we'll probably want to add some kind of logging mechanism so that users actually have visibility into errors. But for now and for my own personal purposes, I think this works. And at least it gets me around the immediate annoying screen mangling issue. --- src/main.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 1129ec7..8b9c93a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ //! person has multiple email addresses. use std::env; -use std::io::{self, BufRead, Write}; +use std::io::{self, BufRead}; mod alias; @@ -42,12 +42,7 @@ fn main() { if line.starts_with("From: ") { let mut alias = Alias::new(&line); - match alias.write_to_file(&file) { - Ok(_) => continue, - Err(e @ AliasSearchError::NotFound) | Err(e @ AliasSearchError::EmailExists) => - io::stderr().write(e.to_string().as_bytes()).ok(), - Err(e) => io::stderr().write(e.to_string().as_bytes()).ok(), - }; + alias.write_to_file(&file).ok(); } } } -- cgit v1.2.3