Skip to content

Commit

Permalink
Fix clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
koendelaat committed Oct 11, 2024
1 parent 9a8b97d commit 094bacb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/generate_conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ fn extract_interfaces(
.expect("Unable to read nmconnection file");
let id = config.get("connection", "id");
let interface_name = config.get("connection", "interface-name");
if id.is_some() && interface_name.is_some() {
config_files_map
.entry(interface_name.unwrap().to_string())
.or_insert_with(|| Vec::new())
.push(id.unwrap().clone());
if let Some(interface_name_value) = interface_name {
if let Some(id_value) = id {
config_files_map
.entry(interface_name_value.to_string())
.or_default()
.push(id_value.clone());
}
}
}

Expand All @@ -120,7 +122,7 @@ fn extract_interfaces(
interface_type: i.iface_type().to_string(),
connection_ids: config_files_map
.get(i.name())
.map(Vec::clone)
.cloned()
.or_else(|| Some(Vec::new())),
})
.collect()
Expand Down

0 comments on commit 094bacb

Please sign in to comment.