Closed BastiDood closed 2 years ago
Thank you! Just want to let you know that it will be a few days before I get to review this.
Looks great! const
has come a long way. It's getting pretty close to being able to generate the static tables from build.rs
at compile time.
(As a matter of taste, I made most Self aliases more explicit, again, at least where it's not significantly more verbose. Gives a bit of orientation. I'll reconsider if the clippy lint becomes warn by default.)
As a matter of taste, I made most Self aliases more explicit, again, at least where it's not significantly more verbose. Gives a bit of orientation. I'll reconsider if the clippy lint becomes warn by default.
Sure! I have no qualms against this. Thanks for the merge!
... well, okay, maybe not all the things. Methods that take in
&mut self
are not yet eligible forconst
-ification. This PR does manage toconst
-ify many things, though. 🥳const
-ified MethodsFor most methods, adding a
const
declaration was trivial since the compiler already supported the operations within. The rest required some extra massaging aroundconst
traits—or lack thereof.In particular, many
Bitboard
operations may actually beconst
-ified if it weren't for non-const
traits such asFrom
,Into
,Add
,Sub
,BitOr
,BitAnd
, etc. To resolve this, I've added*_const
variants for these operations in theimpl Bitboard
itself.The
const
-ification cascaded upwards to all dependentstruct
s from that point forward. It was actually fascinating to see how most of the tests immediately finish.MSRV Bump
All the
const
-ification required one MSRV bump from1.60
to1.61
. The specific feature for whichconst
stabilization is required is thepointer::offset
method.Clippy: Prefer
Self
AliasWhile I was fixing up the methods, I also decided to use the
Self
alias in various methods wherever possible (instead of explicitly naming the concreteSelf
). This should lessen unnecessary repetition ofstruct
names.