Skip to content

Commit

Permalink
Merge pull request #2795 from cgwalters/fix-docsrs-build
Browse files Browse the repository at this point in the history
bindings: Use default for uninitialized fields in checkout opts
  • Loading branch information
cgwalters authored Jan 27, 2023
2 parents 350809d + f913e53 commit af50533
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
66 changes: 33 additions & 33 deletions rust-bindings/src/repo_checkout_at_options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ impl Default for RepoCheckoutAtOptions {
enable_fsync: false,
process_whiteouts: false,
no_copy_fallback: false,
#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
force_copy: false,
#[cfg(feature = "v2017_7")]
#[cfg(any(feature = "v2017_7", feature = "dox"))]
bareuseronly_dirs: false,
#[cfg(feature = "v2018_9")]
#[cfg(any(feature = "v2018_9", feature = "dox"))]
force_copy_zerosized: false,
#[cfg(feature = "v2022_6")]
#[cfg(any(feature = "v2022_6", feature = "dox"))]
process_passthrough_whiteouts: false,
subpath: None,
devino_to_csum_cache: None,
#[cfg(feature = "v2018_2")]
#[cfg(any(feature = "v2018_2", feature = "dox"))]
filter: None,
#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
sepolicy: None,
sepolicy_prefix: None,
}
Expand Down Expand Up @@ -114,22 +114,22 @@ impl<'a> ToGlibPtr<'a, *const ffi::OstreeRepoCheckoutAtOptions> for RepoCheckout
options.process_whiteouts = self.process_whiteouts.into_glib();
options.no_copy_fallback = self.no_copy_fallback.into_glib();

#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
{
options.force_copy = self.force_copy.into_glib();
}

#[cfg(feature = "v2017_7")]
#[cfg(any(feature = "v2017_7", feature = "dox"))]
{
options.bareuseronly_dirs = self.bareuseronly_dirs.into_glib();
}

#[cfg(feature = "v2018_9")]
#[cfg(any(feature = "v2018_9", feature = "dox"))]
{
options.force_copy_zerosized = self.force_copy_zerosized.into_glib();
}

#[cfg(feature = "v2022_6")]
#[cfg(any(feature = "v2022_6", feature = "dox"))]
{
options.process_passthrough_whiteouts = self.process_passthrough_whiteouts.into_glib();
}
Expand All @@ -143,16 +143,16 @@ impl<'a> ToGlibPtr<'a, *const ffi::OstreeRepoCheckoutAtOptions> for RepoCheckout
let devino_to_csum_cache = self.devino_to_csum_cache.to_glib_none();
options.devino_to_csum_cache = devino_to_csum_cache.0;

#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
let sepolicy = {
let sepolicy = self.sepolicy.to_glib_none();
options.sepolicy = sepolicy.0;
sepolicy
};
#[cfg(not(feature = "v2017_6"))]
#[cfg(not(any(feature = "v2017_6", feature = "dox")))]
let sepolicy = None.to_glib_none();

