Skip to content

Commit

Permalink
Fix compiler and clippy warnings (#105)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Rieder <[email protected]>
  • Loading branch information
miried authored Oct 16, 2024
1 parent f260a80 commit 5787ab4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
6 changes: 6 additions & 0 deletions jemalloc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ is-it-maintained-issue-resolution = { repository = "tikv/jemallocator" }
is-it-maintained-open-issues = { repository = "tikv/jemallocator" }
maintenance = { status = "actively-developed" }

[lints.rust]
unexpected_cfgs = { level = "allow", check-cfg = [
'cfg(jemallocator_docs)',
'cfg(prefixed)',
] }

[dependencies]
libc = { version = "^0.2.8", default-features = false }

Expand Down
12 changes: 6 additions & 6 deletions jemalloc-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ extern "C" {
/// The behavior is _undefined_ if:
///
/// * `size` is not in range `[req_size, alloc_size]`, where `req_size` is
/// the size requested when performing the allocation, and `alloc_size` is
/// the allocation size returned by [`nallocx`], [`sallocx`], or
/// [`xallocx`],
/// the size requested when performing the allocation, and `alloc_size` is
/// the allocation size returned by [`nallocx`], [`sallocx`], or
/// [`xallocx`],
/// * `ptr` does not match a pointer earlier returned by the memory
/// allocation functions of this crate, or
/// * `ptr` is null, or
Expand Down Expand Up @@ -453,8 +453,8 @@ extern "C" {
/// Returns `0` on success, otherwise returns:
///
/// * `EINVAL`: if `newp` is not null, and `newlen` is too large or too
/// small. Alternatively, `*oldlenp` is too large or too small; in this case
/// as much data as possible are read despite the error.
/// small. Alternatively, `*oldlenp` is too large or too small; in this case
/// as much data as possible are read despite the error.
///
/// * `ENOENT`: `name` or mib specifies an unknown/invalid value.
///
Expand All @@ -463,7 +463,7 @@ extern "C" {
/// * `EAGAIN`: A memory allocation failure occurred.
///
/// * `EFAULT`: An interface with side effects failed in some way not
/// directly related to `mallctl` read/write processing.
/// directly related to `mallctl` read/write processing.
///
/// [jemalloc_mallctl]: http://jemalloc.net/jemalloc.3.html#mallctl_namespace
#[cfg_attr(prefixed, link_name = "_rjem_mallctl")]
Expand Down
8 changes: 1 addition & 7 deletions jemallocator/benches/roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@ use tikv_jemalloc_sys::MALLOCX_ALIGN;
static A: Jemalloc = Jemalloc;

// FIXME: replace with jemallocator::layout_to_flags
#[cfg(all(any(
target_arch = "arm",
target_arch = "mips",
target_arch = "mipsel",
target_arch = "powerpc"
)))]
#[cfg(all(any(target_arch = "arm", target_arch = "mips", target_arch = "powerpc")))]
const MIN_ALIGN: usize = 8;
#[cfg(all(any(
target_arch = "x86",
target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "powerpc64le",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "riscv64",
Expand Down
8 changes: 1 addition & 7 deletions jemallocator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,13 @@ use libc::{c_int, c_void};
// _Alignof(max_align_t), the malloc-APIs return memory whose alignment is
// either the requested size if its a power-of-two, or the next smaller
// power-of-two.
#[cfg(any(
target_arch = "arm",
target_arch = "mips",
target_arch = "mipsel",
target_arch = "powerpc"
))]
#[cfg(any(target_arch = "arm", target_arch = "mips", target_arch = "powerpc"))]
const ALIGNOF_MAX_ALIGN_T: usize = 8;
#[cfg(any(
target_arch = "x86",
target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "powerpc64le",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "riscv64",
Expand Down

0 comments on commit 5787ab4

Please sign in to comment.