If you put an underscore as the first character in the variable name, that tells the compiler that the variable may go unused and you're okay with that. E.g.
The issue is related to the binding being reassigned then never used. It's happening because they're using code generation where the final loop doesn't need to assign. (but previous loops use the assignment at the loop start. Just throwing all that in a function and adding the warning suppression fixes it.
The problem seems to be the last last = last_mut.cdr;, since you don't use it on the last iteration.
I'd personally do that with a comment until you (or someone else) can fix it, perhaps with a linter instruction at some point. That noop code should be eliminated during the optimization step, so it shouldn't hurt performance or anything.
Edit: don't do this, just prefix the variable with an underscore as someone else mentioned.
I'm not sure if the rules are different with macros, I've never written one but this lint is generally caused because you set a var to a value and then overwrite that value before you use it. e.g.
let mut a = 1;
a = 2;
println!("{}", a);
This will throw the same warning because 1 is never used, this could've just been:
let a = 2;
println!("{}", a);
So first I'd double check that I NEED last at all. Maybe try:
cargo clippy
See if it can tell you how to fix it.
If that doesn't work, it's sometimes necessary to skip certain lints. E.g. if you make a library, most of the code will be flagged as dead code because it isn't used and you can use an #[allow(dead_code)] to stop the linter warning. You might be able to use #[allow(this_linting_rule)].
warning: dereferencing a tuple pattern where every element takes a reference
--> src/lib.rs:13:9
|
13 | &Some(ref cons_rc) => {
| ^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
= note: `#[warn(clippy::needless_borrowed_reference)]` on by default
help: try removing the `&` and `ref` parts
|
13 - &Some(ref cons_rc) => {
13 + Some(cons_rc) => {
|