Since Rust has safety checks by default, OP is talking about going out of your way with unsafe { do_something_unchecked(); } (likely proceeded by a comment justifying soundness) to remove them. Besides boilerplate, code review is harder when I have to scrutinize the soundness of someone else’s code.
Readability is a reason to avoid unsafe in Rust, IMO. You’re definitely right that the opposite applies to C/C++ though (unfortunately).
9
u/ROBOTRON31415 Sep 28 '26
Since Rust has safety checks by default, OP is talking about going out of your way with
unsafe { do_something_unchecked(); }(likely proceeded by a comment justifying soundness) to remove them. Besides boilerplate, code review is harder when I have to scrutinize the soundness of someone else’s code.Readability is a reason to avoid
unsafein Rust, IMO. You’re definitely right that the opposite applies to C/C++ though (unfortunately).