|
|
|
|
|
by klibertp
4684 days ago
|
|
You probably should fix this in your code too. As noted in this thread, that's not a proper way to use pattern matching. Anyone reading your code will be confused by this usage and that's not a good thing. It probably would be best to use this: match key.cmp(self.block_size) {
Equal => ..
Greater => ..
Less => ...
}
Which is much prettier (and more succinct) than both your original code and my example. You could also use a `cond!()` macro here, but that would mean you don't have an example for a blog post, so I think the above code is the best option. Thanks to kzrdude for posting. |
|