Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgerring committed Dec 15, 2024
1 parent 35034f4 commit f85c127
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/tracing-grpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn init_tracer() -> sdktrace::TracerProvider {

struct MetadataMap<'a>(&'a mut tonic::metadata::MetadataMap);

impl<'a> Injector for MetadataMap<'a> {
impl Injector for MetadataMap<'_> {
/// Set a key and value in the MetadataMap. Does nothing if the key or value are not valid inputs
fn set(&mut self, key: &str, value: String) {
if let Ok(key) = tonic::metadata::MetadataKey::from_bytes(key.as_bytes()) {
Expand Down
2 changes: 1 addition & 1 deletion examples/tracing-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub mod hello_world {

struct MetadataMap<'a>(&'a tonic::metadata::MetadataMap);

impl<'a> Extractor for MetadataMap<'a> {
impl Extractor for MetadataMap<'_> {
/// Get a value for a key from the MetadataMap. If the value can't be converted to &str, returns None
fn get(&self, key: &str) -> Option<&str> {
self.0.get(key).and_then(|metadata| metadata.to_str().ok())
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-appender-log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ mod any_value {
pub(crate) fn serialize(value: log::kv::Value) -> Option<AnyValue> {
struct ValueVisitor(Option<AnyValue>);

impl<'kvs> log::kv::VisitValue<'kvs> for ValueVisitor {
impl log::kv::VisitValue<'_> for ValueVisitor {
fn visit_any(&mut self, value: log::kv::Value) -> Result<(), log::kv::Error> {
self.0 = Some(AnyValue::String(StringValue::from(value.to_string())));

Expand Down
1 change: 0 additions & 1 deletion opentelemetry-otlp/tests/integration_test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use ctor::dtor;

pub mod images;
pub mod logs_asserter;
Expand Down
2 changes: 0 additions & 2 deletions opentelemetry-otlp/tests/integration_test/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use crate::images::Collector;
use ctor::dtor;
use std::fs;
use std::fs::File;
use std::os::unix::fs::PermissionsExt;
use std::sync::{Arc, Mutex, OnceLock};
Expand Down
3 changes: 1 addition & 2 deletions opentelemetry-otlp/tests/integration_test/tests/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use log::{info, Level};
use opentelemetry::KeyValue;
use opentelemetry_appender_log::OpenTelemetryLogBridge;
use opentelemetry_otlp::LogExporter;
use opentelemetry_sdk::logs::{LogError, LoggerProvider};
use opentelemetry_sdk::logs::LoggerProvider;
use opentelemetry_sdk::{logs as sdklogs, runtime, Resource};
use std::error::Error;
use std::fs::File;
use std::os::unix::fs::MetadataExt;
use std::time::Duration;
Expand Down
3 changes: 1 addition & 2 deletions opentelemetry-otlp/tests/integration_test/tests/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use ctor::dtor;
use integration_test_runner::test_utils;
use opentelemetry_proto::tonic::trace::v1::TracesData;
use opentelemetry_sdk::{runtime, trace as sdktrace, Resource};
use std::error::Error;
use std::fs::File;
use std::io::Write;
use std::os::unix::fs::MetadataExt;
Expand Down Expand Up @@ -98,7 +97,7 @@ pub fn assert_traces_results(result: &str, expected: &str) -> Result<()> {

#[test]
#[should_panic(expected = "left: \"Sub operation...\"")] // we swap the parent spans with child spans in failed_traces.json
pub fn test_assert_span_eq_failure() -> () {
pub fn test_assert_span_eq_failure() {
let left = read_spans_from_json(File::open("./expected/traces.json").unwrap()).unwrap();
let right = read_spans_from_json(File::open("./expected/failed_traces.json").unwrap()).unwrap();

Expand Down
6 changes: 3 additions & 3 deletions stress/src/throughput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ struct UnsafeSlice<'a> {
slice: &'a [UnsafeCell<WorkerStats>],
}

unsafe impl<'a> Send for UnsafeSlice<'a> {}
unsafe impl<'a> Sync for UnsafeSlice<'a> {}
unsafe impl Send for UnsafeSlice<'_> {}
unsafe impl Sync for UnsafeSlice<'_> {}

impl<'a> UnsafeSlice<'a> {
fn new(slice: &'a mut [WorkerStats]) -> Self {
Expand All @@ -155,7 +155,7 @@ impl<'a> UnsafeSlice<'a> {
#[inline(always)]
unsafe fn increment(&self, i: usize) {
let value = self.slice[i].get();
(*value).count = (*value).count + 1;
(*value).count += 1;
}

#[inline(always)]
Expand Down

0 comments on commit f85c127

Please sign in to comment.