Skip to content

chore: fix cargo clippy issues with new versions of rust #13916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025

Conversation

brettlangdon
Copy link
Member

@brettlangdon brettlangdon commented Jul 8, 2025

With #13902 we are getting a newer version of rust and cargo clippy is reporting this error:

error: variables can be used directly in the `format!` string
  --> library_config.rs:56:31
   |
56 |                 let err_msg = format!("Failed to get configuration: {:?}", e);
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
   = note: `-D clippy::uninlined-format-args` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
   |
56 -                 let err_msg = format!("Failed to get configuration: {:?}", e);
56 +                 let err_msg = format!("Failed to get configuration: {e:?}");
   |
error: variables can be used directly in the `format!` string
   --> library_config.rs:119:27
    |
119 |             let err_msg = format!("Failed to store the tracer configuration: {:?}", e);
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
119 -             let err_msg = format!("Failed to store the tracer configuration: {:?}", e);
119 +             let err_msg = format!("Failed to store the tracer configuration: {e:?}");
    |
error: could not compile `ddtrace-native` (lib) due to 2 previous errors

This change fixes this.

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@brettlangdon brettlangdon requested a review from a team as a code owner July 8, 2025 17:40
@brettlangdon brettlangdon requested a review from juanjux July 8, 2025 17:40
@brettlangdon brettlangdon added the changelog/no-changelog A changelog entry is not required for this PR. label Jul 8, 2025
@brettlangdon brettlangdon enabled auto-merge (squash) July 8, 2025 17:41
Copy link
Contributor

github-actions bot commented Jul 8, 2025

CODEOWNERS have been resolved as:

src/native/library_config.rs                                            @DataDog/apm-core-python

Copy link
Contributor

github-actions bot commented Jul 8, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 279 ± 4 ms.

The average import time from base is: 280 ± 3 ms.

The import time difference between this PR and base is: -1.5 ± 0.1 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 1.938 ms (0.70%)
ddtrace.bootstrap.sitecustomize 1.261 ms (0.45%)
ddtrace.bootstrap.preload 1.261 ms (0.45%)
ddtrace.internal.remoteconfig.client 0.649 ms (0.23%)
ddtrace 0.677 ms (0.24%)
ddtrace.internal._unpatched 0.030 ms (0.01%)
json 0.030 ms (0.01%)
json.decoder 0.030 ms (0.01%)
re 0.030 ms (0.01%)
enum 0.030 ms (0.01%)
types 0.030 ms (0.01%)

@pr-commenter
Copy link

pr-commenter bot commented Jul 8, 2025

Benchmarks

Benchmark execution time: 2025-07-09 14:19:01

Comparing candidate commit 1ed8e4f in PR branch brettlangdon/fix.clippy with baseline commit 573a530 in branch main.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 527 metrics, 2 unstable metrics.

scenario:iastaspects-replace_aspect

  • 🟥 execution_time [+570.897ns; +695.172ns] or [+11.967%; +14.572%]

@brettlangdon brettlangdon merged commit 08a88b6 into main Jul 9, 2025
847 of 848 checks passed
@brettlangdon brettlangdon deleted the brettlangdon/fix.clippy branch July 9, 2025 15:51
brettlangdon added a commit that referenced this pull request Jul 10, 2025
This means we no longer need to manually install riot.

We already updated `docker-compose.yml` and `scripts/ddtest` in #13899

Depends on #13916

## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [ ] Reviewer has checked that all the criteria below are met 
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog A changelog entry is not required for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants