Add default implementation for Operator::is_left_to_right
This commit is contained in:
parent
83269068a2
commit
4838a21a57
@ -16,7 +16,9 @@ pub trait Operator: Debug + Display {
|
||||
/// and false if they should be evaluated right-to-left.
|
||||
/// Left-to-right chaining has priority if operators with different order but same precedence are chained.
|
||||
// Make this a const fn once #57563 is resolved
|
||||
fn is_left_to_right(&self) -> bool;
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// True if this operator is a leaf, meaning it accepts no arguments.
|
||||
// Make this a const fn once #57563 is resolved
|
||||
@ -118,10 +120,6 @@ impl Operator for RootNode {
|
||||
200
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
1
|
||||
}
|
||||
@ -140,10 +138,6 @@ impl Operator for Add {
|
||||
95
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -176,10 +170,6 @@ impl Operator for Sub {
|
||||
95
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -212,10 +202,6 @@ impl Operator for Neg {
|
||||
110
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
1
|
||||
}
|
||||
@ -242,10 +228,6 @@ impl Operator for Mul {
|
||||
100
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -278,10 +260,6 @@ impl Operator for Div {
|
||||
100
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -314,10 +292,6 @@ impl Operator for Mod {
|
||||
100
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -350,10 +324,6 @@ impl Operator for Exp {
|
||||
120
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -377,10 +347,6 @@ impl Operator for Eq {
|
||||
80
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -401,10 +367,6 @@ impl Operator for Neq {
|
||||
80
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -425,10 +387,6 @@ impl Operator for Gt {
|
||||
80
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -459,10 +417,6 @@ impl Operator for Lt {
|
||||
80
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -493,10 +447,6 @@ impl Operator for Geq {
|
||||
80
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -527,10 +477,6 @@ impl Operator for Leq {
|
||||
80
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -561,10 +507,6 @@ impl Operator for And {
|
||||
75
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -587,10 +529,6 @@ impl Operator for Or {
|
||||
70
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -613,10 +551,6 @@ impl Operator for Not {
|
||||
110
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
1
|
||||
}
|
||||
@ -638,10 +572,6 @@ impl Operator for Tuple {
|
||||
40
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
2
|
||||
}
|
||||
@ -702,10 +632,6 @@ impl Operator for Const {
|
||||
200
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
0
|
||||
}
|
||||
@ -722,10 +648,6 @@ impl Operator for VariableIdentifier {
|
||||
200
|
||||
}
|
||||
|
||||
fn is_left_to_right(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn max_argument_amount(&self) -> usize {
|
||||
0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user