From 769b7628d8c14e1cad5d363dfad325baf158a66e Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 26 Apr 2020 23:52:32 -0400 Subject: [PATCH] refactor QualifiedName into common --- src/common.rs | 15 +++++++++++++++ src/selector/attribute.rs | 17 +---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/common.rs b/src/common.rs index 9a2ecc9..1421e45 100644 --- a/src/common.rs +++ b/src/common.rs @@ -104,3 +104,18 @@ impl ListSeparator { } } } + +#[derive(Clone, Debug, Eq, PartialEq)] +pub(crate) struct QualifiedName { + pub ident: String, + pub namespace: Option, +} + +impl Display for QualifiedName { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if let Some(namespace) = &self.namespace { + write!(f, "{}|", namespace)?; + } + f.write_str(&self.ident) + } +} diff --git a/src/selector/attribute.rs b/src/selector/attribute.rs index 47d5f1a..30f11a8 100644 --- a/src/selector/attribute.rs +++ b/src/selector/attribute.rs @@ -5,7 +5,7 @@ use peekmore::PeekMoreIterator; use codemap::Span; use super::{Selector, SelectorKind}; -use crate::common::QuoteKind; +use crate::common::{QualifiedName, QuoteKind}; use crate::error::SassResult; use crate::scope::Scope; use crate::utils::{devour_whitespace, eat_ident, is_ident, parse_quoted_string}; @@ -21,21 +21,6 @@ pub(crate) struct Attribute { span: Span, } -#[derive(Clone, Debug, Eq, PartialEq)] -struct QualifiedName { - pub ident: String, - pub namespace: Option, -} - -impl Display for QualifiedName { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some(namespace) = &self.namespace { - write!(f, "{}|", namespace)?; - } - f.write_str(&self.ident) - } -} - fn attribute_name>( toks: &mut PeekMoreIterator, scope: &Scope,