diff --git a/jemalloc-ctl/src/error.rs b/jemalloc-ctl/src/error.rs index 14c56b7..6812ee8 100644 --- a/jemalloc-ctl/src/error.rs +++ b/jemalloc-ctl/src/error.rs @@ -40,7 +40,10 @@ impl fmt::Debug for Error { small; in this case as much data as possible are read \ despite the error." ), - libc::ENOENT => write!(f, "`name` or `mib` specifies an unknown/invalid value."), + libc::ENOENT => write!( + f, + "`name` or `mib` specifies an unknown/invalid value." + ), libc::EPERM => write!( f, "Attempt to read or write `void` value, or attempt to \ diff --git a/jemalloc-ctl/src/keys.rs b/jemalloc-ctl/src/keys.rs index b8bad78..12ca6f6 100644 --- a/jemalloc-ctl/src/keys.rs +++ b/jemalloc-ctl/src/keys.rs @@ -110,7 +110,9 @@ impl Name { | b"thread.prof.name" | b"prof.dump" => true, v if v.starts_with(b"arena.") && v.ends_with(b".dss") => true, - v if v.starts_with(b"stats.arenas.") && v.ends_with(b".dss") => true, + v if v.starts_with(b"stats.arenas.") && v.ends_with(b".dss") => { + true + } _ => false, } } @@ -321,7 +323,8 @@ impl Access<&'static str> for MibStr { fn update(&self, value: &'static str) -> Result<&'static str> { // this is safe because the only safe way to construct a `MibStr` is by // validating that the key refers to a byte-string value - let s = unsafe { raw::update_str_mib(self.0.as_ref(), value.as_bytes())? }; + let s = + unsafe { raw::update_str_mib(self.0.as_ref(), value.as_bytes())? }; Ok(str::from_utf8(s).unwrap()) } } @@ -431,10 +434,22 @@ mod tests { } pub trait MibArg: - Copy + Clone + PartialEq + Default + fmt::Debug + AsRef<[usize]> + AsMut<[usize]> + Copy + + Clone + + PartialEq + + Default + + fmt::Debug + + AsRef<[usize]> + + AsMut<[usize]> { } impl MibArg for T where - T: Copy + Clone + PartialEq + Default + fmt::Debug + AsRef<[usize]> + AsMut<[usize]> + T: Copy + + Clone + + PartialEq + + Default + + fmt::Debug + + AsRef<[usize]> + + AsMut<[usize]> { } diff --git a/jemalloc-ctl/src/lib.rs b/jemalloc-ctl/src/lib.rs index 4b3fb81..b0b9306 100644 --- a/jemalloc-ctl/src/lib.rs +++ b/jemalloc-ctl/src/lib.rs @@ -70,7 +70,7 @@ //! } //! } //! ``` -#![deny(missing_docs)] +#![deny(missing_docs, intra_doc_link_resolution_failure)] #![cfg_attr(not(feature = "use_std"), no_std)] #![cfg_attr(feature = "cargo-clippy", allow(clippy::stutter))] #![feature(coerce_unsized)] diff --git a/jemalloc-ctl/src/raw.rs b/jemalloc-ctl/src/raw.rs index e11bfd5..0e7dc3d 100644 --- a/jemalloc-ctl/src/raw.rs +++ b/jemalloc-ctl/src/raw.rs @@ -273,7 +273,10 @@ pub fn write_str_mib(mib: &[usize], value: &'static [u8]) -> Result<()> { /// If the pointer is valid but it does not point to a null-terminated string, /// looking for `\0` will read garbage and might end up reading out-of-bounds, /// which is undefined behavior. -pub unsafe fn update_str_mib(mib: &[usize], value: &'static [u8]) -> Result<&'static [u8]> { +pub unsafe fn update_str_mib( + mib: &[usize], + value: &'static [u8], +) -> Result<&'static [u8]> { let ptr: *const c_char = update_mib(mib, value.as_ptr() as *const c_char)?; ptr2str(ptr) } @@ -340,7 +343,10 @@ pub fn write_str(name: &[u8], value: &'static [u8]) -> Result<()> { /// If the pointer is valid but it does not point to a null-terminated string, /// looking for `\0` will read garbage and might end up reading out-of-bounds, /// which is undefined behavior. -pub unsafe fn update_str(name: &[u8], value: &'static [u8]) -> Result<&'static [u8]> { +pub unsafe fn update_str( + name: &[u8], + value: &'static [u8], +) -> Result<&'static [u8]> { let ptr: *const c_char = update(name, value.as_ptr() as *const c_char)?; ptr2str(ptr) } diff --git a/jemalloc-ctl/src/stats_print.rs b/jemalloc-ctl/src/stats_print.rs index 264ec58..f46b0f2 100644 --- a/jemalloc-ctl/src/stats_print.rs +++ b/jemalloc-ctl/src/stats_print.rs @@ -68,7 +68,9 @@ where } let buf = CStr::from_ptr(buf); - match panic::catch_unwind(AssertUnwindSafe(|| state.writer.write_all(buf.to_bytes()))) { + match panic::catch_unwind(AssertUnwindSafe(|| { + state.writer.write_all(buf.to_bytes()) + })) { Ok(Ok(_)) => {} Ok(Err(e)) => state.error = Err(e), Err(e) => state.panic = Err(e),