Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

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.

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