|
|
|
|
|
by burjui
543 days ago
|
|
Exactly the same experience : my toy compiler project has 10477 lines of Rust code, and there is only one line with unsafe: let is_tty = unsafe { libc::isatty(libc::STDERR_FILENO) } != 0;
Here's the source, just in case: https://github.com/burjui/rambo/In fact, there are exactly two "unsafe" blocks in all of my Rust projects, and the second one is not even needed anymore because of the language and ecosystem improvements, but the project is basically abandoned, so I'm probably not gonna fix it. There's just no need for unsafe in the vast majority of code. I don't know where Rust critics get their statistics; probably from picking their noses, judging by their arguments. Most don't seem to even have read the official docs, the bare minimum required to form any conclusions at all about the language. I guess they don't read much Rust code and think there is no way we can write even semi-decently performing high-level code without resorting to unsafe hacks or calling C, because that's the way it's done in other languages. |
|