Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
- Added `clippy::expect_used = "deny"` to the workspace-level lint set,
mirroring the existing `clippy::unwrap_used` policy, and set
`allow-expect-in-tests = true` in `clippy.toml`. Production `.expect()`
calls are now denied in library crates while `#[cfg(test)]` code is
unaffected. Crates with pre-existing production `.expect()` sites
(`lading`, `lading_capture`, `lading_payload`, `lading_throttle`) carry
a transitional `#![allow(clippy::expect_used)]` quarantine at their
crate roots; this allow will be removed crate-by-crate as the sites are
cleaned up.
- Updated to rand 0.10.x
- `dogstatsd` generator now supports configurable pools for the `|c:` (container
ID), `|e:` (external data), and `|card:` (cardinality) origin detection
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ perf = "deny"
suspicious = "deny"
complexity = "deny"
unwrap_used = "deny"
expect_used = "deny"
mod_module_files = "deny"
dbg_macro = "deny"
print_stdout = "deny"
Expand Down
5 changes: 4 additions & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
doc-valid-idents = ["OpenTelemetry", "gRPC", ".."]

# Allow unwrap() and print!/println! in test code without per-module suppressions
# Allow unwrap()/expect() and print!/println! in test code without per-module
# suppressions. `allow-expect-in-tests` mirrors `allow-unwrap-in-tests`; the
# corresponding `clippy::expect_used` lint is set in the workspace Cargo.toml.
allow-unwrap-in-tests = true
allow-expect-in-tests = true
allow-print-in-tests = true

# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
Expand Down
3 changes: 3 additions & 0 deletions lading/src/bin/captool/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! Capture analysis tool for lading capture files.

#![expect(clippy::print_stdout)]
// Quarantine: workspace denies `clippy::expect_used`, but this binary still has
// production `.expect()` sites awaiting cleanup. Remove once cleaned up.
#![allow(clippy::expect_used)]

mod analyze;

Expand Down
4 changes: 4 additions & 0 deletions lading/src/bin/lading.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Main lading binary for load testing.

// Quarantine: workspace denies `clippy::expect_used`, but this binary still has
// production `.expect()` sites awaiting cleanup. Remove once cleaned up.
#![allow(clippy::expect_used)]

use std::{
env,
fmt::{self, Display},
Expand Down
3 changes: 3 additions & 0 deletions lading/src/bin/payloadtool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#![expect(clippy::print_stdout)]
#![expect(clippy::print_stderr)]
// Quarantine: workspace denies `clippy::expect_used`, but this binary still has
// production `.expect()` sites awaiting cleanup. Remove once cleaned up.
#![allow(clippy::expect_used)]

/// Memory allocation tracking for payloadtool statistics.
///
Expand Down
3 changes: 3 additions & 0 deletions lading/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#![deny(clippy::cargo)]
#![expect(clippy::cast_precision_loss)]
#![expect(clippy::multiple_crate_versions)]
// Quarantine: workspace denies `clippy::expect_used`, but this crate still has
// production `.expect()` sites awaiting cleanup. Remove once cleaned up.
#![allow(clippy::expect_used)]

use http_body_util::BodyExt;

Expand Down
3 changes: 3 additions & 0 deletions lading_capture/src/bin/fuzz_capture_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

#![expect(clippy::print_stderr)]
#![allow(clippy::cast_precision_loss)]
// Quarantine: workspace denies `clippy::expect_used`, but this binary still has
// production `.expect()` sites awaiting cleanup. Remove once cleaned up.
#![allow(clippy::expect_used)]

use anyhow::{Context, Result};
use arbitrary::Arbitrary;
Expand Down
4 changes: 4 additions & 0 deletions lading_capture/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Crate regarding Lading's 'capture' files

// Quarantine: workspace denies `clippy::expect_used`, but this crate still has
// production `.expect()` sites awaiting cleanup. Remove once cleaned up.
#![allow(clippy::expect_used)]

use std::time::Instant;

use manager::HISTORICAL_SENDER;
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/apache_common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for Apache Common log payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{Serialize, apache_common};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
//! Paired with SMP regression experiments in `experiments/regression/cases/http_ascii_*`.
//! If throughput sizes here change, update the corresponding SMP experiments and vice versa.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{Serialize, ascii};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/block.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for Block Cache operations.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::Config;
use lading_payload::block::Cache;
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/datadog_logs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for Datadog Logs payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{DatadogLog, Serialize};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/dogstatsd.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for `DogStatsD` payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{Serialize, dogstatsd};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/fluent.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for Fluent payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{Fluent, Serialize};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/json.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for JSON payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{Json, Serialize};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/opentelemetry_log.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for OpenTelemetry log payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{OpentelemetryLogs, Serialize, opentelemetry::log::Config};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/opentelemetry_metric.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for OpenTelemetry metric payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::common::config::ConfRange;
use lading_payload::{
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/opentelemetry_traces.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for OpenTelemetry trace payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::opentelemetry::trace::{
AttributeConfig, AttributeValueConfig, Config, DatabaseServiceConfig, GrpcServiceConfig,
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/splunk_hec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for Splunk HEC payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{Serialize, SplunkHec};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/syslog.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for Syslog 5424 payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{Serialize, Syslog5424};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/templated_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
//! which exercises every `ValueGenerator` tag so the numbers reflect realistic
//! template complexity.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use std::path::Path;
use std::time::Duration;

Expand Down
4 changes: 4 additions & 0 deletions lading_payload/benches/trace_agent.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Benchmarks for Datadog trace agent payload generation.

// `.expect()` is permitted in benches; workspace denies `clippy::expect_used`
// for production code.
#![allow(clippy::expect_used)]

use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use lading_payload::{Serialize, trace_agent::v04};
use rand::{SeedableRng, rngs::SmallRng};
Expand Down
3 changes: 3 additions & 0 deletions lading_payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#![deny(clippy::cargo)]
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::multiple_crate_versions)]
// Quarantine: workspace denies `clippy::expect_used`, but this crate still has
// production `.expect()` sites awaiting cleanup. Remove once cleaned up.
#![allow(clippy::expect_used)]

use std::{
io::{self, Write},
Expand Down
3 changes: 3 additions & 0 deletions lading_throttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#![deny(clippy::cargo)]
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::multiple_crate_versions)]
// Quarantine: workspace denies `clippy::expect_used`, but this crate still has
// production `.expect()` sites awaiting cleanup. Remove once cleaned up.
#![allow(clippy::expect_used)]

use async_trait::async_trait;
use serde::{Deserialize, Serialize};
Expand Down
Loading