Skip to content

Commit

Permalink
Resolve explicit_iter_loop pedantic clippy lint
Browse files Browse the repository at this point in the history
    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
  • Loading branch information
dtolnay committed Jul 3, 2023
1 parent fdb7800 commit e98e664
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lexical/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ mod small {
pub fn imul(x: &mut Vec<Limb>, 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);
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e98e664

Please sign in to comment.