Skip to content

Commit 67fcacc

Browse files
authored
Merge pull request #988 from ehuss/fix-visibility
Fix visibility of StashSaveOptions and DiffPatchidOptions.
2 parents 2b2fb37 + 952ada3 commit 67fcacc

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub use crate::config::{Config, ConfigEntries, ConfigEntry};
9191
pub use crate::cred::{Cred, CredentialHelper};
9292
pub use crate::describe::{Describe, DescribeFormatOptions, DescribeOptions};
9393
pub use crate::diff::{Deltas, Diff, DiffDelta, DiffFile, DiffOptions};
94-
pub use crate::diff::{DiffBinary, DiffBinaryFile, DiffBinaryKind};
94+
pub use crate::diff::{DiffBinary, DiffBinaryFile, DiffBinaryKind, DiffPatchidOptions};
9595
pub use crate::diff::{DiffFindOptions, DiffHunk, DiffLine, DiffLineType, DiffStats};
9696
pub use crate::email::{Email, EmailCreateOptions};
9797
pub use crate::error::Error;
@@ -131,7 +131,7 @@ pub use crate::revert::RevertOptions;
131131
pub use crate::revspec::Revspec;
132132
pub use crate::revwalk::Revwalk;
133133
pub use crate::signature::Signature;
134-
pub use crate::stash::{StashApplyOptions, StashApplyProgressCb, StashCb};
134+
pub use crate::stash::{StashApplyOptions, StashApplyProgressCb, StashCb, StashSaveOptions};
135135
pub use crate::status::{StatusEntry, StatusIter, StatusOptions, StatusShow, Statuses};
136136
pub use crate::submodule::{Submodule, SubmoduleUpdateOptions};
137137
pub use crate::tag::Tag;

src/stash.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use libc::{c_char, c_int, c_void, size_t};
55
use std::ffi::{c_uint, CStr, CString};
66
use std::mem;
77

8-
#[allow(unused)]
98
/// Stash application options structure
109
pub struct StashSaveOptions<'a> {
1110
message: Option<CString>,
@@ -72,13 +71,14 @@ impl<'a> StashSaveOptions<'a> {
7271
///
7372
/// Return `true` to continue processing, or `false` to
7473
/// abort the stash application.
74+
// FIXME: This probably should have been pub(crate) since it is not used anywhere.
7575
pub type StashApplyProgressCb<'a> = dyn FnMut(StashApplyProgress) -> bool + 'a;
7676

7777
/// This is a callback function you can provide to iterate over all the
7878
/// stashed states that will be invoked per entry.
79+
// FIXME: This probably should have been pub(crate) since it is not used anywhere.
7980
pub type StashCb<'a> = dyn FnMut(usize, &str, &Oid) -> bool + 'a;
8081

81-
#[allow(unused)]
8282
/// Stash application options structure
8383
pub struct StashApplyOptions<'cb> {
8484
progress: Option<Box<StashApplyProgressCb<'cb>>>,
@@ -144,22 +144,20 @@ impl<'cb> StashApplyOptions<'cb> {
144144
}
145145
}
146146

147-
#[allow(unused)]
148-
pub struct StashCbData<'a> {
147+
pub(crate) struct StashCbData<'a> {
149148
pub callback: &'a mut StashCb<'a>,
150149
}
151150

152-
#[allow(unused)]
153-
pub extern "C" fn stash_cb(
151+
pub(crate) extern "C" fn stash_cb(
154152
index: size_t,
155153
message: *const c_char,
156154
stash_id: *const raw::git_oid,
157155
payload: *mut c_void,
158156
) -> c_int {
159157
panic::wrap(|| unsafe {
160-
let mut data = &mut *(payload as *mut StashCbData<'_>);
158+
let data = &mut *(payload as *mut StashCbData<'_>);
161159
let res = {
162-
let mut callback = &mut data.callback;
160+
let callback = &mut data.callback;
163161
callback(
164162
index,
165163
CStr::from_ptr(message).to_str().unwrap(),
@@ -191,15 +189,14 @@ fn convert_progress(progress: raw::git_stash_apply_progress_t) -> StashApplyProg
191189
}
192190
}
193191

194-
#[allow(unused)]
195192
extern "C" fn stash_apply_progress_cb(
196193
progress: raw::git_stash_apply_progress_t,
197194
payload: *mut c_void,
198195
) -> c_int {
199196
panic::wrap(|| unsafe {
200-
let mut options = &mut *(payload as *mut StashApplyOptions<'_>);
197+
let options = &mut *(payload as *mut StashApplyOptions<'_>);
201198
let res = {
202-
let mut callback = options.progress.as_mut().unwrap();
199+
let callback = options.progress.as_mut().unwrap();
203200
callback(convert_progress(progress))
204201
};
205202

0 commit comments

Comments
 (0)