Skip to content
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

chore: enable Rust 2024 edition lints #2728

Merged
merged 3 commits into from
Mar 3, 2025

Conversation

gruebel
Copy link
Member

@gruebel gruebel commented Feb 27, 2025

Changes

  • I believe there is no need to enable the 3 lints, I tested out the code and it worked well with edition 2024

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@gruebel gruebel requested a review from a team as a code owner February 27, 2025 21:38
Copy link

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.4%. Comparing base (1ddecb0) to head (5a89cad).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2728   +/-   ##
=====================================
  Coverage   79.4%   79.4%           
=====================================
  Files        123     123           
  Lines      22781   22781           
=====================================
  Hits       18106   18106           
  Misses      4675    4675           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@scottgerring scottgerring left a comment

Choose a reason for hiding this comment

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

Cool! I reckon we should deal with the lints at the same time, but other than that I think this is a great idea.

@@ -85,5 +85,12 @@ opentelemetry = { path = "opentelemetry" }
opentelemetry_sdk = { path = "opentelemetry-sdk" }
opentelemetry-stdout = { path = "opentelemetry-stdout" }

[workspace.lints.rust]
rust_2024_compatibility = { level = "warn", priority = -1 }
# No need to enable those, because it either not needed or results in ugly syntax
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO idiomatic rust syntax is what the default rustc lint set enforces; I think we should have strong reasons to opt out of these, and it would be nice to make the linter happy at the same time as we turn on the linting support.

Appreciate though that this will add a bunch of noise to the PR beyond the core 'turn on 2024 linting' flag. @cijothomas what do you think?

if_let_rescope - cargo clippy --fix seems to clean up most of these.

tail_expr_drop_order - this one can't be autofixed, but seems fairly straightforward:

However, the most probable fix is to hoist Droppy into its own local variable binding.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM. I think it would be good to create a separate issue to track fixing these lint's.

@cijothomas cijothomas merged commit 5a77fb2 into open-telemetry:main Mar 3, 2025
23 checks passed
@gruebel gruebel deleted the rust-2024 branch March 5, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants