From 3e2dc92b223d932d36f03c9fd66ada2a81aa8148 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 5 Feb 2022 16:46:29 +0100 Subject: [PATCH] Avoid destructuring assignment Somehow the nightly compiler just lets you do this without needing to opt in to the unstable feature. --- src/wrapper/util.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/wrapper/util.rs b/src/wrapper/util.rs index 5a76b75c..3c8f9d07 100644 --- a/src/wrapper/util.rs +++ b/src/wrapper/util.rs @@ -26,14 +26,16 @@ static A: assert_no_alloc::AllocDisabler = assert_no_alloc::AllocDisabler; /// A Rabin fingerprint based string hash for parameter ID strings. pub fn hash_param_id(id: &str) -> u32 { - let mut overflow; - let mut overflow2; let mut has_overflown = false; let mut hash: u32 = 0; for char in id.bytes() { - (hash, overflow) = hash.overflowing_mul(31); - (hash, overflow2) = hash.overflowing_add(char as u32); - has_overflown |= overflow || overflow2; + // No destructuring assignments on stable Rust yet, somehow that just works on nightly + // without needing to add a feature attribute + let (hash2, overflow2) = hash.overflowing_mul(31); + let (hash3, overflow3) = hash2.overflowing_add(char as u32); + + hash = hash3; + has_overflown |= overflow2 || overflow3; } if has_overflown {