Closed
Description
UPD:
minimal repro from @lqd :
#![feature(nll)]
#![allow(unused_variables)]
fn main() {
let _ = Some(0).as_ref().map(|ref a| true);
}
I got this warning:
warning: variable does not need to be mutable
--> src/toxcore/dht/server/mod.rs:363:32
|
363 | ping_map.retain(|&_pk, ref client|
| ----^^^^^^
| |
| help: remove this `mut`
While I don't see any mut
in the given code. The given patch fixed the warning but still I don't know why:
- ping_map.retain(|&_pk, ref client|
+ ping_map.retain(|_pk, client|
You may try on: tox-rs/tox@3d0ddf8 (you will have to enable NLL on your own).
Also seems like you don't highlight the correct site of the error in macros:
warning: variable does not need to be mutable
--> src/toxcore/state_format/old.rs:173:9
|
173 | / do_gen!(buf,
174 | | gen_le_u16!(0x0002) >>
175 | | gen_slice!(SECTION_MAGIC) >>
176 | | gen_le_u32!(DHT_MAGICAL as u32) >>
... |
180 | | gen_many_ref!(&self.0, |buf, node| PackedNode::to_bytes(node, buf))
181 | | )
| |_________^ help: remove this `mut`
|
= note: #[warn(unused_mut)] on by default
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
warning: variable does not need to be mutable
--> <gen_many_ref macros>:3:32
|
3 | Ok ( ( $ i , $ idx ) ) , | r , ref v | {
| ----^
| |
| help: remove this `mut`
I would like you to highlight gen_many_ref!.