| ▲ | speed_spread 2 hours ago | |||||||||||||||||||||||||||||||
Pet peeve: unwrap() should be deprecated and renamed or_panic(). More consistent with the rest of stdlib methods and appropriately scarier. | ||||||||||||||||||||||||||||||||
| ▲ | wrs 31 minutes ago | parent | next [-] | |||||||||||||||||||||||||||||||
That's kind of what I'm saying with the blind spot comment. The words "unwrap" and "expect" should be just as much a scary red flag as the word "panic", but for some reason it seems a lot of people don't see them that way. | ||||||||||||||||||||||||||||||||
| ▲ | echelon an hour ago | parent | prev [-] | |||||||||||||||||||||||||||||||
A lot of stuff should be done about the awful unwrap family of methods. A few ideas: - It should not compile in production Rust code - It should only be usable within unsafe blocks - It should require explicit "safe" annotation from the engineer. Though this is subject to drift and become erroneous. - It should be possible to ban the use of unsafe in dependencies and transitive dependencies within Cargo. | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||