From a97348d24e05a8dcea018bae00f85a8a42e6be0d Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Sun, 15 Mar 2026 02:38:50 -0700 Subject: [PATCH] net_util: Fix clippy errors related to use of String error: this argument is passed by value, but not consumed in the function body --> net_util/src/tap.rs:685:17 | 685 | ifname: String, | ^^^^^^ help: consider changing the type to: `&str` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value = note: requested on the command line with `-D clippy::needless-pass-by-value` Signed-off-by: Rob Bradford --- net_util/src/tap.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net_util/src/tap.rs b/net_util/src/tap.rs index 36f0e2ba3..1622add3a 100644 --- a/net_util/src/tap.rs +++ b/net_util/src/tap.rs @@ -663,7 +663,7 @@ mod unit_tests { } // Sends a test packet on the interface named "ifname". - fn pnet_send_packet(ifname: String) { + fn pnet_send_packet(ifname: &str) { let payload = DATA_STRING.as_bytes(); // eth hdr + ip hdr + udp hdr + payload len @@ -682,7 +682,7 @@ mod unit_tests { // interface, an object that can be used to send Ethernet frames, and a receiver of // Ethernet frames arriving at the specified interface. fn pnet_get_mac_tx_rx( - ifname: String, + ifname: &str, ) -> (MacAddr, Box, Box) { let interface_name_matches = |iface: &NetworkInterface| iface.name == ifname; @@ -778,7 +778,7 @@ mod unit_tests { tap.enable().unwrap(); // Send a packet to the interface. We expect to be able to receive it on the associated fd. - pnet_send_packet(tap.if_name_as_str().to_owned()); + pnet_send_packet(tap.if_name_as_str()); let mut buf = [0u8; 4096]; @@ -836,7 +836,7 @@ mod unit_tests { tap.set_ip_addr(ip_addr, Some(netmask)).unwrap(); tap.enable().unwrap(); - let (mac, _, mut rx) = pnet_get_mac_tx_rx(tap.if_name_as_str().to_owned()); + let (mac, _, mut rx) = pnet_get_mac_tx_rx(tap.if_name_as_str()); let payload = DATA_STRING.as_bytes();