Unified · Split
| @@ -17,11 +17,11 @@ mod from_bytes { · 16 unmodified lines | |||
| 17 | .max_depth(2) | 17 | .max_depth(2) |
| 18 | .follow_links(false) | 18 | .follow_links(false) |
| 19 | .into_iter() | 19 | .into_iter() |
| 20 | .filter_map(|e| e.ok().map(|e| (e.file_name() == "baseline.git").then(|| e)).flatten()) | 20 | .filter_map(|e| e.ok().and_then(|e| (e.file_name() == "baseline.git").then(|| e))) |
| 21 | { | 21 | { |
| 22 | let map = baseline_map | 22 | let map = baseline_map |
| 23 | .entry(baseline_entry.path().parent().expect("file in directory").into()) | 23 | .entry(baseline_entry.path().parent().expect("file in directory").into()) |
| 24 | .or_insert(HashMap::default()); | 24 | .or_insert_with(HashMap::default); |
| 25 | let baseline = std::fs::read(baseline_entry.path()).unwrap(); | 25 | let baseline = std::fs::read(baseline_entry.path()).unwrap(); |
| 26 | let mut lines = baseline.lines().peekable(); | 26 | let mut lines = baseline.lines().peekable(); |
| 27 | while let Some(spec) = lines.next() { | 27 | while let Some(spec) = lines.next() { |
| @@ -62,7 +62,7 @@ mod from_bytes { · 34 unmodified lines | |||
| 62 | assert_eq!( | 62 | assert_eq!( |
| 63 | &actual, | 63 | &actual, |
| 64 | BASELINE | 64 | BASELINE |
| 65 | .get(repo.work_dir().unwrap_or(repo.git_dir())) | 65 | .get(repo.work_dir().unwrap_or_else(|| repo.git_dir())) |
| 66 | .unwrap_or_else(|| panic!("No baseline for {:?}", repo)) | 66 | .unwrap_or_else(|| panic!("No baseline for {:?}", repo)) |
| 67 | .get(&spec) | 67 | .get(&spec) |
| 68 | .unwrap_or_else(|| panic!("'{}' revspec not found in git baseline", spec)), | 68 | .unwrap_or_else(|| panic!("'{}' revspec not found in git baseline", spec)), |