Mo :ferris: :tux: @ FOSDEM on Nostr: npub1ha2lr…mk5hs Great post :ablobcatheart: Personally, I prefer early return and ...
npub1ha2lruw3206t0vvrkum95nwc5vqj5rx4nyssfn3j4mjfwur3x8nsymk5hs (npub1ha2…k5hs) Great post
Personally, I prefer early return and think that it is widely used in Rust. This would change Name::new such that you `return` the error and at the end you have `Ok(…)` without the `else`.
Also, the Rust community expects `new` to return Self directly. Clippy used to suggest renaming `new` to `build` when returning a Result or Option of Self.
User::new is not doing anything. I would remove it and just use struct initialization instead.
Personally, I prefer early return and think that it is widely used in Rust. This would change Name::new such that you `return` the error and at the end you have `Ok(…)` without the `else`.
Also, the Rust community expects `new` to return Self directly. Clippy used to suggest renaming `new` to `build` when returning a Result or Option of Self.
User::new is not doing anything. I would remove it and just use struct initialization instead.