Skip to content

Commit d6a5353

Browse files
committed
ref: cargo clippy
1 parent 54c7bbb commit d6a5353

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

taurus/src/context/executor.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ impl<'a> Executor<'a> {
9090
.get(i)
9191
.copied()
9292
.unwrap_or(ParameterNode::Eager);
93-
if matches!(mode, ParameterNode::Eager) {
94-
if let Argument::Thunk(id) = *a {
95-
match self.execute(id) {
96-
Signal::Success(v) => *a = Argument::Eval(v),
97-
s @ (Signal::Failure(_)
98-
| Signal::Return(_)
99-
| Signal::Respond(_)
100-
| Signal::Stop) => return s,
101-
}
93+
if matches!(mode, ParameterNode::Eager)
94+
&& let Argument::Thunk(id) = *a
95+
{
96+
match self.execute(id) {
97+
Signal::Success(v) => *a = Argument::Eval(v),
98+
s @ (Signal::Failure(_)
99+
| Signal::Return(_)
100+
| Signal::Respond(_)
101+
| Signal::Stop) => return s,
102102
}
103103
}
104104
}

taurus/src/implementation/array.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,7 @@ fn at(args: &[Argument], _ctx: &mut Context, _run: &mut dyn FnMut(i64) -> Signal
6464
fn concat(args: &[Argument], _ctx: &mut Context, _run: &mut dyn FnMut(i64) -> Signal) -> Signal {
6565
args!(args => lhs_v: Value, rhs_v: Value);
6666

67-
let Kind::ListValue(lhs) = lhs_v
68-
.kind
69-
.clone()
70-
.ok_or_else(|| ())
71-
.unwrap_or_else(|_| Kind::NullValue(0))
72-
else {
67+
let Kind::ListValue(lhs) = lhs_v.kind.clone().ok_or(()).unwrap_or(Kind::NullValue(0)) else {
7368
return Signal::Failure(RuntimeError::simple(
7469
"InvalidArgumentRuntimeError",
7570
format!(
@@ -78,12 +73,7 @@ fn concat(args: &[Argument], _ctx: &mut Context, _run: &mut dyn FnMut(i64) -> Si
7873
),
7974
));
8075
};
81-
let Kind::ListValue(rhs) = rhs_v
82-
.kind
83-
.clone()
84-
.ok_or_else(|| ())
85-
.unwrap_or_else(|_| Kind::NullValue(0))
86-
else {
76+
let Kind::ListValue(rhs) = rhs_v.kind.clone().ok_or(()).unwrap_or(Kind::NullValue(0)) else {
8777
return Signal::Failure(RuntimeError::simple(
8878
"InvalidArgumentRuntimeError",
8979
format!(
@@ -167,11 +157,15 @@ fn find(args: &[Argument], _ctx: &mut Context, _run: &mut dyn FnMut(i64) -> Sign
167157
}
168158

169159
let mut i = 0usize;
170-
let item = array.values.iter().cloned().find(|_| {
171-
let keep = *preds.get(i).unwrap_or(&false);
172-
i += 1;
173-
keep
174-
});
160+
let item = array
161+
.values
162+
.iter()
163+
.find(|&_| {
164+
let keep = *preds.get(i).unwrap_or(&false);
165+
i += 1;
166+
keep
167+
})
168+
.cloned();
175169

176170
match item {
177171
Some(v) => Signal::Success(v),

taurus/src/implementation/object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use tucana::shared::{Struct, Value, value::Kind};
22

3+
use crate::context::Context;
34
use crate::context::argument::Argument;
45
use crate::context::macros::args;
56
use crate::context::registry::{HandlerFn, HandlerFunctionEntry, IntoFunctionEntry};
67
use crate::context::signal::Signal;
7-
use crate::{context::Context, error::RuntimeError};
88

99
pub fn collect_object_functions() -> Vec<(&'static str, HandlerFunctionEntry)> {
1010
vec![

0 commit comments

Comments
 (0)