summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Geary <rtgnj42@gmail.com>2019-09-29 18:21:36 -0400
committerRyan Geary <rtgnj42@gmail.com>2019-09-29 23:10:14 -0400
commitba26c1f42d9cc0ff8e06982d9456479881da8f0a (patch)
treef03a14ada204c26961f7dda0585e1bad86f13c1e
parent0b1a59ad2a55a81d58943a01da124e518450e15c (diff)
Stop `collect`ing lines of stdin
-rw-r--r--src/main.rs13
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!();
}
}