-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
This is a refactor task.
The code in gems/codetracer-ruby-recorder/ext/native_tracer/src/lib.rs
contains several similar repeated patterns of code for converting from Ruby strings to Rust strings. To reveal them, search for RSTRING_PTR
in the code. These patters should probably be unified and extracted to a function or two. However, they differ in various corner cases, so we should carefully decide which version to use:
- Some convert NIL values to "", some don't bother with this check.
- Some use String::from_utf8_lossy, others use std::str::from_utf8. These vary in the way they handle invalid UTF-8 data.
- Some convert non-string types to string, others don't.