diff options
author | Ryan Geary <rtgnj42@gmail.com> | 2019-09-29 18:21:36 -0400 |
---|---|---|
committer | Ryan Geary <rtgnj42@gmail.com> | 2019-09-29 23:10:14 -0400 |
commit | ba26c1f42d9cc0ff8e06982d9456479881da8f0a (patch) | |
tree | f03a14ada204c26961f7dda0585e1bad86f13c1e | |
parent | 0b1a59ad2a55a81d58943a01da124e518450e15c (diff) |
Stop `collect`ing lines of stdin
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index de1eb0f..063fa39 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,11 +14,16 @@ fn main() { let buf = BufReader::new(read); - let lines: Vec<String> = buf.lines().map(|x| x.unwrap()).collect(); + let lines = buf.lines(); for line in lines { - for choice in &opt.choice { - choice.print_choice(&line, &opt); + match line { + Ok(l) => { + for choice in &opt.choice { + choice.print_choice(&l, &opt); + } + println!(); + } + Err(e) => println!("ERROR: {}", e), } - println!(); } } |