Skip to content

Commit b92038b

Browse files
committed
tree_walk: Use GIT_EUSER to abort a traversal
As per the discussion in libgit2/libgit2#4703. This requires making TreeWalkResult #[repr(i32)], which is fine. Also, remove an unnecessary pragma.
1 parent 701e293 commit b92038b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/tree.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ pub enum TreeWalkMode {
4343
}
4444

4545
/// Possible return codes for tree walking callback functions.
46-
#[allow(dead_code)]
46+
#[repr(i32)]
4747
pub enum TreeWalkResult {
4848
/// Continue with the traversal as normal.
4949
Ok = 0,
5050
/// Skip the current node (in pre-order mode).
5151
Skip = 1,
5252
/// Completely stop the traversal.
53-
Abort = -1,
53+
Abort = raw::GIT_EUSER,
5454
}
5555

5656
impl Into<i32> for TreeWalkResult {
@@ -520,7 +520,7 @@ mod tests {
520520
0
521521
}).unwrap();
522522
assert_eq!(ct, 1);
523-
523+
524524
let mut ct = 0;
525525
tree.walk(TreeWalkMode::PreOrder, |_, entry| {
526526
assert_eq!(entry.name(), Some("foo"));

0 commit comments

Comments
 (0)