Skip to content

Commit 26a133a

Browse files
authored
Fix CI formatting check (#1260)
* ci: Actually run all tools "cargo check" and "cargo fmt" are currently not run in CI due to a bug in the matrix configuration. * ci: Fix cargo fmt $ cargo fmt --all -- --check --all-features Unrecognized option: 'all-features' * Run cargo fmt --all Now that we are actually checking it in CI, CI fails since the code is not formatted.
1 parent b7303af commit 26a133a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+117
-118
lines changed

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, macos-latest]
17+
tool: [check, fmt, clippy]
1718
include:
1819
- tool: check
1920
protobuf: true
@@ -24,7 +25,7 @@ jobs:
2425
protobuf: true
2526
fuse: true
2627
components: "rustfmt"
27-
command: cargo fmt --all -- --check --all-features
28+
command: cargo fmt --all -- --check
2829
- tool: clippy
2930
protobuf: true
3031
fuse: true

integration/ducks/src/main.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,28 @@ use anyhow::Context;
1717
use bytes::Bytes;
1818
use bytes::BytesMut;
1919
use http_body_util::Full;
20-
use http_body_util::{combinators::BoxBody, BodyExt};
21-
use hyper::{service::service_fn, Method, Request, StatusCode};
20+
use http_body_util::{BodyExt, combinators::BoxBody};
21+
use hyper::{Method, Request, StatusCode, service::service_fn};
2222
use hyper_util::rt::TokioExecutor;
2323
use hyper_util::rt::TokioIo;
2424
use hyper_util::server::conn::auto;
2525
use once_cell::sync::OnceCell;
2626
use shared::{
27+
DucksConfig,
2728
integration_api::{
28-
self,
29+
self, Empty, HttpMetrics, ListenInfo, LogMessage, Metrics, SocketMetrics, TestConfig,
2930
integration_target_server::{IntegrationTarget, IntegrationTargetServer},
30-
Empty, HttpMetrics, ListenInfo, LogMessage, Metrics, SocketMetrics, TestConfig,
3131
},
32-
DucksConfig,
3332
};
3433
use sketches_ddsketch::DDSketch;
3534
use std::{collections::HashMap, net::SocketAddr, pin::Pin, sync::Arc, time::Duration};
3635
use tokio::task::JoinSet;
3736
use tokio::{
3837
io::AsyncReadExt,
3938
net::{TcpListener, TcpStream, UdpSocket, UnixListener},
40-
sync::{mpsc, Mutex},
39+
sync::{Mutex, mpsc},
4140
};
42-
use tokio_stream::{wrappers::UnixListenerStream, Stream};
41+
use tokio_stream::{Stream, wrappers::UnixListenerStream};
4342
use tonic::Status;
4443
use tracing::error;
4544
use tracing::{debug, trace, warn};

integration/sheepdog/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ use std::{
2929
use anyhow::Context;
3030
use hyper_util::rt::TokioIo;
3131
use shared::{
32-
integration_api::{self, integration_target_client::IntegrationTargetClient},
3332
DucksConfig,
33+
integration_api::{self, integration_target_client::IntegrationTargetClient},
3434
};
3535
use tempfile::TempDir;
3636
use tokio::{net::UnixStream, process::Command};

lading/src/bin/captool.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use std::collections::{hash_map::RandomState, BTreeSet, HashMap};
1+
use std::collections::{BTreeSet, HashMap, hash_map::RandomState};
22
use std::ffi::OsStr;
33
use std::hash::BuildHasher;
44
use std::hash::Hasher;
55

66
use async_compression::tokio::bufread::ZstdDecoder;
7-
use average::{concatenate, Estimate, Max, Min, Variance};
7+
use average::{Estimate, Max, Min, Variance, concatenate};
88
use clap::Parser;
99
use futures::io;
1010
use lading_capture::json::{Line, MetricKind};
1111
use tokio::io::{AsyncBufReadExt, BufReader};
12-
use tokio_stream::wrappers::LinesStream;
1312
use tokio_stream::StreamExt;
13+
use tokio_stream::wrappers::LinesStream;
1414
use tracing::{error, info};
1515
use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt};
1616

