Warning
This post was published 40 days ago. The information described in this article may have changed.
Hi, I met the "multiple mutable references" compile error in this PR: perf(cursor): reduce lock/unlock calls during cursor movement by linrongbin16 · Pull Request #383 · rsvim/rsvim · GitHub.
There are two parts:
_raw_cursor_move
method (please use "split" diff-view for better readibility): perf(cursor): reduce lock/unlock calls during cursor movement by linrongbin16 · Pull Request #383 · rsvim/rsvim · GitHub.The two code are exactly the same, I want to extract the code blocks into a single method, to avoid too many lines code logic, and also improves the unit test coverage.
The variable tree
is compiling correct with 1st code block. While in the 2nd method, it use unsafe
and std::ptr::NonNull
to bypass the safe checker, but I want to avoid the unsafe code.
Is there a way to write this method in a safe way?
2 posts - 2 participants
🏷️ rust_feed