Skip to content

Commit 8ba2087

Browse files
author
Thea Rossman
committed
cargo fmt, clippy fixes
1 parent e558158 commit 8ba2087

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ members = [
44
"datatypes",
55
"examples/websites",
66
"examples/port_count",
7-
"examples/filter_stats",
7+
# Exclude from compilation; many subscriptions takes a long time to compile
8+
# "examples/filter_stats",
89
"examples/protocols",
910
]
1011
resolver = "2"

core/src/filter/actions.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/// Each filter stage returns a set of actions and a set of terminal actions.
1212
/// The terminal actions are the subset of actions that are maintained through
1313
/// the next filter stage.
14+
use std::fmt;
1415
use bitmask_enum::bitmask;
1516

1617
#[bitmask]
@@ -280,7 +281,6 @@ use proc_macro2::{Ident, Span};
280281
use quote::{quote, ToTokens};
281282
use std::str::FromStr;
282283

283-
#[allow(clippy::to_string_trait_impl)]
284284
impl FromStr for ActionData {
285285
type Err = core::fmt::Error;
286286
fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -301,23 +301,23 @@ impl FromStr for ActionData {
301301
}
302302
}
303303

304-
#[allow(clippy::to_string_trait_impl)]
305-
impl ToString for ActionData {
306-
fn to_string(&self) -> String {
307-
match *self {
308-
ActionData::PacketContinue => "PacketContinue".into(),
309-
ActionData::PacketDeliver => "PacketDeliver".into(),
310-
ActionData::ProtoProbe => "ProtoProbe".into(),
311-
ActionData::ProtoFilter => "ProtoFilter".into(),
312-
ActionData::SessionFilter => "SessionFilter".into(),
313-
ActionData::SessionDeliver => "SessionDeliver".into(),
314-
ActionData::SessionTrack => "SessionTrack".into(),
315-
ActionData::UpdatePDU => "UpdatePDU".into(),
316-
ActionData::ReassembledUpdatePDU => "ReassembledUpdatePDU".into(),
317-
ActionData::PacketTrack => "PacketTrack".into(),
318-
ActionData::ConnDeliver => "ConnDeliver".into(),
304+
impl fmt::Display for ActionData {
305+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
306+
let s = match *self {
307+
ActionData::PacketContinue => "PacketContinue",
308+
ActionData::PacketDeliver => "PacketDeliver",
309+
ActionData::ProtoProbe => "ProtoProbe",
310+
ActionData::ProtoFilter => "ProtoFilter",
311+
ActionData::SessionFilter => "SessionFilter",
312+
ActionData::SessionDeliver => "SessionDeliver",
313+
ActionData::SessionTrack => "SessionTrack",
314+
ActionData::UpdatePDU => "UpdatePDU",
315+
ActionData::ReassembledUpdatePDU => "ReassembledUpdatePDU",
316+
ActionData::PacketTrack => "PacketTrack",
317+
ActionData::ConnDeliver => "ConnDeliver",
319318
_ => panic!("Unknown ActionData"),
320-
}
319+
};
320+
write!(f, "{}", s)
321321
}
322322
}
323323

examples/protocols/src/main.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use retina_filtergen::{filter, retina_main};
2-
use retina_core::{CoreId, Runtime, FiveTuple};
31
use retina_core::config::load_config;
2+
use retina_core::{CoreId, FiveTuple, Runtime};
43
use retina_datatypes::*;
4+
use retina_filtergen::{filter, retina_main};
55

66
use std::fs::File;
77
use std::io::{BufRead, BufReader, BufWriter, Write};
@@ -163,7 +163,6 @@ fn combine_results(outfile: &PathBuf) {
163163
file.write_all(results.as_bytes()).unwrap();
164164
}
165165

166-
167166
#[retina_main(4)]
168167
fn main() {
169168
init();
@@ -186,4 +185,4 @@ fn main() {
186185
let mut runtime: Runtime<SubscribedWrapper> = Runtime::new(config, filter).unwrap();
187186
runtime.run();
188187
combine_results(&args.outfile);
189-
}
188+
}

0 commit comments

Comments
 (0)