3 ms·
Not every use of unwrap is a bug. For example a regex library returns Result on regex construction because the passed regex could be invalid. But if you constru
by pkolaczk 4y ago
Not every use of unwrap is a bug. For example a regex library returns Result on regex construction because the passed regex could be invalid. But if you construct the regex yourself, from a hard coded string, you know it is correct. Then you just use unwrap and it is ok.
- pjlegato 4y agoPeople don't write bugs on purpose. That hardcoded string that you know is correct is sometimes not actually correct.
- Georgelemental 4y agoAnd crashing early is often the best solution in that case.