i5-add-tests (part 3) #9
1 changed files with 3 additions and 5 deletions
|
@ -7,11 +7,9 @@ pub fn lines_from(file_name: &str) -> Result<Vec<String>> {
|
||||||
let file = File::open(file_name)?;
|
let file = File::open(file_name)?;
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
let mut lines = vec![];
|
let mut lines = vec![];
|
||||||
for line in reader.lines() {
|
for line in reader.lines().flatten() {
|
||||||
if let Ok(line) = line {
|
if line.starts_with('@') {
|
||||||
if line.starts_with('@') {
|
lines.push(line);
|
||||||
lines.push(line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(lines)
|
Ok(lines)
|
||||||
|
|
Loading…
Add table
Reference in a new issue