Skip to content

Commit 8d86c8d

Browse files
committed
style(profiling): remove needless borrows and redundant static lifetimes
1 parent 254aa1a commit 8d86c8d

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

profiling/src/allocation/allocation_ge84.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ unsafe fn alloc_prof_prev_alloc(len: size_t) -> *mut c_void {
327327
let alloc = tls_zend_mm_state_get!(prev_custom_mm_alloc).unwrap();
328328
#[cfg(php_debug)]
329329
{
330-
return alloc(len, ptr::null(), 0, ptr::null(), 0);
330+
alloc(len, ptr::null(), 0, ptr::null(), 0)
331331
}
332332
#[cfg(not(php_debug))]
333333
alloc(len)
@@ -407,7 +407,7 @@ unsafe fn alloc_prof_prev_free(ptr: *mut c_void) {
407407
let free = tls_zend_mm_state_get!(prev_custom_mm_free).unwrap();
408408
#[cfg(php_debug)]
409409
{
410-
return free(ptr, core::ptr::null(), 0, core::ptr::null(), 0);
410+
free(ptr, core::ptr::null(), 0, core::ptr::null(), 0)
411411
}
412412
#[cfg(not(php_debug))]
413413
free(ptr)
@@ -530,7 +530,7 @@ unsafe fn alloc_prof_prev_realloc(prev_ptr: *mut c_void, len: size_t) -> *mut c_
530530
let realloc = tls_zend_mm_state_get!(prev_custom_mm_realloc).unwrap();
531531
#[cfg(php_debug)]
532532
{
533-
return realloc(prev_ptr, len, ptr::null(), 0, ptr::null(), 0);
533+
realloc(prev_ptr, len, ptr::null(), 0, ptr::null(), 0)
534534
}
535535
#[cfg(not(php_debug))]
536536
realloc(prev_ptr, len)

profiling/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use uuid::Uuid;
5353
static PROFILER_NAME: &CStr = c"datadog-profiling";
5454

5555
// SAFETY: PROFILER_NAME is a valid utf8 string.
56-
static PROFILER_NAME_STR: &'static str = match PROFILER_NAME.to_str() {
56+
static PROFILER_NAME_STR: &str = match PROFILER_NAME.to_str() {
5757
Ok(s) => s,
5858
// Panic: we own this string and it should be UTF8 (see PROFILER_NAME above).
5959
Err(_) => panic!(""),
@@ -64,7 +64,7 @@ static PROFILER_NAME_STR: &'static str = match PROFILER_NAME.to_str() {
6464
static PROFILER_VERSION: &[u8] = concat!(env!("PROFILER_VERSION"), "\0").as_bytes();
6565

6666
// SAFETY: PROFILER_VERSION is a byte slice that satisfies the safety requirements.
67-
static PROFILER_VERSION_STR: &'static str = const {
67+
static PROFILER_VERSION_STR: &str = const {
6868
match unsafe { CStr::from_ptr(PROFILER_VERSION.as_ptr() as *const c_char).to_str() } {
6969
Ok(v) => v,
7070
// Panic: we own this string and it should be UTF8 (see PROFILER_VERSION above).

profiling/src/profiling/uploader.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,13 @@ impl Uploader {
107107
let index = Arc::unwrap_or_clone(message.index);
108108
let profile = message.profile;
109109

110-
let profiling_library_name: &str = &PROFILER_NAME_STR;
111-
let profiling_library_version: &str = &PROFILER_VERSION_STR;
112110
let agent_endpoint = &self.endpoint;
113111
let endpoint = Endpoint::try_from(agent_endpoint)?;
114112

115113
let tags = Arc::unwrap_or_clone(index.tags);
116114
let mut exporter = libdd_profiling::exporter::ProfileExporter::new(
117-
profiling_library_name,
118-
profiling_library_version,
115+
PROFILER_NAME_STR,
116+
PROFILER_VERSION_STR,
119117
"php",
120118
tags,
121119
endpoint,

0 commit comments

Comments
 (0)