#[cfg(feature = "v2018_2")]
#[cfg(any(feature = "v2018_2", feature = "dox"))]
{
if let Some(filter) = &self.filter {
options.filter_user_data = filter.to_glib_none().0;
Expand Down Expand Up @@ -195,24 +195,24 @@ mod tests {
assert_eq!((*ptr).enable_fsync, GFALSE);
assert_eq!((*ptr).process_whiteouts, GFALSE);
assert_eq!((*ptr).no_copy_fallback, GFALSE);
#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
assert_eq!((*ptr).force_copy, GFALSE);
#[cfg(feature = "v2017_7")]
#[cfg(any(feature = "v2017_7", feature = "dox"))]
assert_eq!((*ptr).bareuseronly_dirs, GFALSE);
#[cfg(feature = "v2018_9")]
#[cfg(any(feature = "v2018_9", feature = "dox"))]
assert_eq!((*ptr).force_copy_zerosized, GFALSE);
#[cfg(feature = "v2022_6")]
#[cfg(any(feature = "v2022_6", feature = "dox"))]
assert_eq!((*ptr).process_passthrough_whiteouts, GFALSE);
assert_eq!((*ptr).unused_bools, [GFALSE; 3]);
assert_eq!((*ptr).subpath, ptr::null());
assert_eq!((*ptr).devino_to_csum_cache, ptr::null_mut());
assert_eq!((*ptr).unused_ints, [0; 6]);
assert_eq!((*ptr).unused_ptrs, [ptr::null_mut(); 3]);
#[cfg(feature = "v2018_2")]
#[cfg(any(feature = "v2018_2", feature = "dox"))]
assert_eq!((*ptr).filter, None);
#[cfg(feature = "v2018_2")]
#[cfg(any(feature = "v2018_2", feature = "dox"))]
assert_eq!((*ptr).filter_user_data, ptr::null_mut());
#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
assert_eq!((*ptr).sepolicy, ptr::null_mut());
assert_eq!((*ptr).sepolicy_prefix, ptr::null());
}
Expand All @@ -227,21 +227,21 @@ mod tests {
enable_fsync: true,
process_whiteouts: true,
no_copy_fallback: true,
#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
force_copy: true,
#[cfg(feature = "v2017_7")]
#[cfg(any(feature = "v2017_7", feature = "dox"))]
bareuseronly_dirs: true,
#[cfg(feature = "v2018_9")]
#[cfg(any(feature = "v2018_9", feature = "dox"))]
force_copy_zerosized: true,
#[cfg(feature = "v2022_6")]
#[cfg(any(feature = "v2022_6", feature = "dox"))]
process_passthrough_whiteouts: true,
subpath: Some("sub/path".into()),
devino_to_csum_cache: Some(RepoDevInoCache::new()),
#[cfg(feature = "v2018_2")]
#[cfg(any(feature = "v2018_2", feature = "dox"))]
filter: RepoCheckoutFilter::new(|_repo, _path, _stat| {
crate::RepoCheckoutFilterResult::Skip
}),
#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
sepolicy: Some(
SePolicy::new(&gio::File::for_path("a/b"), gio::Cancellable::NONE).unwrap(),
),
Expand All @@ -259,13 +259,13 @@ mod tests {
assert_eq!((*ptr).enable_fsync, GTRUE);
assert_eq!((*ptr).process_whiteouts, GTRUE);
assert_eq!((*ptr).no_copy_fallback, GTRUE);
#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
assert_eq!((*ptr).force_copy, GTRUE);
#[cfg(feature = "v2017_7")]
#[cfg(any(feature = "v2017_7", feature = "dox"))]
assert_eq!((*ptr).bareuseronly_dirs, GTRUE);
#[cfg(feature = "v2018_9")]
#[cfg(any(feature = "v2018_9", feature = "dox"))]
assert_eq!((*ptr).force_copy_zerosized, GTRUE);
#[cfg(feature = "v2022_6")]
#[cfg(any(feature = "v2022_6", feature = "dox"))]
assert_eq!((*ptr).process_passthrough_whiteouts, GTRUE);
assert_eq!((*ptr).unused_bools, [GFALSE; 3]);
assert_eq!(
Expand All @@ -278,14 +278,14 @@ mod tests {
);
assert_eq!((*ptr).unused_ints, [0; 6]);
assert_eq!((*ptr).unused_ptrs, [ptr::null_mut(); 3]);
#[cfg(feature = "v2018_2")]
#[cfg(any(feature = "v2018_2", feature = "dox"))]
assert!((*ptr).filter == Some(repo_checkout_filter::filter_trampoline_unwindsafe));
#[cfg(feature = "v2018_2")]
#[cfg(any(feature = "v2018_2", feature = "dox"))]
assert_eq!(
(*ptr).filter_user_data,
options.filter.as_ref().unwrap().to_glib_none().0,
);
#[cfg(feature = "v2017_6")]
#[cfg(any(feature = "v2017_6", feature = "dox"))]
assert_eq!((*ptr).sepolicy, options.sepolicy.to_glib_none().0);
assert_eq!(
CStr::from_ptr((*ptr).sepolicy_prefix),
Expand Down
2 changes: 1 addition & 1 deletion rust-bindings/tests/repo/checkout_at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn should_checkout_at_with_options() {
}

#[test]
#[cfg(feature = "v2018_2")]
#[cfg(any(feature = "v2018_2", feature = "dox"))]
fn should_checkout_at_with_filter() {
use std::path::Path;

Expand Down
4 changes: 2 additions & 2 deletions rust-bindings/tests/repo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::util::*;
use ostree::prelude::*;
use ostree::{ObjectName, ObjectType};

#[cfg(feature = "v2016_8")]
#[cfg(any(feature = "v2016_8", feature = "dox"))]
mod checkout_at;
mod generate_static;

Expand Down Expand Up @@ -178,7 +178,7 @@ fn should_write_content_to_repo() {
}

#[test]
#[cfg(feature = "v2016_4")]
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn repo_file() {
use std::os::unix::fs::MetadataExt;
let test_repo = TestRepo::new();
Expand Down
2 changes: 1 addition & 1 deletion rust-bindings/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod core;
mod functions;
mod repo;
#[cfg(feature = "v2020_2")]
#[cfg(any(feature = "v2020_2", feature = "dox"))]
mod sign;
mod util;

0 comments on commit af50533

Please sign in to comment.