Make the rust code a little more idiomatic. In this PR I focused on purely mechanical changes. The default rust linter now passes without complaint, although I have explicitly disabled some lints.
Changes
return is not usually needed as the last expression is returned. This accounts for the vast majority of the changes. (about 600)
There were instances of asomevar & 0xff where somevar is a u8. Here I deleted the & 0xff. (about 8 changes)
One if/else chain in fp4.rs was nested with the else clauses ever deeper; I flattened this to a 1-deep if/else if/else if/else chain.
I changed a few instances of m = m + 1 to m += 1. (about 10 changes)
Not included:
Linter errors about single letter variable names. This is disabled for all the files in lib.rs.
Linter errors about looping. In Rust it is relatively rare to use loops and explicit indices; map, zip and for_each are typically used instead. However such a conversion requires considerably more care and attention than removing surplus mut or return keywords so it seems wiser to keep these changes separate.
Testing
I have run python3 config64.py test with a number of curves.
Motivation
Make the rust code a little more idiomatic. In this PR I focused on purely mechanical changes. The default rust linter now passes without complaint, although I have explicitly disabled some lints.
Changes
return
is not usually needed as the last expression is returned. This accounts for the vast majority of the changes. (about 600)somevar & 0xff
wheresomevar
is a u8. Here I deleted the& 0xff
. (about 8 changes)m = m + 1
tom += 1
. (about 10 changes)Not included:
mut
orreturn
keywords so it seems wiser to keep these changes separate.Testing
I have run
python3 config64.py test
with a number of curves.