Skip to content

Commit

Permalink
chore: enable Rust 2024 edition lints (#2728)
Browse files Browse the repository at this point in the history
Co-authored-by: Lalit Kumar Bhasin <[email protected]>
Co-authored-by: Cijo Thomas <[email protected]>
  • Loading branch information
3 people authored Mar 3, 2025
1 parent 1ddecb0 commit 5a77fb2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
edition_2024_expr_fragment_specifier = "allow"
if_let_rescope = "allow"
tail_expr_drop_order = "allow"

[workspace.lints.clippy]
all = { level = "warn", priority = 1 }
1 change: 1 addition & 0 deletions opentelemetry-appender-tracing/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ mod tests {
.any(|(k, v)| k == key && v == value)
}

#[allow(impl_trait_overcaptures)] // can only be fixed with Rust 1.82+
fn create_tracing_subscriber(
_exporter: InMemoryLogExporter,
logger_provider: &SdkLoggerProvider,
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/trace/id_generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ pub struct RandomIdGenerator {

impl IdGenerator for RandomIdGenerator {
fn new_trace_id(&self) -> TraceId {
CURRENT_RNG.with(|rng| TraceId::from(rng.borrow_mut().gen::<u128>()))
CURRENT_RNG.with(|rng| TraceId::from(rng.borrow_mut().random::<u128>()))
}

fn new_span_id(&self) -> SpanId {
CURRENT_RNG.with(|rng| SpanId::from(rng.borrow_mut().gen::<u64>()))
CURRENT_RNG.with(|rng| SpanId::from(rng.borrow_mut().random::<u64>()))
}
}

Expand Down
2 changes: 1 addition & 1 deletion stress/src/throughput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<'a> UnsafeSlice<'a> {
#[inline(always)]
unsafe fn increment(&self, i: usize) {
let value = self.slice[i].get();
(*value).count += 1;
unsafe { (*value).count += 1 };
}

#[inline(always)]
Expand Down

0 comments on commit 5a77fb2

Please sign in to comment.