News for hackers. Stuff that matters.
Re:A Week with Mozilla's Rust by masklinn on Wednesday August 21, 2013 @04:53PM (#6253242)
> Also, does the compiler complain about my example above being not exhaustive?

Yes, although the error message isn't very good:

    crypto.rs:55:23: 59:5 error: non-exhaustive patterns: true not covered
    crypto.rs:55     let computed_key = match (key.len() > self.block_size, key.len() < self.block_size) {
    crypto.rs:56         (true, false) => self.zero_pad(self.hash(key).digest),
    crypto.rs:57         (false, true) => self.zero_pad(key),
    crypto.rs:58         (false, false) => key
    crypto.rs:59     };
    error: aborting due to previous error
And technically that's not a good thing, since (true, true) is not possible considering the input.
Re:A Week with Mozilla's Rust by kzrdude on Wednesday August 21, 2013 @06:16PM (#6253666)
it should be expressed with conditionals anyway.

    match key.len() {
    k if k > self.block_size => ..
    k if k < ... => ..
    k  => ...
or even

    match key.cmp(self.block_size) {
    Equal => ..
    Greater => ..
    Less => ...
Re:A Week with Mozilla's Rust by masklinn on Thursday August 22, 2013 @03:37AM (#6255673)
Absolutely.
Re:A Week with Mozilla's Rust by relistan on Thursday August 22, 2013 @05:33AM (#6256115)
Thanks for the tip!