Fix 1.66 Clippy warnings (#3178)

1.66 release speeds up compile times for over 10% according to tests.

Also its Clippy finds plenty of old nits in our code:
* useless conversion, `foo as u8` where `foo: u8` and similar, removed
`as u8` and similar
* useless references and dereferenced (that were automatically adjusted
by the compiler), removed various `&` and `*`
* bool -> u8 conversion via `if/else`, changed to `u8::from`
* Map `.iter()` calls where only values were used, changed to
`.values()` instead

Standing out lints:
* `Eq` is missing in our protoc generated structs. Silenced, does not
seem crucial for us.
* `fn default` looks like the one from `Default` trait, so I've
implemented that instead and replaced the `dummy_*` method in tests with
`::default()` invocation
* Clippy detected that
```
if retry_attempt < u32::MAX {
    retry_attempt += 1;
}
```
is a saturating add and proposed to replace it.
This commit is contained in:
Kirill Bulatov
2022-12-22 14:27:48 +02:00
committed by GitHub
parent f5f1197e15
commit fca25edae8
39 changed files with 123 additions and 152 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ impl ServerSecret {
Self {
iterations: 4096,
salt_base64: base64::encode(&mocked_salt),
salt_base64: base64::encode(mocked_salt),
stored_key: ScramKey::default(),
server_key: ScramKey::default(),
doomed: true,
@@ -68,7 +68,7 @@ impl ServerSecret {
Some(Self {
iterations,
salt_base64: base64::encode(&salt),
salt_base64: base64::encode(salt),
stored_key: password.client_key().sha256(),
server_key: password.server_key(),
doomed: false,