Skip to content

Commit

Permalink
Mutable reference should be used with an FnMut type
Browse files Browse the repository at this point in the history
  • Loading branch information
EFanZh authored and ehuss committed Aug 5, 2023
1 parent 55fcfa1 commit f371996
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/revwalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<'repo> Revwalk<'repo> {
/// the walk.
pub fn with_hide_callback<'cb, C>(
self,
callback: &'cb C,
callback: &'cb mut C,
) -> Result<RevwalkWithHideCb<'repo, 'cb, C>, Error>
where
C: FnMut(Oid) -> bool,
Expand All @@ -170,7 +170,7 @@ impl<'repo> Revwalk<'repo> {
raw::git_revwalk_add_hide_cb(
r.revwalk.raw(),
Some(revwalk_hide_cb::<C>),
callback as *const _ as *mut c_void,
callback as *mut _ as *mut c_void,
);
};
Ok(r)
Expand Down Expand Up @@ -304,8 +304,8 @@ mod tests {
walk.reset().unwrap();
walk.push_head().unwrap();

let hide_cb = |oid| oid == target;
let mut walk = walk.with_hide_callback(&hide_cb).unwrap();
let mut hide_cb = |oid| oid == target;
let mut walk = walk.with_hide_callback(&mut hide_cb).unwrap();

assert_eq!(walk.by_ref().count(), 0);

Expand Down

0 comments on commit f371996

Please sign in to comment.