diff --git a/src/builtin/meta.rs b/src/builtin/meta.rs index 6e72e21..e2a3c0c 100644 --- a/src/builtin/meta.rs +++ b/src/builtin/meta.rs @@ -127,7 +127,7 @@ fn mixin_exists(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult Ok(Value::bool( - parser.scopes.last().mixin_exists(&s, parser.global_scope), + parser.scopes.last().mixin_exists(s, parser.global_scope), )), v => Err(( format!("$name: {} is not a string.", v.inspect(args.span())?), @@ -141,7 +141,7 @@ fn function_exists(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult Ok(Value::bool( - parser.scopes.last().fn_exists(&s, parser.global_scope), + parser.scopes.last().fn_exists(s, parser.global_scope), )), v => Err(( format!("$name: {} is not a string.", v.inspect(args.span())?), diff --git a/src/common.rs b/src/common.rs index 4f9ce1e..882793c 100644 --- a/src/common.rs +++ b/src/common.rs @@ -115,7 +115,11 @@ pub(crate) struct Identifier(String); impl From for Identifier { fn from(s: String) -> Identifier { - Identifier(s.replace('_', "-")) + if s.contains('_') { + Identifier(s.replace('_', "-")) + } else { + Identifier(s) + } } } diff --git a/src/parse/args.rs b/src/parse/args.rs index 0e7dbc8..f272ea7 100644 --- a/src/parse/args.rs +++ b/src/parse/args.rs @@ -176,7 +176,7 @@ impl<'a> Parser<'a> { if name.is_empty() { CallArg::Positional(args.len()) } else { - CallArg::Named(name.into()) + CallArg::Named(mem::take(&mut name).into()) }, self.parse_value_from_vec(val), ); @@ -261,7 +261,7 @@ impl<'a> Parser<'a> { if name.is_empty() { CallArg::Positional(args.len()) } else { - CallArg::Named(name.as_str().into()) + CallArg::Named(mem::take(&mut name).into()) }, self.parse_value_from_vec(mem::take(&mut val)), );