30
How I Have Fun With Rust - Matheus Richard
(thoughtbot.com)
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Credits
Exactly.
I have a strict no-
unsafe
policy. My projects don't need anythingunsafe
provides, so needing it means my structure is bad. Anyunsafe
blocks should only be in external crates and fully tested.I'm also a big fan of getting function signatures right, even if they don't behave properly. For example, if I know a function could error, I'll go ahead and have it return a result even if every error path uses
.expect()
. That way my refactors are limited to just those functions, and probably not the functions that call it.I'm a fan of writing relatively dirty code, as long as the dirty parts are obvious (e.g. have a comment explaining why certain shortcuts were made). But as much as possible, make the function signatures correct so refactors are easier.