diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2025-06-05 22:02:52 +0900 |
|---|---|---|
| committer | Alan Wu <XrXr@users.noreply.github.com> | 2025-06-06 22:30:17 +0900 |
| commit | cd7c5a3484e56e6182f6676ab581066d61e24048 (patch) | |
| tree | 5ee652456602925d29f78369e2f08a3b6c41254b | |
| parent | 2b810ac595664423e612964616068ad95d9d9e5e (diff) | |
ZJIT: Take a slice instead of Vec in test code
Shorter code and more efficient.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13528
| -rw-r--r-- | zjit/src/hir.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs index 9e27dc3182..10dd525feb 100644 --- a/zjit/src/hir.rs +++ b/zjit/src/hir.rs @@ -2736,9 +2736,9 @@ mod tests { } #[track_caller] - fn assert_method_hir_with_opcodes(method: &str, opcodes: Vec<u32>, hir: Expect) { + fn assert_method_hir_with_opcodes(method: &str, opcodes: &[u32], hir: Expect) { let iseq = crate::cruby::with_rubyvm(|| get_method_iseq(method)); - for opcode in opcodes { + for &opcode in opcodes { assert!(iseq_contains_opcode(iseq, opcode), "iseq {method} does not contain {}", insn_name(opcode as usize)); } unsafe { crate::cruby::rb_zjit_profile_disable(iseq) }; @@ -2748,7 +2748,7 @@ mod tests { #[track_caller] fn assert_method_hir_with_opcode(method: &str, opcode: u32, hir: Expect) { - assert_method_hir_with_opcodes(method, vec![opcode], hir) + assert_method_hir_with_opcodes(method, &[opcode], hir) } #[track_caller] @@ -2982,7 +2982,7 @@ mod tests { a end "); - assert_method_hir_with_opcodes("test", vec![YARVINSN_getlocal_WC_0, YARVINSN_setlocal_WC_0], expect![[r#" + assert_method_hir_with_opcodes("test", &[YARVINSN_getlocal_WC_0, YARVINSN_setlocal_WC_0], expect