Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I want to be exhaustive on my error checks. I want my match to fail if a new variant is added, so that I can handle it (even if it's just to ignore it). A big reason why refactors can be so fearless in Rust is thanks to exhaustive checks. While the 'refactor' part applies mostly to your own, 1st party code, it's also useful when upgrading 3rd party dependencies.

For this reason I personally don't like `#[non_exhaustive]`. I don't expect my code to keep compiling when I upgrade the minor version of my dependencies, and as long as the reason is simple, like a new enum variant was added, then I'm happy that it errored and will happily fix it.

This perfectionist attitude towards semver is why so many projects get stuck forever at v0. https://0ver.org/



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: