Skip to content

Commit

Permalink
Resolve warnings on macOS with apple-sandbox enabled
Browse files Browse the repository at this point in the history
`cargo check --target x86_64-apple-darwin --features apple-sandbox`

    warning: constant `KIO_RETURN_SUCCESS` is never used
       --> src/unix/apple/macos/ffi.rs:171:11
        |
    171 | pub const KIO_RETURN_SUCCESS: i32 = 0;
        |           ^^^^^^^^^^^^^^^^^^
        |
        = note: `#[warn(dead_code)]` on by default

    warning: function `IOServiceMatching` is never used
       --> src/unix/apple/macos/ffi.rs:133:12
        |
    133 |     pub fn IOServiceMatching(a: *const c_char) -> CFMutableDictionaryRef;
        |            ^^^^^^^^^^^^^^^^^

    warning: function `IORegistryEntryGetName` is never used
       --> src/unix/apple/macos/ffi.rs:159:12
        |
    159 |     pub fn IORegistryEntryGetName(entry: io_registry_entry_t, name: io_name_t) -> kern_return_t;
        |            ^^^^^^^^^^^^^^^^^^^^^^
  • Loading branch information
dtolnay committed Dec 7, 2024
1 parent 965c2fb commit 4931dff
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/unix/apple/macos/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,14 @@ extern "C" {
matching: CFMutableDictionaryRef,
existing: *mut io_iterator_t,
) -> kern_return_t;
#[cfg(any(
feature = "system",
all(
feature = "component",
any(target_arch = "x86", target_arch = "x86_64")
#[cfg(all(
not(feature = "apple-sandbox"),
any(
feature = "system",
all(
feature = "component",
any(target_arch = "x86", target_arch = "x86_64")
),
),
))]
pub fn IOServiceMatching(a: *const c_char) -> CFMutableDictionaryRef;
Expand Down Expand Up @@ -155,17 +158,20 @@ extern "C" {
options: u32,
bsdName: *const c_char,
) -> CFMutableDictionaryRef;
#[cfg(feature = "system")]
#[cfg(all(feature = "system", not(feature = "apple-sandbox")))]
pub fn IORegistryEntryGetName(entry: io_registry_entry_t, name: io_name_t) -> kern_return_t;
#[cfg(feature = "disk")]
pub fn IOObjectConformsTo(object: io_object_t, className: *const c_char) -> libc::boolean_t;
}

#[cfg(any(
feature = "system",
all(
feature = "component",
any(target_arch = "x86", target_arch = "x86_64")
#[cfg(all(
not(feature = "apple-sandbox"),
any(
feature = "system",
all(
feature = "component",
any(target_arch = "x86", target_arch = "x86_64")
),
),
))]
pub const KIO_RETURN_SUCCESS: i32 = 0;
Expand Down

0 comments on commit 4931dff

Please sign in to comment.