Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FnMut type should be used with a mutable reference #970

Merged
merged 1 commit into from
Aug 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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