mirror of https://codeberg.org/topola/topola.git
refactor(specctra/mesadata): more idiomatic Option handling
This commit is contained in:
parent
5b7f4588a0
commit
3bd6a927b9
|
|
@ -119,8 +119,8 @@ impl SpecctraMesadata {
|
||||||
// workaround for differing syntax
|
// workaround for differing syntax
|
||||||
// collapse multiple rule entries into a single one
|
// collapse multiple rule entries into a single one
|
||||||
for rule in &pcb.structure.rules {
|
for rule in &pcb.structure.rules {
|
||||||
if rule.width.is_some() {
|
if let Some(width) = rule.width {
|
||||||
structure_rule.width = rule.width.unwrap()
|
structure_rule.width = width
|
||||||
}
|
}
|
||||||
structure_rule
|
structure_rule
|
||||||
.clearances
|
.clearances
|
||||||
|
|
@ -144,13 +144,10 @@ impl SpecctraMesadata {
|
||||||
/// it defaults to the general structure rule.
|
/// it defaults to the general structure rule.
|
||||||
///
|
///
|
||||||
pub fn get_rule(&self, net: usize) -> &SpecctraRule {
|
pub fn get_rule(&self, net: usize) -> &SpecctraRule {
|
||||||
if let Some(netclass) = self.net_netclass.get(&net) {
|
self.net_netclass
|
||||||
self.class_rules
|
.get(&net)
|
||||||
.get(netclass)
|
.and_then(|netclass| self.class_rules.get(netclass))
|
||||||
.unwrap_or(&self.structure_rule)
|
.unwrap_or(&self.structure_rule)
|
||||||
} else {
|
|
||||||
&self.structure_rule
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue