chiark / gitweb /
dice: Tidy remprop handling
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Apr 2022 11:54:37 +0000 (12:54 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Apr 2022 21:43:43 +0000 (22:43 +0100)
commite9e6a9aaf87ae42e591ddd03ba7aa55b4a45b026
tree452c89c2149195d6debf7f5b5ac49d7268998d1c
parentebbc4c08e06e1da833dfe7b1387f44bfc6a8982b
dice: Tidy remprop handling

This macro was overkill.  It existed mostly to avoid uselessly
comparing the remaining duration with 0 and storing None when it was
there already.  That's a daft microoptimisation.

Doing it this way instead lets us only do the remprop calculation when
it's wanted, and it will let us provide a way to set cooldown_expires
to None if and when we have &mut State and can see it's timed out.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/dice.rs