From 07648052cee3555cc53fd8cbab4f4337539c2243 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Sun, 03 Mar 2024 19:07:32 +0000 Subject: [PATCH] style: fix clippy warnings --- --- a/crates/jrsonnet-evaluator/src/evaluate/operator.rs +++ b/crates/jrsonnet-evaluator/src/evaluate/operator.rs @@ -42,7 +42,7 @@ (Num(v1), Num(v2)) => Val::new_checked_num(v1 + v2)?, #[cfg(feature = "exp-bigint")] - (BigInt(a), BigInt(b)) => BigInt(Box::new((&**a).clone() + (&**b).clone())), + (BigInt(a), BigInt(b)) => BigInt(Box::new(&**a + &**b)), _ => bail!(BinaryOperatorDoesNotOperateOnValues( BinaryOpType::Add, a.value_type(), @@ -180,9 +180,9 @@ // Bigint X Bigint #[cfg(feature = "exp-bigint")] - (BigInt(a), Mul, BigInt(b)) => BigInt(Box::new((&**a).clone() * (&**b).clone())), + (BigInt(a), Mul, BigInt(b)) => BigInt(Box::new(&**a * &**b)), #[cfg(feature = "exp-bigint")] - (BigInt(a), Sub, BigInt(b)) => BigInt(Box::new((&**a).clone() - (&**b).clone())), + (BigInt(a), Sub, BigInt(b)) => BigInt(Box::new(&**a - &**b)), _ => bail!(BinaryOperatorDoesNotOperateOnValues( op, --- a/crates/jrsonnet-evaluator/src/lib.rs +++ b/crates/jrsonnet-evaluator/src/lib.rs @@ -47,6 +47,8 @@ clippy::mutable_key_type, // false positives clippy::redundant_pub_crate, + // Sometimes code is fancier without that + clippy::manual_let_else, )] // For jrsonnet-macros --- a/crates/jrsonnet-evaluator/src/manifest.rs +++ b/crates/jrsonnet-evaluator/src/manifest.rs @@ -211,9 +211,9 @@ #[cfg(feature = "exp-bigint")] Val::BigInt(n) => { if options.preserve_bigints { - write!(buf, "{n}").unwrap() + write!(buf, "{n}").unwrap(); } else { - write!(buf, "{:?}", n.to_string()).unwrap() + write!(buf, "{:?}", n.to_string()).unwrap(); } } Val::Arr(items) => { -- gitstuff