1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-31 09:24:31 +03:00

ci: Update clippy to 1.66 and fix new warnings

This commit is contained in:
Quentin Gliech
2022-12-16 17:51:40 +01:00
parent 5b28c1e6ce
commit ca112d45e1
17 changed files with 25 additions and 25 deletions

View File

@ -90,10 +90,10 @@ impl TokenType {
.map(char::from)
.collect();
let base = format!("{}_{}", self.prefix(), random_part);
let base = format!("{prefix}_{random_part}", prefix = self.prefix());
let crc = CRC.checksum(base.as_bytes());
let crc = base62_encode(crc);
format!("{}_{}", base, crc)
format!("{base}_{crc}")
}
/// Check the format of a token and determine its type
@ -126,7 +126,7 @@ impl TokenType {
prefix: prefix.to_owned(),
})?;
let base = format!("{}_{}", token_type.prefix(), random_part);
let base = format!("{prefix}_{random_part}", prefix = token_type.prefix());
let expected_crc = CRC.checksum(base.as_bytes());
let expected_crc = base62_encode(expected_crc);
if crc != expected_crc {
@ -164,7 +164,7 @@ fn base62_encode(mut num: u32) -> String {
num /= 62;
}
format!("{:0>6}", res)
format!("{res:0>6}")
}
const CRC: Crc<u32> = Crc::<u32>::new(&CRC_32_ISO_HDLC);