fix: C# EvalRule (#387)

- Fix EvalRule to call EvalRule instead of EvalQuery
- Also fix clippy errors

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2025-04-04 15:44:16 -07:00
committed by GitHub
parent 2749e820c4
commit ab93c07773
7 changed files with 26 additions and 30 deletions

View File

@@ -224,7 +224,7 @@ fn urlquery_decode(
let mut query_str = "".to_owned();
for (k, v) in url.query_pairs() {
query_str += &k;
if v != "" {
if !v.is_empty() {
query_str += "=";
query_str += &v;
}

View File

@@ -135,40 +135,28 @@ impl From<f64> for Number {
impl Number {
pub fn as_u128(&self) -> Option<u128> {
match self {
Big(b) if b.is_integer() => match u128::try_from(&b.d) {
Ok(v) => Some(v),
_ => None,
},
Big(b) if b.is_integer() => u128::try_from(&b.d).ok(),
_ => None,
}
}
pub fn as_i128(&self) -> Option<i128> {
match self {
Big(b) if b.is_integer() => match i128::try_from(&b.d) {
Ok(v) => Some(v),
_ => None,
},
Big(b) if b.is_integer() => i128::try_from(&b.d).ok(),
_ => None,
}
}
pub fn as_u64(&self) -> Option<u64> {
match self {
Big(b) if b.is_integer() => match u64::try_from(&b.d) {
Ok(v) => Some(v),
_ => None,
},
Big(b) if b.is_integer() => u64::try_from(&b.d).ok(),
_ => None,
}
}
pub fn as_i64(&self) -> Option<i64> {
match self {
Big(b) if b.is_integer() => match i64::try_from(&b.d) {
Ok(v) => Some(v),
_ => None,
},
Big(b) if b.is_integer() => i64::try_from(&b.d).ok(),
_ => None,
}
}
@@ -317,10 +305,7 @@ impl Number {
fn ensure_integer(&self) -> Option<BigInt> {
match self {
Big(a) if a.is_integer() => match BigInt::try_from(&a.d) {
Ok(v) => Some(v),
_ => None,
},
Big(a) if a.is_integer() => BigInt::try_from(&a.d).ok(),
_ => None,
}
}