Skip to content

Commit 5a77fb2

Browse files
gruebellalitbcijothomas
authored
chore: enable Rust 2024 edition lints (#2728)
Co-authored-by: Lalit Kumar Bhasin <[email protected]> Co-authored-by: Cijo Thomas <[email protected]>
1 parent 1ddecb0 commit 5a77fb2

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,12 @@ opentelemetry = { path = "opentelemetry" }
8585
opentelemetry_sdk = { path = "opentelemetry-sdk" }
8686
opentelemetry-stdout = { path = "opentelemetry-stdout" }
8787

88+
[workspace.lints.rust]
89+
rust_2024_compatibility = { level = "warn", priority = -1 }
90+
# No need to enable those, because it either not needed or results in ugly syntax
91+
edition_2024_expr_fragment_specifier = "allow"
92+
if_let_rescope = "allow"
93+
tail_expr_drop_order = "allow"
94+
8895
[workspace.lints.clippy]
8996
all = { level = "warn", priority = 1 }

opentelemetry-appender-tracing/src/layer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ mod tests {
245245
.any(|(k, v)| k == key && v == value)
246246
}
247247

248+
#[allow(impl_trait_overcaptures)] // can only be fixed with Rust 1.82+
248249
fn create_tracing_subscriber(
249250
_exporter: InMemoryLogExporter,
250251
logger_provider: &SdkLoggerProvider,

opentelemetry-sdk/src/trace/id_generator/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ pub struct RandomIdGenerator {
2222

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

2828
fn new_span_id(&self) -> SpanId {
29-
CURRENT_RNG.with(|rng| SpanId::from(rng.borrow_mut().gen::<u64>()))
29+
CURRENT_RNG.with(|rng| SpanId::from(rng.borrow_mut().random::<u64>()))
3030
}
3131
}
3232

stress/src/throughput.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'a> UnsafeSlice<'a> {
155155
#[inline(always)]
156156
unsafe fn increment(&self, i: usize) {
157157
let value = self.slice[i].get();
158-
(*value).count += 1;
158+
unsafe { (*value).count += 1 };
159159
}
160160

161161
#[inline(always)]

0 commit comments

Comments
 (0)