lading/src/bin/lading.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ use lading::{
2020
use metrics::gauge;
2121
use metrics_exporter_prometheus::PrometheusBuilder;
2222
use once_cell::sync::Lazy;
23-
use rand::{rngs::StdRng, SeedableRng};
23+
use rand::{SeedableRng, rngs::StdRng};
2424
use regex::Regex;
2525
use rustc_hash::FxHashMap;
2626
use tokio::{
2727
runtime::Builder,
2828
signal,
2929
sync::broadcast,
30-
time::{self, sleep, Duration},
30+
time::{self, Duration, sleep},
3131
};
32-
use tracing::{debug, error, info, info_span, warn, Instrument};
33-
use tracing_subscriber::{util::SubscriberInitExt, EnvFilter};
32+
use tracing::{Instrument, debug, error, info, info_span, warn};
33+
use tracing_subscriber::{EnvFilter, util::SubscriberInitExt};
3434

3535
#[derive(thiserror::Error, Debug)]
3636
enum Error {

lading/src/bin/payloadtool.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{io, num::NonZeroU32};
55
use clap::Parser;
66
use lading::generator::http::Method;
77
use lading_payload::block;
8-
use rand::{rngs::StdRng, SeedableRng};
8+
use rand::{SeedableRng, rngs::StdRng};
99
use tracing::{debug, error, info, warn};
1010
use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt};
1111

@@ -64,7 +64,9 @@ fn generate_and_check(
6464
let total_generated_bytes_str = total_generated_bytes
6565
.get_appropriate_unit(false)
6666
.to_string();
67-
warn!("Generator failed to generate {total_requested_bytes_str}, instead only found {total_generated_bytes_str} of data")
67+
warn!(
68+
"Generator failed to generate {total_requested_bytes_str}, instead only found {total_generated_bytes_str} of data"
69+
)
6870
}
6971

7072
Ok(())

lading/src/blackhole/common.rs

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ where
4343
Error = hyper::Error,
4444
> + Send
4545
+ 'static,
46-
4746
S::Future: Send + 'static,
4847
{
4948
let listener = TcpListener::bind(addr).await.map_err(Error::Io)?;

lading/src/blackhole/http.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//!
88
99
use bytes::Bytes;
10-
use http::{header::InvalidHeaderValue, status::InvalidStatusCode, HeaderMap};
11-
use http_body_util::{combinators::BoxBody, BodyExt};
12-
use hyper::{header, Request, Response, StatusCode};
10+
use http::{HeaderMap, header::InvalidHeaderValue, status::InvalidStatusCode};
11+
use http_body_util::{BodyExt, combinators::BoxBody};
12+
use hyper::{Request, Response, StatusCode, header};
1313
use metrics::counter;
1414
use serde::{Deserialize, Serialize};
1515
use std::{net::SocketAddr, time::Duration};

lading/src/blackhole/splunk_hec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use std::{
1212
};
1313

1414
use bytes::Bytes;
15-
use http_body_util::{combinators::BoxBody, BodyExt};
16-
use hyper::{header, Method, Request, Response, StatusCode};
15+
use http_body_util::{BodyExt, combinators::BoxBody};
16+
use hyper::{Method, Request, Response, StatusCode, header};
1717
use metrics::counter;
1818
use rustc_hash::FxHashMap;
1919
use serde::{Deserialize, Serialize};

lading/src/codec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub(crate) fn decode(
6565
.body(crate::full(format!(
6666
"Unsupported encoding type: {encoding}"
6767
)))
68-
.expect("failed to build response"))
68+
.expect("failed to build response"));
6969
}
7070
}
7171
}

