Skip to content

Commit

Permalink
netdog: Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jpculp committed Nov 8, 2022
1 parent 4fc866d commit 962bf0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 2 additions & 8 deletions sources/api/netdog/src/interface_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ mod tests {
#[test]
fn invalid_interface_name() {
let bad_str = [
&std::iter::repeat("a").take(16).collect::<String>(),
&"a".repeat(16),
"",
".",
"..",
Expand All @@ -132,13 +132,7 @@ mod tests {

#[test]
fn valid_interface_name() {
let ok_str = [
&std::iter::repeat("a").take(15).collect::<String>(),
"eno1",
"eth0",
"enp5s0",
"enx0eb36944b633",
];
let ok_str = [&"a".repeat(15), "eno1", "eth0", "enp5s0", "enx0eb36944b633"];
for ok in ok_str {
assert!(InterfaceName::try_from(ok).is_ok())
}
Expand Down
5 changes: 3 additions & 2 deletions sources/api/netdog/src/wicked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ mod tests {
"eno8:dhcp4?,dhcp6?",
];
for ok_str in ok {
let net_config = NetConfigV1::from_str(&ok_str).unwrap();
let net_config = NetConfigV1::from_str(ok_str).unwrap();

let wicked_interfaces = net_config.as_wicked_interfaces();
for interface in wicked_interfaces {
Expand All @@ -166,13 +166,14 @@ mod tests {

// Test the end to end trip: "net config -> wicked -> serialized XML"
#[test]
#[allow(clippy::to_string_in_format_args)]
fn net_config_to_interface_config() {
let net_config_path = wicked_config().join("net_config.toml");

for version in NET_CONFIG_VERSIONS {
let temp_config = tempfile::NamedTempFile::new().unwrap();

render_config_template(&net_config_path, &temp_config, &version);
render_config_template(&net_config_path, &temp_config, version);
let net_config = net_config::from_path(&temp_config).unwrap().unwrap();
let wicked_interfaces = net_config.as_wicked_interfaces();
for interface in wicked_interfaces {
Expand Down

0 comments on commit 962bf0d

Please sign in to comment.