Skip to content

Commit cd7c5a3

Browse files
committed
ZJIT: Take a slice instead of Vec in test code
Shorter code and more efficient.
1 parent 2b810ac commit cd7c5a3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zjit/src/hir.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,9 +2736,9 @@ mod tests {
27362736
}
27372737

27382738
#[track_caller]
2739-
fn assert_method_hir_with_opcodes(method: &str, opcodes: Vec<u32>, hir: Expect) {
2739+
fn assert_method_hir_with_opcodes(method: &str, opcodes: &[u32], hir: Expect) {
27402740
let iseq = crate::cruby::with_rubyvm(|| get_method_iseq(method));
2741-
for opcode in opcodes {
2741+
for &opcode in opcodes {
27422742
assert!(iseq_contains_opcode(iseq, opcode), "iseq {method} does not contain {}", insn_name(opcode as usize));
27432743
}
27442744
unsafe { crate::cruby::rb_zjit_profile_disable(iseq) };
@@ -2748,7 +2748,7 @@ mod tests {
27482748

27492749
#[track_caller]
27502750
fn assert_method_hir_with_opcode(method: &str, opcode: u32, hir: Expect) {
2751-
assert_method_hir_with_opcodes(method, vec![opcode], hir)
2751+
assert_method_hir_with_opcodes(method, &[opcode], hir)
27522752
}
27532753

27542754
#[track_caller]
@@ -2982,7 +2982,7 @@ mod tests {
29822982
a
29832983
end
29842984
");
2985-
assert_method_hir_with_opcodes("test", vec![YARVINSN_getlocal_WC_0, YARVINSN_setlocal_WC_0], expect![[r#"
2985+
assert_method_hir_with_opcodes("test", &[YARVINSN_getlocal_WC_0, YARVINSN_setlocal_WC_0], expect![[r#"
29862986
fn test:
29872987
bb0(v0:BasicObject):
29882988
v1:NilClassExact = Const Value(nil)

0 commit comments

Comments
 (0)