Skip to content

Commit 1747cf2

Browse files
committed
ref: cargo clippy
1 parent 2eb7899 commit 1747cf2

4 files changed

Lines changed: 25 additions & 20 deletions

File tree

taurus/src/context/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ pub struct Context {
1919

2020
impl Context {
2121
pub fn new(flow_input: Value) -> Self {
22-
return Context {
22+
Context {
2323
results: HashMap::new(),
2424
input_types: HashMap::new(),
2525
flow_input,
2626
current_node_id: 0,
27-
};
27+
}
2828
}
2929

3030
pub fn get_current_node_id(&mut self) -> i64 {
31-
return self.current_node_id;
31+
self.current_node_id
3232
}
3333

3434
pub fn set_current_node_id(&mut self, node_id: i64) {
@@ -108,7 +108,7 @@ impl Context {
108108
}
109109

110110
fn get_flow_input(&mut self) -> ContextResult {
111-
return ContextResult::Success(self.flow_input.clone());
111+
ContextResult::Success(self.flow_input.clone())
112112
}
113113

114114
fn get_input_type(&mut self, input_type: InputType) -> ContextResult {

taurus/src/context/executor.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl<'a> Executor<'a> {
193193
ArgTrace {
194194
index: i,
195195
kind: ArgKind::Reference {
196-
reference: reference,
196+
reference,
197197
hit: true,
198198
},
199199
preview: format!("ctx.get({:?}) -> {:?}", r, v),
@@ -247,8 +247,8 @@ impl<'a> Executor<'a> {
247247
.copied()
248248
.unwrap_or(ParameterNode::Eager);
249249

250-
if matches!(mode, ParameterNode::Eager) {
251-
if let Argument::Thunk(id) = *arg {
250+
if matches!(mode, ParameterNode::Eager)
251+
&& let Argument::Thunk(id) = *arg {
252252
let (child_sig, child_root) = self.execute_call(id, ctx, tracer);
253253

254254
tracer.link_child(
@@ -271,7 +271,6 @@ impl<'a> Executor<'a> {
271271
}
272272
}
273273
}
274-
}
275274
}
276275

277276
Ok(())

taurus/src/debug/tracer.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ pub struct Tracer {
1515
stack: Vec<u64>,
1616
}
1717

18+
impl Default for Tracer {
19+
fn default() -> Self {
20+
Self::new()
21+
}
22+
}
23+
1824
impl Tracer {
1925
pub fn new() -> Self {
2026
Self {

taurus/src/implementation/array.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn filter(
162162
let mut out: Vec<Value> = Vec::new();
163163
let node_id = ctx.get_current_node_id();
164164
let input_type = InputType {
165-
node_id: node_id,
165+
node_id,
166166
parameter_index: 1,
167167
input_index: 0,
168168
};
@@ -210,7 +210,7 @@ fn find(
210210
};
211211
let node_id = ctx.get_current_node_id();
212212
let input_type = InputType {
213-
node_id: node_id,
213+
node_id,
214214
parameter_index: 1,
215215
input_index: 0,
216216
};
@@ -266,7 +266,7 @@ fn find_last(
266266
array.values.reverse();
267267
let node_id = ctx.get_current_node_id();
268268
let input_type = InputType {
269-
node_id: node_id,
269+
node_id,
270270
parameter_index: 1,
271271
input_index: 0,
272272
};
@@ -321,7 +321,7 @@ fn find_index(
321321
};
322322
let node_id = ctx.get_current_node_id();
323323
let input_type = InputType {
324-
node_id: node_id,
324+
node_id,
325325
parameter_index: 1,
326326
input_index: 0,
327327
};
@@ -410,7 +410,7 @@ fn for_each(
410410
};
411411
let node_id = ctx.get_current_node_id();
412412
let input_type = InputType {
413-
node_id: node_id,
413+
node_id,
414414
parameter_index: 1,
415415
input_index: 0,
416416
};
@@ -457,7 +457,7 @@ fn map(
457457
let mut out: Vec<Value> = Vec::with_capacity(array.values.len());
458458
let node_id = ctx.get_current_node_id();
459459
let input_type = InputType {
460-
node_id: node_id,
460+
node_id,
461461
parameter_index: 1,
462462
input_index: 0,
463463
};
@@ -649,13 +649,13 @@ fn sort(
649649
let mut out: Vec<f64> = Vec::new();
650650
let node_id = ctx.get_current_node_id();
651651
let input_type = InputType {
652-
node_id: node_id,
652+
node_id,
653653
parameter_index: 1,
654654
input_index: 0,
655655
};
656656

657657
let input_type_next = InputType {
658-
node_id: node_id,
658+
node_id,
659659
parameter_index: 1,
660660
input_index: 1,
661661
};
@@ -666,7 +666,7 @@ fn sort(
666666
ctx.insert_input_type(input_type_next, b.clone());
667667
let sig = run(*transform_node, ctx);
668668
signals.push(sig);
669-
return Ordering::Equal;
669+
Ordering::Equal
670670
});
671671

672672
for sig in signals {
@@ -735,13 +735,13 @@ fn sort_reverse(
735735
let mut out: Vec<f64> = Vec::new();
736736
let node_id = ctx.get_current_node_id();
737737
let input_type = InputType {
738-
node_id: node_id,
738+
node_id,
739739
parameter_index: 1,
740740
input_index: 0,
741741
};
742742

743743
let input_type_next = InputType {
744-
node_id: node_id,
744+
node_id,
745745
parameter_index: 1,
746746
input_index: 1,
747747
};
@@ -752,7 +752,7 @@ fn sort_reverse(
752752
ctx.insert_input_type(input_type_next, b.clone());
753753
let sig = run(*transform_node, ctx);
754754
signals.push(sig);
755-
return Ordering::Equal;
755+
Ordering::Equal
756756
});
757757

758758
for sig in signals {

0 commit comments

Comments
 (0)