What is Nostr?
Mo :ferris: :tux: @ FOSDEM /
npub1j7f…mapy
2023-08-08 07:42:00
in reply to nevent1q…cy79

Mo :ferris: :tux: @ FOSDEM on Nostr: npub1ha2lr…mk5hs Great post :ablobcatheart: Personally, I prefer early return and ...

npub1ha2lruw3206t0vvrkum95nwc5vqj5rx4nyssfn3j4mjfwur3x8nsymk5hs (npub1ha2…k5hs) Great post :ablobcatheart:

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.
Author Public Key
npub1j7fc87rk03whjh72mphc9hrm8zecfsdywdcscsesznwzcrasudvs75mapy