Skip to content

Commit 6e4fabd

Browse files
committed
Fix cargo clippy
Signed-off-by: Gris Ge <[email protected]>
1 parent de62338 commit 6e4fabd

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

examples/create_macvlan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async fn main() -> Result<(), String> {
1616
}
1717
let link_name = &args[1];
1818
let mac: Option<Vec<u8>> = if args.len() == 3 {
19-
let mac_address_arg = (&args[2]).to_string();
19+
let mac_address_arg = args[2].to_string();
2020
let mac_address = MacAddr::from_str(mac_address_arg.as_str())
2121
.map_err(|e| format!("{e}"))?;
2222
Some(mac_address.as_bytes().into())

src/link/test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn create_get_delete_macvlan() {
3232
const MACVLAN_IFACE_NAME: &str = "mvlan1";
3333
const LOWER_DEVICE_IDX: u32 = 2;
3434
const MACVLAN_MODE: u32 = 4; // bridge
35-
let mac_address = &vec![2u8, 0, 0, 0, 0, 1];
35+
let mac_address = [2u8, 0, 0, 0, 0, 1];
3636

3737
let rt = Runtime::new().unwrap();
3838
let handle = rt.block_on(_create_macvlan(
@@ -49,7 +49,7 @@ fn create_get_delete_macvlan() {
4949
rt.block_on(_get_iface(&mut handle, MACVLAN_IFACE_NAME.to_owned()));
5050
assert!(msg.is_ok());
5151
assert!(has_nla(
52-
&msg.as_ref().unwrap(),
52+
msg.as_ref().unwrap(),
5353
&LinkAttribute::LinkInfo(vec![
5454
LinkInfo::Kind(InfoKind::MacVlan),
5555
LinkInfo::Data(InfoData::MacVlan(vec![
@@ -62,15 +62,15 @@ fn create_get_delete_macvlan() {
6262
])
6363
));
6464
assert!(has_nla(
65-
&msg.as_ref().unwrap(),
65+
msg.as_ref().unwrap(),
6666
&LinkAttribute::IfName(MACVLAN_IFACE_NAME.to_string())
6767
));
6868
assert!(has_nla(
69-
&msg.as_ref().unwrap(),
69+
msg.as_ref().unwrap(),
7070
&LinkAttribute::Link(LOWER_DEVICE_IDX)
7171
));
7272
assert!(has_nla(
73-
&msg.as_ref().unwrap(),
73+
msg.as_ref().unwrap(),
7474
&LinkAttribute::Address(mac_address.to_vec())
7575
));
7676

src/ns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use nix::{
1010
},
1111
unistd::{fork, ForkResult},
1212
};
13-
use std::{option::Option, os::fd::BorrowedFd, path::Path, process::exit};
13+
use std::{os::fd::BorrowedFd, path::Path, process::exit};
1414

1515
// if "only" smol or smol+tokio were enabled, we use smol because
1616
// it doesn't require an active tokio runtime - just to be sure.

src/traffic_control/add_qdisc.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ mod test {
8383

8484
use super::*;
8585
use crate::{new_connection, NetworkNamespace, NETNS_PATH, SELF_NS_PATH};
86-
use netlink_packet_route::{
87-
link::LinkMessage, tc::TcAttribute, AddressFamily,
88-
};
86+
use netlink_packet_route::{link::LinkMessage, AddressFamily};
8987

9088
const TEST_NS: &str = "netlink_test_qdisc_ns";
9189
const TEST_DUMMY: &str = "test_dummy";

0 commit comments

Comments
 (0)