refactor(specctra/mesadata): more idiomatic Option handling

This commit is contained in:
Alain Emilia Anna Zscheile 2024-12-02 23:26:05 +01:00 committed by mikolaj
parent 5b7f4588a0
commit 3bd6a927b9
1 changed files with 6 additions and 9 deletions

View File

@ -119,8 +119,8 @@ impl SpecctraMesadata {
// workaround for differing syntax
// collapse multiple rule entries into a single one
for rule in &pcb.structure.rules {
if rule.width.is_some() {
structure_rule.width = rule.width.unwrap()
if let Some(width) = rule.width {
structure_rule.width = width
}
structure_rule
.clearances
@ -144,13 +144,10 @@ impl SpecctraMesadata {
/// it defaults to the general structure rule.
///
pub fn get_rule(&self, net: usize) -> &SpecctraRule {
if let Some(netclass) = self.net_netclass.get(&net) {
self.class_rules
.get(netclass)
self.net_netclass
.get(&net)
.and_then(|netclass| self.class_rules.get(netclass))
.unwrap_or(&self.structure_rule)
} else {
&self.structure_rule
}
}
}