Skip to content

Commit

Permalink
style: cargo clippy --fix and fmt on Rust v1.84 (#3032)
Browse files Browse the repository at this point in the history
* style: cargo clippy --fix and fmt on Rust v1.84

* ci: ping kong/hhtpbin

* fix windows version CRLF

---------

Signed-off-by: Bob Weinand <[email protected]>
Co-authored-by: Bob Weinand <[email protected]>
Co-authored-by: Florian Engelhardt <[email protected]>
  • Loading branch information
3 people authored Jan 13, 2025
1 parent a6ad4f5 commit c73b7f7
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ aliases:
- ES_JAVA_OPTS=-Xms1g -Xmx1g

- &IMAGE_DOCKER_HTTPBIN
image: kong/httpbin
image: kong/httpbin:0.2.2
name: httpbin_integration

- &IMAGE_DOCKER_KAFKA
Expand Down Expand Up @@ -548,7 +548,7 @@ commands:
-v $(pwd)/tests/snapshots:/snapshots \
--name test-agent ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:latest
retry_docker run --detach --rm --net net \
--name httpbin_integration kong/httpbin
--name httpbin_integration kong/httpbin:0.2.2
retry_docker run --detach --rm --net net \
-e DD_REQUEST_DUMPER_FILE=dump.json \
--name request-replayer datadog/dd-trace-ci:php-request-replayer-2.0
Expand Down
4 changes: 3 additions & 1 deletion config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ if (PHP_DDTRACE != 'no') {

var versionpath = configure_module_dirname + "/ext/version.h";
var versionfile = FSO.CreateTextFile(versionpath, true);
var versionContent = FSO.OpenTextFile(configure_module_dirname + "/VERSION", 1).ReadAll();
versionContent = versionContent.replace(/[\r\n]+$/, '');
versionfile.WriteLine("#ifndef PHP_DDTRACE_VERSION");
versionfile.WriteLine('#define PHP_DDTRACE_VERSION "' + FSO.OpenTextFile(configure_module_dirname + "/VERSION", 1).ReadAll() + '"');
versionfile.WriteLine('#define PHP_DDTRACE_VERSION "' + versionContent + '"');
versionfile.WriteLine("#endif");
versionfile.Close();

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ services:
image: "memcached:1.5-alpine"

httpbin_integration:
image: kong/httpbin
image: kong/httpbin:0.2.2
ports:
- "8765:80"

Expand Down
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
2 changes: 1 addition & 1 deletion tests/randomized/lib/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:

httpbin:
container_name: httpbin
image: kong/httpbin
image: kong/httpbin:0.2.2

memcached:
container_name: memcached
Expand Down

0 comments on commit c73b7f7

Please sign in to comment.