use crate::linter::{Diagnostic, LintContext, Rule};
pub struct ShortedNetsRule;
impl Rule for ShortedNetsRule {
fn name(&self) -> &'static str {
"shorted_nets"
}
fn check(&self, ctx: &LintContext<'_>) -> Vec<Diagnostic> {
ctx.netlist
.shorts()
.iter()
.map(|short| Diagnostic {
rule: self.name().to_string(),
message: format!(
"nets {} are shorted together through {}",
short.nets.join(", "),
short.trace
),
help: Some(
"remove the trace that joins them, or rename the nets if they are meant to be one"
.to_string(),
),
..Default::default()
})
.collect()
}
}