Skip to content

Commit f371996

Browse files
EFanZhehuss
authored andcommitted
Mutable reference should be used with an FnMut type
1 parent 55fcfa1 commit f371996

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/revwalk.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<'repo> Revwalk<'repo> {
157157
/// the walk.
158158
pub fn with_hide_callback<'cb, C>(
159159
self,
160-
callback: &'cb C,
160+
callback: &'cb mut C,
161161
) -> Result<RevwalkWithHideCb<'repo, 'cb, C>, Error>
162162
where
163163
C: FnMut(Oid) -> bool,
@@ -170,7 +170,7 @@ impl<'repo> Revwalk<'repo> {
170170
raw::git_revwalk_add_hide_cb(
171171
r.revwalk.raw(),
172172
Some(revwalk_hide_cb::<C>),
173-
callback as *const _ as *mut c_void,
173+
callback as *mut _ as *mut c_void,
174174
);
175175
};
176176
Ok(r)
@@ -304,8 +304,8 @@ mod tests {
304304
walk.reset().unwrap();
305305
walk.push_head().unwrap();
306306

307-
let hide_cb = |oid| oid == target;
308-
let mut walk = walk.with_hide_callback(&hide_cb).unwrap();
307+
let mut hide_cb = |oid| oid == target;
308+
let mut walk = walk.with_hide_callback(&mut hide_cb).unwrap();
309309

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

0 commit comments

Comments
 (0)