A lint to ensure all `.is_*()` methods are implemented would be nice. pub enum Bool True, False } impl Bool { pub fn is_true(&self) -> bool { *self == Bool::True } pub fn is_false(&self) -> bool { *self == Bool::False } }
-
Show this thread
-
The benefit I've found to implement `.is_*` methods is that you can check the return the kind of enums from methods without needing to perform extra imports. Makes for nice one-liners, and easier code to write if gen_pasta().is_tagliatelle() {println!("serving tagliatelle");}
1 reply 0 retweets 2 likesShow this thread -
Replying to @yoshuawuyts
What would probably be nice here is a custom derive that generates is_foo methods
3 replies 0 retweets 3 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.