Improve reify! syntax.
This commit is contained in:
@@ -183,7 +183,7 @@ impl Engine {
|
||||
.and_then(|result| {
|
||||
// Bail out early if the return type needs no cast
|
||||
if TypeId::of::<T>() == TypeId::of::<Dynamic>() {
|
||||
return Ok(reify!(result => T));
|
||||
return Ok(reify! { result => T });
|
||||
}
|
||||
|
||||
// Cast return type
|
||||
|
@@ -130,16 +130,16 @@ impl Expression<'_> {
|
||||
pub fn get_literal_value<T: Variant>(&self) -> Option<T> {
|
||||
// Coded this way in order to maximally leverage potentials for dead-code removal.
|
||||
match self.0 {
|
||||
Expr::IntegerConstant(x, ..) => reify!(*x => Option<T>),
|
||||
Expr::IntegerConstant(x, ..) => reify! { *x => Option<T> },
|
||||
|
||||
#[cfg(not(feature = "no_float"))]
|
||||
Expr::FloatConstant(x, ..) => reify!(*x => Option<T>),
|
||||
Expr::FloatConstant(x, ..) => reify! { *x => Option<T> },
|
||||
|
||||
Expr::CharConstant(x, ..) => reify!(*x => Option<T>),
|
||||
Expr::StringConstant(x, ..) => reify!(x.clone() => Option<T>),
|
||||
Expr::Variable(x, ..) => reify!(x.3.clone() => Option<T>),
|
||||
Expr::BoolConstant(x, ..) => reify!(*x => Option<T>),
|
||||
Expr::Unit(..) => reify!(() => Option<T>),
|
||||
Expr::CharConstant(x, ..) => reify! { *x => Option<T> },
|
||||
Expr::StringConstant(x, ..) => reify! { x.clone() => Option<T> },
|
||||
Expr::Variable(x, ..) => reify! { x.3.clone() => Option<T> },
|
||||
Expr::BoolConstant(x, ..) => reify! { *x => Option<T> },
|
||||
Expr::Unit(..) => reify! { () => Option<T> },
|
||||
|
||||
_ => None,
|
||||
}
|
||||
|
@@ -200,7 +200,7 @@ impl Engine {
|
||||
|
||||
// Bail out early if the return type needs no cast
|
||||
if TypeId::of::<T>() == TypeId::of::<Dynamic>() {
|
||||
return Ok(reify!(result => T));
|
||||
return Ok(reify! { result => T });
|
||||
}
|
||||
|
||||
let typ = self.map_type_name(result.type_name());
|
||||
|
Reference in New Issue
Block a user