From aab48390371e0e79b9e00783e645bc1f6dfadd41 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Sun, 6 Dec 2020 02:28:38 -0800 Subject: change some type signatures in the library, remove redundant stuff --- lib/src/lib.rs | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/src/lib.rs b/lib/src/lib.rs index d09e357..8798359 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -19,7 +19,7 @@ pub fn read_lines_file(filename: &str) -> Result> { let mut reader = BufReader::new(file); let mut buffer = String::new(); - let mut input: Vec = Vec::new(); + let mut input = Vec::new(); loop { reader.read_line(&mut buffer)?; if buffer.len() == 0 { @@ -43,24 +43,7 @@ pub fn read_lines_file(filename: &str) -> Result> { Ok(input) } -pub fn trim_lines<'a>(lines: &'a Vec) -> Vec<&str> { - let mut trimmed_lines = Vec::new(); - - for line in lines { - match line.strip_suffix("\n") { - Some(stripped) => { - trimmed_lines.push(stripped); - } - None => { - trimmed_lines.push(line); - } - } - } - - trimmed_lines -} - -pub fn group_lines_by_blanks(lines: Vec<&str>) -> Vec> { +pub fn group_lines_by_blanks(lines: Vec) -> Vec> { let mut all_groups = Vec::new(); let mut current_group = Vec::new(); -- cgit 1.4.1