diff --git a/Cargo.toml b/Cargo.toml index 5e9b88d8..309309e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ rust_2018_idioms = "deny" [lints.clippy] panic = "deny" +unreachable = "deny" expect_used = "deny" unwrap_used = "deny" mem_forget = "deny" diff --git a/src/megolm/inbound_group_session.rs b/src/megolm/inbound_group_session.rs index f8597b52..3c535fcc 100644 --- a/src/megolm/inbound_group_session.rs +++ b/src/megolm/inbound_group_session.rs @@ -182,6 +182,7 @@ impl InboundGroupSession { // // After that we compare the raw ratchet bytes in constant time. + #[allow(clippy::unreachable)] if self.config != other.config || self.signing_key != other.signing_key { // Short circuit if session configs differ or the signing keys // differ. This is comparing public key material. diff --git a/src/megolm/ratchet.rs b/src/megolm/ratchet.rs index 21ca32db..84b96e8f 100644 --- a/src/megolm/ratchet.rs +++ b/src/megolm/ratchet.rs @@ -109,22 +109,24 @@ struct RatchetParts<'a> { impl<'a> RatchetParts<'a> { fn update(&'a mut self, from: usize, to: usize) { + #[allow(clippy::unreachable)] let from = match from { 0 => &self.r_0, 1 => &self.r_1, 2 => &self.r_2, 3 => &self.r_3, - _ => unreachable!(), + _ => unreachable!("We only have 4 ratchet parts"), }; let result = from.hash(ADVANCEMENT_SEEDS[to]); + #[allow(clippy::unreachable)] let to = match to { 0 => &mut self.r_0, 1 => &mut self.r_1, 2 => &mut self.r_2, 3 => &mut self.r_3, - _ => unreachable!(), + _ => unreachable!("We only have 4 ratchet parts"), }; to.update(&result.into_bytes());