summaryrefslogtreecommitdiffstats
path: root/src/choice.rs
diff options
context:
space:
mode:
authorRyan Geary <rtgnj42@gmail.com>2019-09-29 23:06:30 -0400
committerRyan Geary <rtgnj42@gmail.com>2019-09-29 23:10:33 -0400
commit09ddbb4f659076e08b2e85fb65fea97623178eb7 (patch)
treec206a005e35ee7c460800bbcf01c9038c53b96ff /src/choice.rs
parentba26c1f42d9cc0ff8e06982d9456479881da8f0a (diff)
Use BufWriter and write(ln)! instead of print(ln)!
Diffstat (limited to 'src/choice.rs')
-rw-r--r--src/choice.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/choice.rs b/src/choice.rs
index ab56fc0..eb20dc4 100644
--- a/src/choice.rs
+++ b/src/choice.rs
@@ -172,6 +172,7 @@ mod tests {
}
+use crate::io::{BufWriter, Write};
use regex::Regex;
use std::convert::TryInto;
use std::num::ParseIntError;
@@ -214,8 +215,13 @@ pub enum Choice {
}
impl Choice {
- pub fn print_choice(&self, line: &String, opt: &Opt) {
- print!("{}", self.get_choice_slice(line, opt).join(" "));
+ pub fn print_choice(
+ &self,
+ line: &String,
+ opt: &Opt,
+ handle: &mut BufWriter<std::io::StdoutLock>,
+ ) {
+ write!(handle, "{}", self.get_choice_slice(line, opt).join(" "));
}
fn get_choice_slice<'a>(&self, line: &'a String, opt: &Opt) -> Vec<&'a str> {