3 ms·
So, there is, but it only works for your code. You can do it via an attribute in the source (#![forbid(unsafe)]) or via a command line flag (cargo rustc -- -D u
by steveklabnik 7y ago
So, there is, but it only works for your code. You can do it via an attribute in the source (#![forbid(unsafe)]) or via a command line flag (cargo rustc -- -D unsafe).
This will not check your dependencies. You can use other tools, like cargo-geiger https://github.com/anderejd/cargo-geiger https://github.com/anderejd/cargo-geiger to check your dependencies.
And of course, at the lowest levels, doing anything useful requires unsafe, since your operating system doesn't expose a Rust API to do tasks.
- johnisgood 7y agoThank you! I will use that attribute wherever I can.