remove workaround for compiler regression
This commit is contained in:
parent
5480937b4d
commit
25e6151aa9
@ -10,9 +10,8 @@ use crate::value::{Number, Value};
|
|||||||
|
|
||||||
macro_rules! opt_rgba {
|
macro_rules! opt_rgba {
|
||||||
($args:ident, $name:ident, $arg:literal, $low:literal, $high:literal, $scope:ident, $super_selector:ident) => {
|
($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) {
|
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,
|
Value::Null => None,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
@ -31,9 +30,10 @@ macro_rules! opt_rgba {
|
|||||||
|
|
||||||
macro_rules! opt_hsl {
|
macro_rules! opt_hsl {
|
||||||
($args:ident, $name:ident, $arg:literal, $low:literal, $high:literal, $scope:ident, $super_selector:ident) => {
|
($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) {
|
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,
|
Value::Null => None,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
@ -188,10 +188,9 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
|||||||
|
|
||||||
macro_rules! opt_scale_arg {
|
macro_rules! opt_scale_arg {
|
||||||
($args:ident, $name:ident, $arg:literal, $low:literal, $high:literal, $scope:ident, $super_selector:ident) => {
|
($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) {
|
let $name = match named_arg!($args, $scope, $super_selector, $arg = Value::Null) {
|
||||||
Value::Dimension(n, Unit::Percent) => {
|
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(..) => {
|
v @ Value::Dimension(..) => {
|
||||||
return Err(
|
return Err(
|
||||||
|
@ -70,23 +70,6 @@ macro_rules! bound {
|
|||||||
$arg
|
$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) => {
|
($args:ident, $name:literal, $arg:ident, $unit:path, $low:literal, $high:literal) => {
|
||||||
if $arg > Number::from($high) || $arg < Number::from($low) {
|
if $arg > Number::from($high) || $arg < Number::from($low) {
|
||||||
return Err((
|
return Err((
|
||||||
@ -101,21 +84,4 @@ macro_rules! bound {
|
|||||||
$arg
|
$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
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user