summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2023-01-27 08:18:06 -0500
committerGitHub <noreply@github.com>2023-01-27 08:18:06 -0500
commitaf505336c2e95820c98fc8e32bce665d5a03c795 (patch)
tree97969dfed12c3baffd3b17b1eaf162c7ea725388
parent350809db42eb2577628e965faeb1ac25b360cabf (diff)
parentf913e53c2e3404c2aea8804391a349dca04bfe77 (diff)
downloadostree-af505336c2e95820c98fc8e32bce665d5a03c795.tar.gz
Merge pull request #2795 from cgwalters/fix-docsrs-build
bindings: Use default for uninitialized fields in checkout opts
-rw-r--r--rust-bindings/src/repo_checkout_at_options/mod.rs66
-rw-r--r--rust-bindings/tests/repo/checkout_at.rs2
-rw-r--r--rust-bindings/tests/repo/mod.rs4
-rw-r--r--rust-bindings/tests/tests.rs2
4 files changed, 37 insertions, 37 deletions
diff --git a/rust-bindings/src/repo_checkout_at_options/mod.rs b/rust-bindings/src/repo_checkout_at_options/mod.rs
index 099bd229..13223cc4 100644
--- a/rust-bindings/src/repo_checkout_at_options/mod.rs
+++ b/rust-bindings/src/repo_checkout_at_options/mod.rs
@@ -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,
}
@@ -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();
}
@@ -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;
@@ -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());
}
@@ -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(),
),
@@ -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!(
@@ -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),
diff --git a/rust-bindings/tests/repo/checkout_at.rs b/rust-bindings/tests/repo/checkout_at.rs
index 5c07b992..0c79b428 100644
--- a/rust-bindings/tests/repo/checkout_at.rs
+++ b/rust-bindings/tests/repo/checkout_at.rs
@@ -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;
diff --git a/rust-bindings/tests/repo/mod.rs b/rust-bindings/tests/repo/mod.rs
index 54ee7ac0..a8d2b9d0 100644
--- a/rust-bindings/tests/repo/mod.rs
+++ b/rust-bindings/tests/repo/mod.rs
@@ -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;
@@ -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();
diff --git a/rust-bindings/tests/tests.rs b/rust-bindings/tests/tests.rs
index 18076002..46e71d76 100644
--- a/rust-bindings/tests/tests.rs
+++ b/rust-bindings/tests/tests.rs
@@ -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;