Skip to content

Commit 6911073

Browse files
committed
refactor: removed the to_s_id parameter from the struct_value() function
It is a little stupid to require this as an extra parameter, when it's already available as a field in the Recorder structure (passed as first parameter to the function)
1 parent 8fce379 commit 6911073

File tree

1 file changed

+3
-8
lines changed
  • gems/codetracer-ruby-recorder/ext/native_tracer/src

1 file changed

+3
-8
lines changed

gems/codetracer-ruby-recorder/ext/native_tracer/src/lib.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,10 @@ unsafe fn struct_value(
116116
field_names: &[&str],
117117
field_values: &[VALUE],
118118
depth: usize,
119-
to_s_id: ID,
120119
) -> ValueRecord {
121120
let mut vals = Vec::with_capacity(field_values.len());
122121
for &v in field_values {
123-
vals.push(to_value(recorder, v, depth - 1, to_s_id));
122+
vals.push(to_value(recorder, v, depth - 1, recorder.to_s_id));
124123
}
125124

126125
let version_entry = recorder
@@ -407,7 +406,6 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize, to_s_id: I
407406
&["k", "v"],
408407
&[key, val_elem],
409408
depth,
410-
to_s_id,
411409
));
412410
}
413411
let type_id = TraceWriter::ensure_type_id(&mut *recorder.tracer, TypeKind::Seq, "Hash");
@@ -426,7 +424,6 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize, to_s_id: I
426424
&["begin", "end"],
427425
&[begin_val, end_val],
428426
depth,
429-
to_s_id,
430427
);
431428
}
432429
if NIL_P(recorder.set_class) {
@@ -461,7 +458,6 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize, to_s_id: I
461458
&["sec", "nsec"],
462459
&[sec, nsec],
463460
depth,
464-
to_s_id,
465461
);
466462
}
467463
if rb_obj_is_kind_of(val, rb_cRegexp) != 0 {
@@ -473,7 +469,6 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize, to_s_id: I
473469
&["source", "options"],
474470
&[src, opts],
475471
depth,
476-
to_s_id,
477472
);
478473
}
479474
if rb_obj_is_kind_of(val, rb_cStruct) != 0 {
@@ -502,7 +497,7 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize, to_s_id: I
502497
names.push(name);
503498
vals.push(*val_ptr.add(i));
504499
}
505-
return struct_value(recorder, &class_name, &names, &vals, depth, to_s_id);
500+
return struct_value(recorder, &class_name, &names, &vals, depth);
506501
}
507502
if NIL_P(recorder.open_struct_class) {
508503
if rb_const_defined(rb_cObject, recorder.open_struct_const_id) != 0 {
@@ -537,7 +532,7 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize, to_s_id: I
537532
vals.push(value);
538533
}
539534
if !names.is_empty() {
540-
return struct_value(recorder, &class_name, &names, &vals, depth, to_s_id);
535+
return struct_value(recorder, &class_name, &names, &vals, depth);
541536
}
542537
let text = value_to_string(val, to_s_id).unwrap_or_default();
543538
let type_id = TraceWriter::ensure_type_id(&mut *recorder.tracer, TypeKind::Raw, &class_name);

0 commit comments

Comments
 (0)