Skip to content

style(prof): fix tons of clippy lints#3235

Merged
realFlowControl merged 3 commits intoflorian/zts-global-statefrom
levi/clippy-fixes
May 8, 2025
Merged

style(prof): fix tons of clippy lints#3235
realFlowControl merged 3 commits intoflorian/zts-global-statefrom
levi/clippy-fixes

Conversation

@morrisonlevi
Copy link
Copy Markdown
Collaborator

@morrisonlevi morrisonlevi commented May 6, 2025

Description

Many clippy lints have accumulated. This fixes all of the lints on PHP 8.3/8.4 and on Rust 1.78. It also fixes many lints from Rust 1.86 and nightly. Here are some of the things fixed:

  • Using Rust's CStr literal syntax c"" and converting some engine members from *const u8 to *const c_char.
  • Using core::ptr::eq for certain pointer comparisons.
  • Adjust use of mutable statics to use pointers, see Disallow references to static mut.

And some non-clippy items:

  • Converts /* style comments to //, which is by far more popular.
  • Converts Safety: comments to SAFETY:, which is mostly what we use everywhere else.
  • Updates some of the historical comments to be more accurate in the present.

There were historical reasons for not running clippy in CI. Over time think these have all been fixed, helped by advances in Rust. We should enable clippy soon for profiling. On the versions listed, the only lints on current nightly are unpredictable function pointer comparisons. I'm not sure what to do here, other than maybe allow them. But since this is nightly, it may not land in its current state anyway, so I'm not going to sweat it.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

Also improve documentation in some places.
@morrisonlevi morrisonlevi added the profiling Relates to the Continuous Profiler label May 6, 2025
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented May 7, 2025

Benchmarks [ profiler ]

Benchmark execution time: 2025-05-07 15:52:19

Comparing candidate commit bf02b95 in PR branch levi/clippy-fixes with baseline commit 50840e0 in branch florian/zts-global-state.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 29 metrics, 7 unstable metrics.

Comment on lines +464 to 467
// todo: this should be feature = "stack_walking_tests" but it seemed to
// cause a failure in CI to migrate it.
#[cfg(all(test, stack_walking_tests))]
mod tests {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example of the error (job):

  = note: /mnt/ramdisk/cargo/release/deps/datadog_php_profiling-a15e7ad77c649749.datadog_php_profiling.b94f957b4ddf90d7-cgu.0.rcgu.o: In function `{closure#0}':
          /home/circleci/datadog/profiling/src/profiling/stack_walking.rs:263: undefined reference to `zend_flf_functions'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

error: could not compile `datadog-php-profiling` (lib test) due to 1 previous error

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.28%. Comparing base (50840e0) to head (bf02b95).

Additional details and impacted files

Impacted file tree graph

@@                      Coverage Diff                       @@
##             florian/zts-global-state    #3235      +/-   ##
==============================================================
+ Coverage                       79.26%   79.28%   +0.01%     
  Complexity                       2948     2948              
==============================================================
  Files                             118      118              
  Lines                           11633    11633              
==============================================================
+ Hits                             9221     9223       +2     
+ Misses                           2412     2410       -2     
Flag Coverage Δ
tracer-php 79.28% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50840e0...bf02b95. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@morrisonlevi morrisonlevi marked this pull request as ready for review May 7, 2025 01:26
@morrisonlevi morrisonlevi requested review from a team as code owners May 7, 2025 01:26
Comment thread profiling/src/allocation/allocation_le83.rs Outdated
Co-authored-by: Florian Engelhardt <[email protected]>
@realFlowControl realFlowControl merged commit afe5209 into florian/zts-global-state May 8, 2025
827 of 829 checks passed
@realFlowControl realFlowControl deleted the levi/clippy-fixes branch May 8, 2025 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

profiling Relates to the Continuous Profiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants