Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit b73d942

Browse files
committed
clippy
1 parent 2dd8811 commit b73d942

File tree

7 files changed

+52
-30
lines changed

7 files changed

+52
-30
lines changed

src/disassembly/disassembler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub fn disassemble(bytes: &[u8]) -> Result<Vec<DynOpcode>> {
201201
// as invalid
202202
if !push_bytes.is_empty() && push_bytes.len() != push_size as usize {
203203
add_op(ops, control::Invalid::new(last_push));
204-
for b in push_bytes.iter() {
204+
for b in &push_bytes {
205205
add_op(ops, control::Invalid::new(*b));
206206
}
207207
} else if push_size != 0 {

src/opcode/memory.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ mod test {
14661466
assert_eq!(offset.provenance(), Provenance::Synthetic);
14671467
}
14681468
_ => panic!("Invalid data"),
1469-
};
1469+
}
14701470
assert_eq!(item.provenance(), Provenance::Execution);
14711471

14721472
Ok(())
@@ -1519,7 +1519,7 @@ mod test {
15191519
assert_eq!(size, &input_size);
15201520
}
15211521
_ => panic!("Incorrect payload"),
1522-
};
1522+
}
15231523
assert_eq!(loaded.provenance(), Provenance::Execution);
15241524

15251525
Ok(())
@@ -1641,7 +1641,7 @@ mod test {
16411641
assert_eq!(size, &input_size);
16421642
}
16431643
_ => panic!("Incorrect payload"),
1644-
};
1644+
}
16451645
assert_eq!(loaded.provenance(), Provenance::Execution);
16461646

16471647
Ok(())
@@ -1924,7 +1924,7 @@ mod test {
19241924
assert_eq!(value, &opcode.bytes_as_word());
19251925
}
19261926
_ => panic!("Incorrect payload"),
1927-
};
1927+
}
19281928
}
19291929

19301930
Ok(())

src/tc/debug.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ pub fn collect_vars_in_tree_of(
180180

181181
while let Some(tv) = tyvar_queue.pop_front() {
182182
let inferences = state.inferences_for(tv);
183-
for i in inferences.iter() {
183+
for i in &inferences {
184184
match i {
185185
TE::Any | TE::Word { .. } | TE::Conflict { .. } | TE::Bytes => (),
186186
TE::Equal { id } => {
@@ -202,7 +202,7 @@ pub fn collect_vars_in_tree_of(
202202
}
203203
}
204204
TE::Packed { types, .. } => {
205-
for s in types.iter() {
205+
for s in types {
206206
if !seen.contains(&s.typ) {
207207
tyvar_queue.push_back(s.typ);
208208
}

src/tc/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,9 @@ pub mod test {
863863
#[must_use]
864864
pub fn execution_result_with_values(values: Vec<RuntimeBoxedVal>) -> ExecutionResult {
865865
let mut state_with_values = VMState::new(0, 0, Config::default());
866-
values.into_iter().for_each(|v| state_with_values.record_value(v));
866+
for v in values.into_iter() {
867+
state_with_values.record_value(v);
868+
}
867869

868870
ExecutionResult {
869871
instructions: InstructionStream::try_from(bytecode![Invalid::default()].as_slice())

src/tc/state/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ impl TypeCheckerState {
450450
expression: impl Into<TypeExpression>,
451451
) {
452452
let expression = expression.into();
453-
for v in variables.into_iter() {
453+
for v in variables {
454454
self.infer(v, expression.clone());
455455
}
456456
}

src/tc/unification.rs

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -709,14 +709,16 @@ mod test {
709709
let inference_1 = TE::bytes(Some(ADDRESS_WIDTH_BITS));
710710
let inference_2 = TE::bytes(None);
711711
let inference_3 = TE::address();
712-
let inferences = vec![inference_1, inference_2, inference_3];
712+
let inferences = [inference_1, inference_2, inference_3];
713713
let inference_permutations: Vec<Vec<_>> =
714714
inferences.iter().permutations(inferences.len()).unique().collect();
715715

716716
// Check that they combine properly, and produce the same result no matter the
717717
// order
718718
for permutation in inference_permutations {
719-
permutation.into_iter().for_each(|i| state.infer(v_1_tv, i.clone()));
719+
for i in permutation.into_iter() {
720+
state.infer(v_1_tv, i.clone());
721+
}
720722

721723
unify(&mut state, &LazyWatchdog.in_rc())?;
722724
let result = util::get_inference(v_1_tv, state.result());
@@ -742,14 +744,16 @@ mod test {
742744
let inference_1 = TE::signed_word(Some(64));
743745
let inference_2 = TE::bytes(None);
744746
let inference_3 = TE::signed_word(None);
745-
let inferences = vec![inference_1, inference_2, inference_3];
747+
let inferences = [inference_1, inference_2, inference_3];
746748
let inference_permutations: Vec<Vec<_>> =
747749
inferences.iter().permutations(inferences.len()).unique().collect();
748750

749751
// Check that they combine properly, and produce the same result no matter the
750752
// order
751753
for permutation in inference_permutations {
752-
permutation.into_iter().for_each(|i| state.infer(v_1_tv, i.clone()));
754+
for i in permutation.into_iter() {
755+
state.infer(v_1_tv, i.clone());
756+
}
753757

754758
unify(&mut state, &LazyWatchdog.in_rc())?;
755759
let result = util::get_inference(v_1_tv, state.result());
@@ -771,14 +775,16 @@ mod test {
771775
// Set up some inferences
772776
let inference_1 = TE::signed_word(Some(64));
773777
let inference_2 = TE::signed_word(Some(128));
774-
let inferences = vec![inference_1, inference_2];
778+
let inferences = [inference_1, inference_2];
775779
let permutations: Vec<Vec<_>> =
776780
inferences.iter().permutations(inferences.len()).unique().collect();
777781

778782
// Check that they combine properly, and produce the same error no matter the
779783
// order
780784
for permutation in permutations {
781-
permutation.into_iter().for_each(|i| state.infer(v_1_ty, i.clone()));
785+
for i in permutation.into_iter() {
786+
state.infer(v_1_ty, i.clone());
787+
}
782788

783789
unify(&mut state, &LazyWatchdog.in_rc())?;
784790
let result = util::get_inference(v_1_ty, state.result());
@@ -804,14 +810,16 @@ mod test {
804810
let inference_2 = TE::DynamicArray {
805811
element: element_tv,
806812
};
807-
let inferences = vec![inference_1, inference_2];
813+
let inferences = [inference_1, inference_2];
808814
let permutations: Vec<Vec<_>> =
809815
inferences.iter().permutations(inferences.len()).unique().collect();
810816

811817
// Check that they combine properly, and produce the same result no matter the
812818
// order
813819
for permutation in permutations {
814-
permutation.into_iter().for_each(|i| state.infer(array_tv, i.clone()));
820+
for i in permutation.into_iter() {
821+
state.infer(array_tv, i.clone());
822+
}
815823

816824
unify(&mut state, &LazyWatchdog.in_rc())?;
817825
let result = util::get_inference(array_tv, state.result());
@@ -842,14 +850,16 @@ mod test {
842850
let inference_2 = TE::DynamicArray {
843851
element: element_tv,
844852
};
845-
let inferences = vec![inference_1, inference_2];
853+
let inferences = [inference_1, inference_2];
846854
let permutations: Vec<Vec<_>> =
847855
inferences.iter().permutations(inferences.len()).unique().collect();
848856

849857
// Check that they combine properly, and produce the same result no matter the
850858
// order
851859
for permutation in permutations {
852-
permutation.into_iter().for_each(|i| state.infer(array_tv, i.clone()));
860+
for i in permutation.into_iter() {
861+
state.infer(array_tv, i.clone());
862+
}
853863

854864
unify(&mut state, &LazyWatchdog.in_rc())?;
855865
let result = util::get_inference(array_tv, state.result());
@@ -879,14 +889,16 @@ mod test {
879889
let elem_inference_2 = TE::signed_word(Some(64));
880890
state.infer(elem_1_tv, elem_inference_1);
881891
state.infer(elem_2_tv, elem_inference_2);
882-
let inferences = vec![array_inference_1, array_inference_2];
892+
let inferences = [array_inference_1, array_inference_2];
883893
let permutations: Vec<Vec<_>> =
884894
inferences.iter().permutations(inferences.len()).unique().collect();
885895

886896
// Check that we get the same result, and that they combine properly
887897
for permutation in permutations {
888898
// Register the array inferences in the state
889-
permutation.into_iter().for_each(|i| state.infer(array_tv, i.clone()));
899+
for i in permutation.into_iter() {
900+
state.infer(array_tv, i.clone());
901+
}
890902

891903
// Check the result is right
892904
unify(&mut state, &LazyWatchdog.in_rc())?;
@@ -921,14 +933,16 @@ mod test {
921933
let elem_inference_2 = TE::signed_word(Some(64));
922934
state.infer(elem_1_tv, elem_inference_1);
923935
state.infer(elem_2_tv, elem_inference_2);
924-
let inferences = vec![array_inference_1, array_inference_2];
936+
let inferences = [array_inference_1, array_inference_2];
925937
let permutations: Vec<Vec<_>> =
926938
inferences.iter().permutations(inferences.len()).unique().collect();
927939

928940
// Check that we get the same result, and that they combine properly
929941
for permutation in permutations {
930942
// Register the array inferences in the state
931-
permutation.into_iter().for_each(|i| state.infer(array_tv, i.clone()));
943+
for i in permutation.into_iter() {
944+
state.infer(array_tv, i.clone());
945+
}
932946

933947
// Check the array is right
934948
unify(&mut state, &LazyWatchdog.in_rc())?;
@@ -974,14 +988,16 @@ mod test {
974988
let elem_inference_2 = TE::signed_word(Some(64));
975989
state.infer(elem_1_tv, elem_inference_1);
976990
state.infer(elem_2_tv, elem_inference_2);
977-
let inferences = vec![array_inference_1, array_inference_2];
991+
let inferences = [array_inference_1, array_inference_2];
978992
let permutations: Vec<Vec<_>> =
979993
inferences.iter().permutations(inferences.len()).unique().collect();
980994

981995
// Check that we get the same result, and that they combine properly
982996
for permutation in permutations {
983997
// Register the array inferences in the state
984-
permutation.into_iter().for_each(|i| state.infer(array_tv, i.clone()));
998+
for i in permutation.into_iter() {
999+
state.infer(array_tv, i.clone());
1000+
}
9851001

9861002
unify(&mut state, &LazyWatchdog.in_rc())?;
9871003
let result = util::get_inference(array_tv, state.result());
@@ -1023,14 +1039,16 @@ mod test {
10231039
let elem_inference_2 = TE::signed_word(Some(64));
10241040
state.infer(elem_1_tv, elem_inference_1);
10251041
state.infer(elem_2_tv, elem_inference_2);
1026-
let inferences = vec![array_inference_1, array_inference_2];
1042+
let inferences = [array_inference_1, array_inference_2];
10271043
let permutations: Vec<Vec<_>> =
10281044
inferences.iter().permutations(inferences.len()).unique().collect();
10291045

10301046
// Check that we get the same result, and that they combine properly
10311047
for permutation in permutations {
10321048
// Register the array inferences in the state
1033-
permutation.into_iter().for_each(|i| state.infer(array_tv, i.clone()));
1049+
for i in permutation.into_iter() {
1050+
state.infer(array_tv, i.clone());
1051+
}
10341052

10351053
unify(&mut state, &LazyWatchdog.in_rc())?;
10361054
let result = util::get_inference(array_tv, state.result());
@@ -1074,14 +1092,16 @@ mod test {
10741092
let elem_inference_2 = TE::signed_word(Some(64));
10751093
state.infer(elem_1_tv, elem_inference_1);
10761094
state.infer(elem_2_tv, elem_inference_2);
1077-
let inferences = vec![array_inference_1, array_inference_2];
1095+
let inferences = [array_inference_1, array_inference_2];
10781096
let permutations: Vec<Vec<_>> =
10791097
inferences.iter().permutations(inferences.len()).unique().collect();
10801098

10811099
// Check that we get the same result, and that they combine properly
10821100
for permutation in permutations {
10831101
// Register the array inferences in the state
1084-
permutation.into_iter().for_each(|i| state.infer(array_tv, i.clone()));
1102+
for i in permutation.into_iter() {
1103+
state.infer(array_tv, i.clone());
1104+
}
10851105

10861106
unify(&mut state, &LazyWatchdog.in_rc())?;
10871107
let result = util::get_inference(array_tv, state.result());

tests/watchdog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn kills_extractor_when_needed() -> anyhow::Result<()> {
3636
let error = errors.payloads().first().unwrap();
3737

3838
match &error.payload {
39-
Error::Execution(error::execution::Error::StoppedByWatchdog { .. }) => (),
39+
Error::Execution(error::execution::Error::StoppedByWatchdog) => (),
4040
_ => panic!("Wrong payload"),
4141
}
4242

0 commit comments

Comments
 (0)