Showing the changes to git-commitgraph/tests/commitgraph.rs (1 of 3 files). Show all
Unified · Split
| @@ -9,6 +9,8 @@ use std::{ · 8 unmodified lines | ||
| 9 | 9 | process::Command, |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | +type Result = std::result::Result<(), Box<dyn std::error::Error>>; | |
| 13 | + | |
| 12 | 14 | mod access; |
| 13 | 15 | |
| 14 | 16 | pub fn check_common(cg: &Graph, expected: &HashMap<String, RefInfo, impl BuildHasher>) { |
| @@ -35,6 +37,7 @@ pub fn check_common(cg: &Graph, expected: &HashMap<String, RefInfo, impl BuildHa · 20 unmodified lines | ||
| 35 | 37 | .expect("find RefInfo by id") |
| 36 | 38 | }) |
| 37 | 39 | .collect(); |
| 40 | + | |
| 38 | 41 | let commit = cg.commit_at(ref_info.pos()); |
| 39 | 42 | assert_eq!(commit.id(), ref_info.id()); |
| 40 | 43 | assert_eq!(commit.root_tree_id(), ref_info.root_tree_id()); |
| @@ -45,7 +48,7 @@ pub fn check_common(cg: &Graph, expected: &HashMap<String, RefInfo, impl BuildHa · 4 unmodified lines | ||
| 45 | 48 | assert_eq!( |
| 46 | 49 | commit |
| 47 | 50 | .iter_parents() |
| 48 | − .collect::<Result<Vec<_>, _>>() | |
| 51 | + .collect::<std::result::Result<Vec<_>, _>>() | |
| 49 | 52 | .expect("failed to access commit's parents"), |
| 50 | 53 | expected_parents.iter().map(|x| x.pos()).collect::<Vec<_>>() |
| 51 | 54 | ); |
| @@ -134,10 +137,11 @@ pub fn inspect_refs(repo_dir: impl AsRef<Path>, refs: &[&'static str]) -> HashMa · 82 unmodified lines | ||
| 134 | 137 | infos.sort_by_key(|x| x.1); |
| 135 | 138 | |
| 136 | 139 | let get_pos = |id: borrowed::Id| -> GraphPosition { |
| 137 | − let pos = infos | |
| 140 | + let pos: u32 = infos | |
| 138 | 141 | .binary_search_by_key(&id, |x| x.1.to_borrowed()) |
| 139 | − .expect("sorted_ids to contain id"); | |
| 140 | − let pos: u32 = pos.try_into().expect("graph position to fit in u32"); | |
| 142 | + .expect("sorted_ids to contain id") | |
| 143 | + .try_into() | |
| 144 | + .expect("graph position to fit in u32"); | |
| 141 | 145 | GraphPosition(pos) |
| 142 | 146 | }; |
| 143 | 147 | |