• 7 Posts
  • 4 Comments
Joined 2 months ago
cake
Cake day: August 25th, 2026

help-circle

  • This is overall a very good list. There are probably just these two things which I actively disagree with.

    1. Using the #[non_exhaustive] attribute on every public enum seems like poor advice. Surely you want the caller to get an error when a new variant is added so they can deal with the new logic, rather than having that new stuff go into the fallback arm you had to write?
    2. Listing “code size” as the only exception to using dyn over a generic or impl is probably correct but maybe a bit misleading. Not needing to specify generics up a big chain of types isn’t just difference in text length, it also requires less monomorphisation. The way it’s written now, it sounds like if Google made the Rust standard library, std::fmt::Formatter would have a generic to hold the formatting thing, in addition to its lifetime.

    score 1 · canonical