Skip to content

Commit

Permalink
Avoid redudant imports
Browse files Browse the repository at this point in the history
`cargo check` of nightly flags it, which is used for testing in
`libz-sys`.
  • Loading branch information
Byron committed Mar 14, 2024
1 parent 0a584f4 commit f5aa20f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ffi/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::os::raw::{c_int, c_uint, c_void};
use std::ptr;

use super::*;
use crate::mem::{self, FlushDecompress, Status};
use crate::mem;

#[derive(Default)]
pub struct ErrorMessage(Option<&'static str>);
Expand Down Expand Up @@ -127,6 +127,7 @@ extern "C" fn zfree(_ptr: *mut c_void, address: *mut c_void) {
}

unsafe impl<D: Direction> Send for Stream<D> {}

unsafe impl<D: Direction> Sync for Stream<D> {}

/// Trait used to call the right destroy/end function on the inner
Expand All @@ -137,6 +138,7 @@ pub trait Direction {

#[derive(Debug)]
pub enum DirCompress {}

#[derive(Debug)]
pub enum DirDecompress {}

Expand Down Expand Up @@ -176,6 +178,7 @@ impl Direction for DirCompress {
mz_deflateEnd(stream)
}
}

impl Direction for DirDecompress {
unsafe fn destroy(stream: *mut mz_stream) -> c_int {
mz_inflateEnd(stream)
Expand Down Expand Up @@ -410,6 +413,7 @@ mod c_backend {
pub use libz::Z_STREAM_END as MZ_STREAM_END;
pub use libz::Z_STREAM_ERROR as MZ_STREAM_ERROR;
pub use libz::Z_SYNC_FLUSH as MZ_SYNC_FLUSH;

pub type AllocSize = libz::uInt;

pub const MZ_DEFAULT_WINDOW_BITS: c_int = 15;
Expand Down Expand Up @@ -438,6 +442,7 @@ mod c_backend {
mem::size_of::<mz_stream>() as c_int,
)
}

pub unsafe extern "C" fn mz_inflateInit2(stream: *mut mz_stream, window_bits: c_int) -> c_int {
libz::inflateInit2_(
stream,
Expand Down

0 comments on commit f5aa20f

Please sign in to comment.