Simplify using ..
This commit is contained in:
@@ -72,9 +72,9 @@ impl Expression<'_> {
|
||||
pub fn get_string_value(&self) -> Option<&str> {
|
||||
match self.0 {
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
Expr::Variable(_, _, x) if x.1.is_some() => None,
|
||||
Expr::Variable(_, _, x) => Some(x.2.as_str()),
|
||||
Expr::StringConstant(x, _) => Some(x.as_str()),
|
||||
Expr::Variable(.., _, x) if x.1.is_some() => None,
|
||||
Expr::Variable(.., _, x) => Some(x.2.as_str()),
|
||||
Expr::StringConstant(x, ..) => Some(x.as_str()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -94,18 +94,18 @@ 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, |x: T| Some(x), || None),
|
||||
Expr::IntegerConstant(x, ..) => reify!(*x, |x: T| Some(x), || None),
|
||||
|
||||
#[cfg(not(feature = "no_float"))]
|
||||
Expr::FloatConstant(x, _) => reify!(*x, |x: T| Some(x), || None),
|
||||
Expr::FloatConstant(x, ..) => reify!(*x, |x: T| Some(x), || None),
|
||||
|
||||
Expr::CharConstant(x, _) => reify!(*x, |x: T| Some(x), || None),
|
||||
Expr::StringConstant(x, _) => reify!(x.clone(), |x: T| Some(x), || None),
|
||||
Expr::Variable(_, _, x) => {
|
||||
Expr::CharConstant(x, ..) => reify!(*x, |x: T| Some(x), || None),
|
||||
Expr::StringConstant(x, ..) => reify!(x.clone(), |x: T| Some(x), || None),
|
||||
Expr::Variable(.., _, x) => {
|
||||
let x: ImmutableString = x.2.clone().into();
|
||||
reify!(x, |x: T| Some(x), || None)
|
||||
}
|
||||
Expr::BoolConstant(x, _) => reify!(*x, |x: T| Some(x), || None),
|
||||
Expr::BoolConstant(x, ..) => reify!(*x, |x: T| Some(x), || None),
|
||||
Expr::Unit(_) => reify!((), |x: T| Some(x), || None),
|
||||
|
||||
_ => None,
|
||||
|
Reference in New Issue
Block a user