diff options
author | Irene Knapp <ireneista@gmail.com> | 2020-12-06 02:28:38 -0800 |
---|---|---|
committer | Irene Knapp <ireneista@gmail.com> | 2020-12-06 02:28:38 -0800 |
commit | aab48390371e0e79b9e00783e645bc1f6dfadd41 (patch) | |
tree | 718be944321aef47274cf21bbb9d634ab0b47773 | |
parent | f093d4bc872b6a04ac00e54204c82b56cd5ee157 (diff) |
change some type signatures in the library, remove redundant stuff
-rw-r--r-- | lib/src/lib.rs | 21 |
1 files changed, 2 insertions, 19 deletions
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<Vec<String>> { let mut reader = BufReader::new(file); let mut buffer = String::new(); - let mut input: Vec<String> = 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<Vec<String>> { Ok(input) } -pub fn trim_lines<'a>(lines: &'a Vec<String>) -> 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<Vec<&str>> { +pub fn group_lines_by_blanks(lines: Vec<String>) -> Vec<Vec<String>> { let mut all_groups = Vec::new(); let mut current_group = Vec::new(); |