3 ms·
> no one is magically writing Drop traits implementations for the user. Yes, the compiler is - for almost all structs. I've been working with Rust since around
by hobofan 4y ago
> no one is magically writing Drop traits implementations for the user.
Yes, the compiler is - for almost all structs. I've been working with Rust since around 1.0 and I can count the number of times I manually had to write Drop implementations with my hands. Unless you are writing lower-level parts of the stack (which you rarely need to, since for many of those there are good crates already available) where you are responsible for resources that need a custom Drop implementation, the auto Drop implementation is good enough.
- pjmlp 4y agoTrivial types don't count, their Drop implementation is basically do nothing. And for Rust standard library, where the Drop actually does something, someone else wrote the implementation for you.