25 lines
609 B
Rust
25 lines
609 B
Rust
use crate::{ast, rules::NodeRule};
|
|
|
|
pub struct ManualInheritFrom;
|
|
|
|
impl NodeRule for ManualInheritFrom {
|
|
type Node = ast::Binding;
|
|
|
|
const ID: &'static str = "manual_inherit_from";
|
|
|
|
fn select(data: &ast::NodeData) -> Option<&Self::Node> {
|
|
let ast::NodeData::Binding(binding) = data;
|
|
|
|
Some(binding)
|
|
}
|
|
|
|
fn check(node: &Self::Node) -> Option<&'static str> {
|
|
match &node.value {
|
|
ast::Expr::Select(select) if node.key == select.attr => {
|
|
Some("Use `inherit` for this selected attribute")
|
|
}
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|