remove workaround for compiler regression

This commit is contained in:
ConnorSkees 2020-04-21 18:28:46 -04:00
parent 5480937b4d
commit 25e6151aa9
2 changed files with 5 additions and 40 deletions

View File

@ -10,9 +10,8 @@ use crate::value::{Number, Value};
macro_rules! opt_rgba {
($args:ident, $name:ident, $arg:literal, $low:literal, $high:literal, $scope:ident, $super_selector:ident) => {
let x = $low;
let $name = match named_arg!($args, $scope, $super_selector, $arg = Value::Null) {
Value::Dimension(n, u) => Some(bound!($args, $arg, n, u, x, $high)),
Value::Dimension(n, u) => Some(bound!($args, $arg, n, u, $low, $high)),
Value::Null => None,
v => {
return Err((
@ -31,9 +30,10 @@ macro_rules! opt_rgba {
macro_rules! opt_hsl {
($args:ident, $name:ident, $arg:literal, $low:literal, $high:literal, $scope:ident, $super_selector:ident) => {
let x = $low;
let $name = match named_arg!($args, $scope, $super_selector, $arg = Value::Null) {
Value::Dimension(n, u) => Some(bound!($args, $arg, n, u, x, $high) / Number::from(100)),
Value::Dimension(n, u) => {
Some(bound!($args, $arg, n, u, $low, $high) / Number::from(100))
}
Value::Null => None,
v => {
return Err((
@ -188,10 +188,9 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
macro_rules! opt_scale_arg {
($args:ident, $name:ident, $arg:literal, $low:literal, $high:literal, $scope:ident, $super_selector:ident) => {
let x = $low;
let $name = match named_arg!($args, $scope, $super_selector, $arg = Value::Null) {
Value::Dimension(n, Unit::Percent) => {
Some(bound!($args, $arg, n, Unit::Percent, x, $high) / Number::from(100))
Some(bound!($args, $arg, n, Unit::Percent, $low, $high) / Number::from(100))
}
v @ Value::Dimension(..) => {
return Err(

View File

@ -70,23 +70,6 @@ macro_rules! bound {
$arg
}
};
// HACK: we accept `$low` as an ident here in order to work around
// a bug in the nightly compiler.
// https://github.com/rust-lang/rust/issues/70050
($args:ident, $name:literal, $arg:ident, $unit:ident, $low:ident, $high:literal) => {
if $arg > Number::from($high) || $arg < Number::from($low) {
return Err((
format!(
"${}: Expected {}{} to be within {}{} and {}{}.",
$name, $arg, $unit, $low, $unit, $high, $unit,
),
$args.span(),
)
.into());
} else {
$arg
}
};
($args:ident, $name:literal, $arg:ident, $unit:path, $low:literal, $high:literal) => {
if $arg > Number::from($high) || $arg < Number::from($low) {
return Err((
@ -101,21 +84,4 @@ macro_rules! bound {
$arg
}
};
// HACK: we accept `$low` as an ident here in order to work around
// a bug in the nightly compiler.
// https://github.com/rust-lang/rust/issues/70050
($args:ident, $name:literal, $arg:ident, $unit:path, $low:ident, $high:literal) => {
if $arg > Number::from($high) || $arg < Number::from($low) {
return Err((
format!(
"${}: Expected {}{} to be within {}{} and {}{}.",
$name, $arg, $unit, $low, $unit, $high, $unit,
),
$args.span(),
)
.into());
} else {
$arg
}
};
}