Skip to content

Commit

Permalink
Address clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed Jan 17, 2025
1 parent 82bf813 commit 00c6467
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
6 changes: 4 additions & 2 deletions common/src/tracer/otel_tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ where
for<'span> S: LookupSpan<'span>,
{
/// Initialises an OpenTelemetry service for the crate
/// #Arguments
///
/// ## Arguments
/// * `options` - The caller-specified options for the service
/// * `service_name` - The name of the OpenTelemetry service to assign to the crate.
/// * `module_name` - The name of the current module.
/// #Returns
///
/// ## Returns
/// If the tracer is set up correctly, an instance of OtelTracer containing the
/// `tracing_opentelemetry` layer which can be added to the subscriber.
/// If the operation fails, a TracerError is returned.
Expand Down
4 changes: 2 additions & 2 deletions common/src/tracer/propagator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use tracing_opentelemetry::OpenTelemetrySpanExt;

struct HeaderInjector<'a>(pub &'a mut OwnedHeaders);

impl<'a> Injector for HeaderInjector<'a> {
impl Injector for HeaderInjector<'_> {
fn set(&mut self, key: &str, value: String) {
let mut new = OwnedHeaders::new().insert(rdkafka::message::Header {
key,
Expand All @@ -29,7 +29,7 @@ impl<'a> Injector for HeaderInjector<'a> {

struct HeaderExtractor<'a>(pub &'a BorrowedHeaders);

impl<'a> Extractor for HeaderExtractor<'a> {
impl Extractor for HeaderExtractor<'_> {
fn get(&self, key: &str) -> Option<&str> {
for i in 0..self.0.count() {
if let Ok(val) = self.0.get_as::<str>(i) {
Expand Down
6 changes: 4 additions & 2 deletions common/src/tracer/tracer_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ pub struct TracerEngine {

impl TracerEngine {
/// Initialises the stdout tracer, and (if required) the OpenTelemetry service for the crate
/// #Arguments
///
/// ## Arguments
/// * `options` - The caller-specified instance of TracerOptions.
/// * `service_name` - The name of the OpenTelemetry service to assign to the crate.
/// * `module_name` - The name of the current module.
/// #Returns
///
/// ## Returns
/// An instance of TracerEngine
pub fn new(options: TracerOptions, service_name: &str, module_name: &str) -> Self {
let use_otel = options.otel_options.is_some();
Expand Down
2 changes: 1 addition & 1 deletion trace-archiver-tdengine/src/tdengine/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl TDEngine {

pub(crate) async fn create_database(&self) -> Result<(), TDEngineError> {
self.client
.exec(&format!(
.exec(format!(
"CREATE DATABASE IF NOT EXISTS {} PRECISION 'ns'",
self.database
))
Expand Down
1 change: 0 additions & 1 deletion trace-reader/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::{
io::{Error, ErrorKind, Read, Seek, SeekFrom},
mem::size_of,
path::PathBuf,
usize,
};

#[derive(Default, Debug)]
Expand Down
1 change: 1 addition & 0 deletions trace-reader/src/processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub(crate) fn create_channel<'a>(
/// * `digitizer_id` - The id of the digitizer to use.
/// * `measurements_per_frame` - The number of measurements to simulate in each channel.
/// * `num_channels` - The number of channels to simulate.
///
/// #Returns
/// A string result, or an error.
pub(crate) fn create_message(
Expand Down
17 changes: 8 additions & 9 deletions trace-to-events/src/pulse_detection/datatype/tracepoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ use super::{eventdata::Empty, EventData, Temporal, TraceValue};
/// An abstraction of the types that are processed by the various filters
/// To implement TracePoint a type must contain time data, a value,
/// and a parameter (which is used for applying feedback).
/// *Associated Types
/// - TimeType: the type which represents the time of the data point.
/// This should be trivially copyable (usually a scalar).
/// - ValueType: the type which contains the value of the data point.
/// * Methods
/// - get_time(): returns the time of the data point.
/// - get_value(): returns an immutable reference to the value of the data point.
/// - take_value(): destructs the data point and gives the caller ownership of the value.
/// - clone_value(): allows the user to take ownership of a clone of the value without
/// destructing the data point.
pub(crate) trait TracePoint: Clone {
/// The type which represents the time of the data point.
type TimeType: Temporal;

/// The type which contains the value of the data point.
type ValueType: TraceValue;

type DataType: EventData;

/// Returns the time of the data point.
fn get_time(&self) -> Self::TimeType;

/// Returns an immutable reference to the value of the data point.
fn get_value(&self) -> &Self::ValueType;

/// Take ownership of a clone of the value without destructing the data point.
fn clone_value(&self) -> Self::ValueType {
self.get_value().clone()
}
Expand Down

0 comments on commit 00c6467

Please sign in to comment.