Skip to content

Commit d621b0c

Browse files
committed
refactor: unify all the rb_sys uses in a single 'use' statement
No functional changes. The previous division into several 'use' blocks was entirely unnecesary, and the comments - misleading and useless. Example 1: // Types from rb_sys bindings !!! But these weren't the only types from rb_sys. There was no reason why these types were separated from the others !!! Example 2: // Use event hook flags enum from rb_sys use rb_sys::rb_event_hook_flag_t; !!! This comments the obvious and is an entirely useless comment. Also, there are plenty of other types and enums imported from rb_sys, which do not feature this comment. This enum is not special in any way. !!!
1 parent a8fea2b commit d621b0c

File tree

1 file changed

+11
-22
lines changed
  • gems/codetracer-ruby-recorder/ext/native_tracer/src

1 file changed

+11
-22
lines changed

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

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ use std::{
1010
};
1111

1212
use rb_sys::{
13-
rb_cObject, rb_define_alloc_func, rb_define_class, rb_define_method, rb_eIOError,
14-
rb_event_flag_t, rb_funcall, rb_id2name, rb_id2sym, rb_intern, rb_num2long, rb_obj_classname,
15-
rb_raise, rb_sym2id, ID, RUBY_EVENT_CALL, RUBY_EVENT_LINE, RUBY_EVENT_RAISE, RUBY_EVENT_RETURN,
16-
VALUE,
13+
rb_add_event_hook2, rb_cObject, rb_cRange, rb_cRegexp, rb_cStruct, rb_cTime,
14+
rb_check_typeddata, rb_const_defined, rb_const_get, rb_data_type_struct__bindgen_ty_1,
15+
rb_data_type_t, rb_data_typed_object_wrap, rb_define_alloc_func, rb_define_class,
16+
rb_define_method, rb_eIOError, rb_event_flag_t, rb_event_hook_flag_t, rb_funcall, rb_id2name,
17+
rb_id2sym, rb_intern, rb_method_boundp, rb_num2dbl, rb_num2long, rb_obj_classname,
18+
rb_obj_is_kind_of, rb_protect, rb_raise, rb_remove_event_hook_with_data, rb_sym2id,
19+
rb_trace_arg_t, rb_tracearg_binding, rb_tracearg_callee_id, rb_tracearg_event_flag,
20+
rb_tracearg_lineno, rb_tracearg_path, rb_tracearg_raised_exception, rb_tracearg_return_value,
21+
rb_tracearg_self, Qfalse, Qnil, Qtrue, ID, NIL_P, RARRAY_CONST_PTR, RARRAY_LEN,
22+
RB_FLOAT_TYPE_P, RB_INTEGER_TYPE_P, RB_SYMBOL_P, RB_TYPE_P, RSTRING_LEN, RSTRING_PTR,
23+
RUBY_EVENT_CALL, RUBY_EVENT_LINE, RUBY_EVENT_RAISE, RUBY_EVENT_RETURN, VALUE,
1724
};
18-
use rb_sys::{
19-
rb_protect, NIL_P, RARRAY_CONST_PTR, RARRAY_LEN, RB_FLOAT_TYPE_P, RB_INTEGER_TYPE_P,
20-
RB_SYMBOL_P, RB_TYPE_P, RSTRING_LEN, RSTRING_PTR,
21-
};
22-
use rb_sys::{Qfalse, Qnil, Qtrue};
2325
use runtime_tracing::{
2426
create_trace_writer, CallRecord, EventLogKind, FieldTypeRecord, FullValueRecord, Line,
2527
TraceEventsFileFormat, TraceLowLevelEvent, TraceWriter, TypeKind, TypeRecord, TypeSpecificInfo,
@@ -29,19 +31,6 @@ use runtime_tracing::{
2931
// Event hook function type from Ruby debug.h
3032
type rb_event_hook_func_t = Option<unsafe extern "C" fn(rb_event_flag_t, VALUE, VALUE, ID, VALUE)>;
3133

32-
// Use event hook flags enum from rb_sys
33-
use rb_sys::rb_event_hook_flag_t;
34-
35-
// Types from rb_sys bindings
36-
use rb_sys::{
37-
rb_add_event_hook2, rb_cRange, rb_cRegexp, rb_cStruct, rb_cTime, rb_check_typeddata,
38-
rb_const_defined, rb_const_get, rb_data_type_struct__bindgen_ty_1, rb_data_type_t,
39-
rb_data_typed_object_wrap, rb_method_boundp, rb_num2dbl, rb_obj_is_kind_of,
40-
rb_remove_event_hook_with_data, rb_trace_arg_t, rb_tracearg_binding, rb_tracearg_callee_id,
41-
rb_tracearg_event_flag, rb_tracearg_lineno, rb_tracearg_path, rb_tracearg_raised_exception,
42-
rb_tracearg_return_value, rb_tracearg_self,
43-
};
44-
4534
struct InternedSymbols {
4635
to_s: ID,
4736
local_variables: ID,

0 commit comments

Comments
 (0)