2 ms·
Guilty as charged, and honestly, I wish I had a good mechanism/function call to separate "I'm just being lazy here, this is a TODO" from "actually, this should
by deathanatos 4y ago
Guilty as charged, and honestly, I wish I had a good mechanism/function call to separate "I'm just being lazy here, this is a TODO" from "actually, this should never happen.
.map_err(|_| unimplemented!()).unwrap()
or something. (I hope you get the gist of that, as I'm 99% sure that code doesn't compile. Error(E) -> !, Ok(T) -> T)
- burntsushi 4y agoJust write 'expect("FIXME")' or similar. :-)
- deathanatos 4y agoI've thought about this, it just requires some effort, particular if you want the result to be grep-able. (And, in >1 person groups, then it requires coordination, although perhaps also all of those should be remove prior to committing…)
- burntsushi 4y agoI think anything you do here is going to require some kind of effort. Personally, I think it would be better to stop thinking about 'unwrap()' as its own special thing. 'unwrap()' is just a common manifestation of something much more fundamental: runtime invariants. Think about those.
- dureuill 4y agoYou could go: result.unwrap_or_else(|| todo !()) (unimplemented! is for missing functionality in a given version, todo! is for missing functionality during development) But using unwrap for these kinds of TODO is ok, code review won't let unjustified unwraps to pass