drop redundant feature flags, as behavour is consistent between sass syntax types

This commit is contained in:
Yiffy Dev 2024-10-30 17:42:26 +05:00 • committed by spushk
commit 7bdb7158d1
Signed by: spushk
GPG key ID: 7797B761E105E8AA
2 changed files with 6 additions and 66 deletions

View file

@ -17,9 +17,3 @@ raffia = {version = "^0.9"}
regex = {version = "^1.11"}
[features]
sass = [
"sabry_intrnl/sass"
]
scss = [
"sabry_intrnl/scss"
]

View file

@ -74,18 +74,14 @@ impl ToString for ArbitraryStyleBlock {
#[derive(Clone, Copy)]
pub enum ArbitraryStyleSyntax {
#[cfg(feature = "scss")]
Scss,
#[cfg(feature = "sass")]
Sass,
}
impl From<ArbitraryStyleSyntax> for CompilerSyntax {
fn from(value: ArbitraryStyleSyntax) -> Self {
match value {
#[cfg(feature = "sass")]
ArbitraryStyleSyntax::Sass => Self::Sass,
#[cfg(feature = "scss")]
ArbitraryStyleSyntax::Scss => Self::Scss,
}
}
@ -94,9 +90,7 @@ impl From<ArbitraryStyleSyntax> for CompilerSyntax {
impl ToTokens for ArbitraryStyleSyntax {
fn to_tokens(&self, tokens: &mut TokenStream) {
match self {
#[cfg(feature = "sass")]
Self::Sass => tokens.append_all(quote! {"sass"}),
#[cfg(feature = "scss")]
Self::Scss => tokens.append_all(quote! {"scss"}),
}
}
@ -114,9 +108,7 @@ impl Parse for ArbitraryStyleSyntax {
let ident = input.parse::<Ident>()?;
match ident.to_string().as_str() {
#[cfg(feature = "sass")]
"sass" => Ok(Self::Sass),
#[cfg(feature = "scss")]
"scss" => Ok(Self::Scss),
_ => Err(syn::Error::new(
ident.span(),
@ -132,9 +124,7 @@ impl Parse for ArbitraryStyleSyntax {
impl Debug for ArbitraryStyleSyntax {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let name = match self {
#[cfg(feature = "sass")]
Self::Sass => "sass",
#[cfg(feature = "scss")]
Self::Scss => "scss",
};
write!(f, "{name}")
@ -142,23 +132,15 @@ impl Debug for ArbitraryStyleSyntax {
}
impl Default for ArbitraryStyleSyntax {
#[cfg(feature = "scss")]
fn default() -> Self {
Self::Scss
}
#[cfg(all(feature = "sass", not(feature = "scss")))]
fn default() -> Self {
Self::Sass
}
}
impl From<ArbitraryStyleSyntax> for raffia::Syntax {
fn from(value: ArbitraryStyleSyntax) -> Self {
match value {
#[cfg(feature = "sass")]
ArbitraryStyleSyntax::Sass => Self::Sass,
#[cfg(feature = "scss")]
ArbitraryStyleSyntax::Scss => Self::Scss,
}
}
@ -166,7 +148,6 @@ impl From<ArbitraryStyleSyntax> for raffia::Syntax {
#[cfg(test)]
mod test {
#[cfg(feature = "sass")]
#[test]
fn arbitrary_style_block_sass() {
use super::ArbitraryStyleBlock;
@ -183,7 +164,6 @@ mod test {
assert_eq!(code, block.code);
}
#[cfg(feature = "scss")]
#[test]
fn arbitrary_style_block_scss() {
use super::ArbitraryStyleBlock;