From 5b369f6ab5cdef56f780f66b4a4af6b552e34d6d Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 2 Mar 2022 02:03:57 +0100 Subject: [PATCH] Re-introduce destructuring assignments Now that that's landed on the stable compiler. --- src/wrapper/util.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/wrapper/util.rs b/src/wrapper/util.rs index 12fc4644..8d4cb315 100644 --- a/src/wrapper/util.rs +++ b/src/wrapper/util.rs @@ -10,16 +10,14 @@ 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() { - // 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; + (hash, overflow) = hash.overflowing_mul(31); + (hash, overflow2) = hash.overflowing_add(char as u32); + has_overflown |= overflow || overflow2; } if has_overflown {