lading/src/generator.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ impl Server {
180180
Inner::UnixStream(conf) => {
181181
if let lading_payload::Config::DogStatsD(variant) = conf.variant {
182182
if !variant.length_prefix_framed {
183-
warn!("Dogstatsd stream requires length prefix framing. You likely want to add `length_prefix_framed: true` to your payload config.");
183+
warn!(
184+
"Dogstatsd stream requires length prefix framing. You likely want to add `length_prefix_framed: true` to your payload config."
185+
);
184186
}
185187
}
186188

lading/src/generator/file_gen/logrotate_fs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
use crate::generator;
88
use fuser::{
9-
spawn_mount2, BackgroundSession, FileAttr, Filesystem, MountOption, ReplyAttr, ReplyData,
10-
ReplyDirectory, ReplyEntry, Request,
9+
BackgroundSession, FileAttr, Filesystem, MountOption, ReplyAttr, ReplyData, ReplyDirectory,
10+
ReplyEntry, Request, spawn_mount2,
1111
};
1212
use lading_payload::block;
1313
use metrics::counter;
1414
use nix::libc::{self, ENOENT};
15-
use rand::{rngs::SmallRng, SeedableRng};
15+
use rand::{SeedableRng, rngs::SmallRng};
1616
use serde::{Deserialize, Serialize};
1717
use std::{
1818
collections::HashMap,

lading/src/generator/file_gen/traditional.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use std::{
1717
num::NonZeroU32,
1818
path::PathBuf,
1919
sync::{
20-
atomic::{AtomicU32, Ordering},
2120
Arc,
21+
atomic::{AtomicU32, Ordering},
2222
},
2323
thread,
2424
};
@@ -27,7 +27,7 @@ use byte_unit::{Byte, ByteError};
2727
use futures::future::join_all;
2828
use lading_throttle::Throttle;
2929
use metrics::{counter, gauge};
30-
use rand::{prelude::StdRng, SeedableRng};
30+
use rand::{SeedableRng, prelude::StdRng};
3131
use serde::{Deserialize, Serialize};
3232
use tokio::{
3333
fs,

lading/src/generator/grpc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ use std::{convert::TryFrom, num::NonZeroU32, thread, time::Duration};
1616

1717
use byte_unit::ByteError;
1818
use bytes::{Buf, BufMut, Bytes};
19-
use http::{uri::PathAndQuery, Uri};
19+
use http::{Uri, uri::PathAndQuery};
2020
use lading_throttle::Throttle;
2121
use metrics::{counter, gauge};
22-
use rand::rngs::StdRng;
2322
use rand::SeedableRng;
23+
use rand::rngs::StdRng;
2424
use serde::{Deserialize, Serialize};
2525
use tokio::sync::mpsc;
2626
use tonic::{
27-
codec::{DecodeBuf, Decoder, EncodeBuf, Encoder},
2827
Request, Response, Status,
28+
codec::{DecodeBuf, Decoder, EncodeBuf, Encoder},
2929
};
3030
use tracing::{debug, info};
3131

lading/src/generator/http.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
use std::{num::NonZeroU32, thread};
1515

1616
use byte_unit::ByteError;
17-
use hyper::{header::CONTENT_LENGTH, HeaderMap, Request, Uri};
17+
use hyper::{HeaderMap, Request, Uri, header::CONTENT_LENGTH};
1818
use hyper_util::{client::legacy::Client, rt::TokioExecutor};
1919
use lading_throttle::Throttle;
2020
use metrics::{counter, gauge};
2121
use once_cell::sync::OnceCell;
22-
use rand::{prelude::StdRng, SeedableRng};
22+
use rand::{SeedableRng, prelude::StdRng};
2323
use serde::{Deserialize, Serialize};
24-
use tokio::sync::{mpsc, Semaphore};
24+
use tokio::sync::{Semaphore, mpsc};
2525
use tracing::info;
2626

2727
use crate::common::PeekableReceiver;

lading/src/generator/passthru_file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use tokio::io::AsyncWriteExt;
1616
use byte_unit::ByteError;
1717
use lading_throttle::Throttle;
1818
use metrics::{counter, gauge};
19-
use rand::{rngs::StdRng, SeedableRng};
19+
use rand::{SeedableRng, rngs::StdRng};
2020
use serde::{Deserialize, Serialize};
2121
use tokio::sync::mpsc;
2222
use tracing::{info, warn};

lading/src/generator/process_tree.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@ fn try_wait_pid(pids: &mut FxHashSet<Pid>) {
483483
let mut exited: Option<Pid> = None;
484484

485485
for pid in pids.iter() {
486-
if let Ok(WaitStatus::StillAlive) = waitpid(*pid, Some(WaitPidFlag::WNOHANG)) {} else {
486+
if let Ok(WaitStatus::StillAlive) = waitpid(*pid, Some(WaitPidFlag::WNOHANG)) {
487+
} else {
487488
exited = Some(*pid);
488489
break;
489490
}

lading/src/generator/procfs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use std::str::FromStr;
1313
use std::{fs::File, io::Write, num::NonZeroU32, path::PathBuf};
1414

1515
use lading_payload::procfs;
16-
use rand::rngs::StdRng;
1716
use rand::SeedableRng;
17+
use rand::rngs::StdRng;
1818
use serde::{Deserialize, Serialize};
1919

2020
#[derive(::thiserror::Error, Debug)]

lading/src/generator/splunk_hec.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ use std::{future::ready, num::NonZeroU32, thread, time::Duration};
2121
use acknowledgements::Channels;
2222
use byte_unit::ByteError;
2323
use http::{
24-
header::{AUTHORIZATION, CONTENT_LENGTH},
2524
Method, Request, Uri,
25+
header::{AUTHORIZATION, CONTENT_LENGTH},
2626
};
2727
use http_body_util::BodyExt;
2828
use hyper::body::Body;
2929
use hyper_util::{
30-
client::legacy::{connect::HttpConnector, Client},
30+
client::legacy::{Client, connect::HttpConnector},
3131
rt::TokioExecutor,
3232
};
3333
use lading_throttle::Throttle;
3434
use metrics::{counter, gauge};
3535
use once_cell::sync::OnceCell;
36-
use rand::{prelude::StdRng, SeedableRng};
36+
use rand::{SeedableRng, prelude::StdRng};
3737
use serde::{Deserialize, Serialize};
3838
use tokio::{
39-
sync::{mpsc, Semaphore, SemaphorePermit},
39+
sync::{Semaphore, SemaphorePermit, mpsc},
4040
time::timeout,
4141
};
4242
use tracing::info;

lading/src/generator/tcp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::{
2020
use byte_unit::ByteError;
2121
use lading_throttle::Throttle;
2222
use metrics::{counter, gauge};
23-
use rand::{rngs::StdRng, SeedableRng};
23+
use rand::{SeedableRng, rngs::StdRng};
2424
use serde::{Deserialize, Serialize};
2525
use tokio::{io::AsyncWriteExt, net::TcpStream, sync::mpsc};
2626
use tracing::{info, trace};

lading/src/generator/udp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::{
2121
use byte_unit::{Byte, ByteError, ByteUnit};
2222
use lading_throttle::Throttle;
2323
use metrics::{counter, gauge};
24-
use rand::{rngs::StdRng, SeedableRng};
24+
use rand::{SeedableRng, rngs::StdRng};
2525
use serde::{Deserialize, Serialize};
2626
use tokio::{net::UdpSocket, sync::mpsc};
2727
use tracing::{debug, info, trace};

lading/src/generator/unix_datagram.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use futures::future::join_all;
1717
use lading_payload::block::{self, Block};
1818
use lading_throttle::Throttle;
1919
use metrics::{counter, gauge};
20-
use rand::{rngs::StdRng, SeedableRng};
20+
use rand::{SeedableRng, rngs::StdRng};
2121
use serde::{Deserialize, Serialize};
2222
use std::{num::NonZeroU32, path::PathBuf, thread};
2323
use tokio::{

lading/src/generator/unix_stream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use byte_unit::ByteError;
1616
use lading_payload::block::{self, Block};
1717
use lading_throttle::Throttle;
1818
use metrics::{counter, gauge};
19-
use rand::{rngs::StdRng, SeedableRng};
19+
use rand::{SeedableRng, rngs::StdRng};
2020
use serde::{Deserialize, Serialize};
2121
use std::{num::NonZeroU32, path::PathBuf, thread};
2222
use tokio::{net, sync::mpsc, task::JoinError};

lading/src/inspector.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::{
1616

1717
use nix::{
1818
errno::Errno,
19-
sys::signal::{kill, SIGTERM},
19+
sys::signal::{SIGTERM, kill},
2020
unistd::Pid,
2121
};
2222
use rustc_hash::FxHashMap;
@@ -25,7 +25,7 @@ use tokio::process::Command;
2525
use tracing::{error, info};
2626

2727
use crate::{
28-
common::{stdio, Output},
28+
common::{Output, stdio},
2929
target::TargetPidReceiver,
3030
};
3131

0 commit comments

Comments
 (0)