google / comprehensive-rust

This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
https://google.github.io/comprehensive-rust/
Apache License 2.0
27.96k stars 1.67k forks source link

Remove unnecessary null check in FFI exercise #2432

Closed mgeisler closed 1 month ago

mgeisler commented 1 month ago

We only assign self.dir once and we only assign it if the pointer is non-null. We can therefore simplify the drop implementation a little.