From e98e664b42aceb245eaf801fc9ab726284693a68 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 2 Jul 2023 21:13:55 -0700 Subject: [PATCH] Resolve explicit_iter_loop pedantic clippy lint error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/../src/lexical/math.rs:339:19 | 339 | for xi in x.iter_mut() { | ^^^^^^^^^^^^ help: to write this more concisely, try: `&mut *x` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop = note: `-D clippy::explicit-iter-loop` implied by `-D clippy::pedantic` error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/../src/lexical/math.rs:485:19 | 485 | for xi in x.iter_mut() { | ^^^^^^^^^^^^ help: to write this more concisely, try: `&mut *x` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop --- src/lexical/math.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lexical/math.rs b/src/lexical/math.rs index 37cc1d24a..d7122bffa 100644 --- a/src/lexical/math.rs +++ b/src/lexical/math.rs @@ -336,7 +336,7 @@ mod small { pub fn imul(x: &mut Vec, y: Limb) { // Multiply iteratively over all elements, adding the carry each time. let mut carry: Limb = 0; - for xi in x.iter_mut() { + for xi in &mut *x { carry = scalar::imul(xi, y, carry); } @@ -482,7 +482,7 @@ mod small { let rshift = bits - n; let lshift = n; let mut prev: Limb = 0; - for xi in x.iter_mut() { + for xi in &mut *x { let tmp = *xi; *xi <<= lshift; *xi |= prev >> rshift;