refactor(xatu): rename selector expression
This commit is contained in:
@@ -45,11 +45,11 @@ pub struct Ident {
|
|||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum Expr {
|
pub enum Expr {
|
||||||
Ident(Ident),
|
Ident(Ident),
|
||||||
Selector(Selector),
|
Select(Select),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Selector {
|
pub struct Select {
|
||||||
pub receiver: String,
|
pub receiver: String,
|
||||||
pub attr: Ident,
|
pub attr: Ident,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ impl TryFrom<rnix::ast::Expr> for ast::Expr {
|
|||||||
fn try_from(expr: rnix::ast::Expr) -> Result<Self, Self::Error> {
|
fn try_from(expr: rnix::ast::Expr) -> Result<Self, Self::Error> {
|
||||||
match expr {
|
match expr {
|
||||||
rnix::ast::Expr::Ident(ident) => Ok(Self::Ident(ident.into())),
|
rnix::ast::Expr::Ident(ident) => Ok(Self::Ident(ident.into())),
|
||||||
rnix::ast::Expr::Select(select) => Ok(Self::Selector(select.try_into()?)),
|
rnix::ast::Expr::Select(select) => Ok(Self::Select(select.try_into()?)),
|
||||||
_ => Err(()),
|
_ => Err(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ impl From<rnix::ast::Ident> for ast::Ident {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<rnix::ast::Select> for ast::Selector {
|
impl TryFrom<rnix::ast::Select> for ast::Select {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(select: rnix::ast::Select) -> Result<Self, Self::Error> {
|
fn try_from(select: rnix::ast::Select) -> Result<Self, Self::Error> {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ impl NodeRule for ManualInheritFrom {
|
|||||||
|
|
||||||
fn check(node: &Self::Node) -> Option<&'static str> {
|
fn check(node: &Self::Node) -> Option<&'static str> {
|
||||||
match &node.value {
|
match &node.value {
|
||||||
ast::Expr::Selector(selector) if node.key == selector.attr => {
|
ast::Expr::Select(select) if node.key == select.attr => {
|
||||||
Some("Use `inherit` for this selected attribute")
|
Some("Use `inherit` for this selected attribute")
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|||||||
Reference in New Issue
Block a user