Skip to content

Commit

Permalink
style: cargo clippy --fix and fmt on Rust v1.84
Browse files Browse the repository at this point in the history
  • Loading branch information
morrisonlevi committed Jan 10, 2025
1 parent 9607a5f commit 81abc21
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions profiling/src/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use log::{debug, error, trace, warn};
use rand::rngs::ThreadRng;
use rand_distr::{Distribution, Poisson};
use std::cell::{RefCell, UnsafeCell};
use std::ptr;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::{Relaxed, SeqCst};
use std::{ffi, ptr};

static mut GC_MEM_CACHES_HANDLER: zend::InternalFunctionHandler = None;

Expand Down Expand Up @@ -318,7 +318,7 @@ pub fn alloc_prof_rshutdown() {
pub fn alloc_prof_startup() {
unsafe {
let handle = datadog_php_zif_handler::new(
ffi::CStr::from_bytes_with_nul_unchecked(b"gc_mem_caches\0"),
c"gc_mem_caches",
ptr::addr_of_mut!(GC_MEM_CACHES_HANDLER),
Some(alloc_prof_gc_mem_caches),
);
Expand Down
2 changes: 1 addition & 1 deletion profiling/src/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ impl<'a> From<&'a str> for ZaiStr<'a> {
}
}

impl<'a> Default for ZaiStr<'a> {
impl Default for ZaiStr<'_> {
fn default() -> Self {
Self::new()
}
Expand Down
5 changes: 2 additions & 3 deletions profiling/src/exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::REQUEST_LOCALS;
use log::{error, info};
use rand::rngs::ThreadRng;
use std::cell::RefCell;
use std::ffi::CStr;
use std::ptr;
use std::sync::atomic::AtomicU32;
use std::sync::atomic::Ordering;
Expand Down Expand Up @@ -136,8 +135,8 @@ pub fn exception_profiling_minit() {
zend::zend_throw_exception_hook = Some(exception_profiling_throw_exception_hook);

let method_handlers = [zend::datadog_php_zim_handler::new(
CStr::from_bytes_with_nul_unchecked(b"generator\0"),
CStr::from_bytes_with_nul_unchecked(b"throw\0"),
c"generator",
c"throw",
ptr::addr_of_mut!(GENERATOR_THROW_HANDLER),
Some(ddog_php_prof_generator_throw),
)];
Expand Down
2 changes: 1 addition & 1 deletion profiling/src/profiling/stack_walking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ mod detail {
string_set: &'a mut StringSet,
}

impl<'a> StringCache<'a> {
impl StringCache<'_> {
/// Makes a copy of the string in the cache slot. If there isn't a
/// string in the slot currently, then create one by calling the
/// provided function, store it in the string cache and cache slot,
Expand Down
4 changes: 2 additions & 2 deletions profiling/src/sapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Sapi {
// Safety: It's not null; the VM should do the rest.
let cstr = unsafe { CStr::from_ptr(*sapi_request_info.argv) };
let bytes = cstr.to_bytes();
return if !bytes.is_empty() {
if !bytes.is_empty() {
let osstr = OsStr::from_bytes(bytes);
Path::new(osstr)
.file_name()
Expand All @@ -82,7 +82,7 @@ impl Sapi {
})
} else {
None
};
}
} else {
None
}
Expand Down
10 changes: 5 additions & 5 deletions profiling/src/thin_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<'a> ThinStr<'a> {
}
}

impl<'a> Deref for ThinStr<'a> {
impl Deref for ThinStr<'_> {
type Target = str;

fn deref(&self) -> &Self::Target {
Expand All @@ -75,21 +75,21 @@ impl<'a> Deref for ThinStr<'a> {
}
}

impl<'a> hash::Hash for ThinStr<'a> {
impl hash::Hash for ThinStr<'_> {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.deref().hash(state)
}
}

impl<'a> PartialEq for ThinStr<'a> {
impl PartialEq for ThinStr<'_> {
fn eq(&self, other: &Self) -> bool {
self.deref().eq(other.deref())
}
}

impl<'a> Eq for ThinStr<'a> {}
impl Eq for ThinStr<'_> {}

impl<'a> Borrow<str> for ThinStr<'a> {
impl Borrow<str> for ThinStr<'_> {
fn borrow(&self) -> &str {
self.deref()
}
Expand Down

0 comments on commit 81abc21

Please sign in to comment.