Skip to content

Commit

Permalink
fix new clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thegwan committed Apr 20, 2023
1 parent b63dd60 commit c6827ba
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn main() {
let pkg_config_path = dpdk_path.join("lib/x86_64-linux-gnu/pkgconfig");
let cflags_bytes = Command::new("pkg-config")
.env("PKG_CONFIG_PATH", &pkg_config_path)
.args(&["--cflags", "libdpdk"])
.args(["--cflags", "libdpdk"])
.output()
.unwrap_or_else(|e| panic!("Failed pkg-config cflags: {:?}", e))
.stdout;
Expand All @@ -37,7 +37,7 @@ fn main() {

let ldflags_bytes = Command::new("pkg-config")
.env("PKG_CONFIG_PATH", &pkg_config_path)
.args(&["--libs", "libdpdk"])
.args(["--libs", "libdpdk"])
.output()
.unwrap_or_else(|e| panic!("Failed pkg-config ldflags: {:?}", e))
.stdout;
Expand Down
2 changes: 1 addition & 1 deletion core/src/conntrack/timerwheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl TimerWheel {
conn.terminate(subscription);
occupied.remove();
} else {
let timer_index = (expire_time / period) as usize % nb_buckets;
let timer_index = (expire_time / period) % nb_buckets;
not_expired.push((timer_index, conn_id));
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/filter/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ lazy_static! {
let ssh = g.add_node(protocol!("ssh"));
let dns = g.add_node(protocol!("dns"));
// define valid outer layers for each protocol header
g.extend_with_edges(&[
g.extend_with_edges([
(ipv4, ethernet),
(ipv6, ethernet),
(tcp, ipv4), (tcp, ipv6),
Expand Down
6 changes: 3 additions & 3 deletions core/src/lcore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) struct SocketId(pub(crate) u32);
impl SocketId {
// For DPDK functions
pub(crate) fn raw(&self) -> u32 {
self.0 as u32
self.0
}
}

Expand All @@ -31,12 +31,12 @@ pub struct CoreId(pub u32);

impl CoreId {
pub(crate) fn socket_id(&self) -> SocketId {
unsafe { SocketId(dpdk::rte_lcore_to_socket_id(self.0) as u32) }
unsafe { SocketId(dpdk::rte_lcore_to_socket_id(self.0)) }
}

/// For DPDK functions
pub fn raw(&self) -> u32 {
self.0 as u32
self.0
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/port/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl PortId {

/// For DPDK functions
pub(crate) fn raw(&self) -> u16 {
self.0 as u16
self.0
}
}

Expand Down Expand Up @@ -418,7 +418,7 @@ pub(crate) struct RxQueueId(pub(crate) u16);
impl RxQueueId {
/// For DPDK functions
pub(crate) fn raw(&self) -> u16 {
self.0 as u16
self.0
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/protocols/stream/tls/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ impl Tls {
}

/// Parse a TLS record.
pub(crate) fn parse_record_level<'b>(
pub(crate) fn parse_record_level(
&mut self,
record: &TlsRawRecord<'b>,
record: &TlsRawRecord<'_>,
direction: bool,
) -> ParseResult {
let mut v: Vec<u8>;
Expand Down
2 changes: 1 addition & 1 deletion examples/ip_anon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct Args {
fn main() -> Result<()> {
env_logger::init();
let args = Args::parse();
let config = load_config(&args.config);
let config = load_config(args.config);

let key: [u8; 16] = "a sample enc key".as_bytes().try_into()?;
let callback = |frame: ConnectionFrame| {
Expand Down
2 changes: 1 addition & 1 deletion examples/video/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn main() -> Result<()> {
// not re-allocate.
let sessions = Mutex::new(LinkedHashMap::with_capacity(100_000_000));
let mut wtr = Writer::from_path(&args.outfile)?;
wtr.write_record(&[
wtr.write_record([
"client",
"parallel_flows",
"bytes_up",
Expand Down

0 comments on commit c6827ba

Please sign in to comment.