{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/51830","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/51830/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/51830/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/51830/events","html_url":"https://github.com/rust-lang/rust/issues/51830","id":336031710,"node_id":"MDU6SXNzdWUzMzYwMzE3MTA=","number":51830,"title":"[NLL] variable does not need to be mutable","user":{"login":"kpp","id":467709,"node_id":"MDQ6VXNlcjQ2NzcwOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/467709?v=4","gravatar_id":"","url":"https://api.github.com/users/kpp","html_url":"https://github.com/kpp","followers_url":"https://api.github.com/users/kpp/followers","following_url":"https://api.github.com/users/kpp/following{/other_user}","gists_url":"https://api.github.com/users/kpp/gists{/gist_id}","starred_url":"https://api.github.com/users/kpp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kpp/subscriptions","organizations_url":"https://api.github.com/users/kpp/orgs","repos_url":"https://api.github.com/users/kpp/repos","events_url":"https://api.github.com/users/kpp/events{/privacy}","received_events_url":"https://api.github.com/users/kpp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-26T23:59:42Z","updated_at":"2018-06-27T05:33:01Z","closed_at":null,"author_association":"NONE","body":"I got this warning:\r\n\r\n```\r\nwarning: variable does not need to be mutable\r\n   --> src/toxcore/dht/server/mod.rs:363:32\r\n    |\r\n363 |         ping_map.retain(|&_pk, ref client|\r\n    |                                ----^^^^^^\r\n    |                                |\r\n    |                                help: remove this `mut`\r\n```\r\n\r\nWhile I don't see any `mut` in the given code. The given patch fixed the warning but still I don't know why:\r\n\r\n```diff\r\n-        ping_map.retain(|&_pk, ref client|\r\n+        ping_map.retain(|_pk, client|\r\n```\r\n\r\nYou may try on: https://github.com/tox-rs/tox/commit/3d0ddf86c32abb94c94eb44ff1388bab06f50bd2 (you will have to enable NLL on your own).\r\n\r\n\r\n\r\nAlso seems like you don't highlight the correct site of the error in macros:\r\n\r\n```\r\nwarning: variable does not need to be mutable\r\n   --> src/toxcore/state_format/old.rs:173:9\r\n    |\r\n173 | /         do_gen!(buf,\r\n174 | |             gen_le_u16!(0x0002) >>\r\n175 | |             gen_slice!(SECTION_MAGIC) >>\r\n176 | |             gen_le_u32!(DHT_MAGICAL as u32) >>\r\n...   |\r\n180 | |             gen_many_ref!(&self.0, |buf, node| PackedNode::to_bytes(node, buf))\r\n181 | |         )\r\n    | |_________^ help: remove this `mut`\r\n    |\r\n    = note: #[warn(unused_mut)] on by default\r\n    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)\r\n\r\nwarning: variable does not need to be mutable\r\n --> <gen_many_ref macros>:3:32\r\n  |\r\n3 | Ok ( ( $ i , $ idx ) ) , | r , ref v | {\r\n  |                                ----^\r\n  |                                |\r\n  |                                help: remove this `mut`\r\n```\r\n\r\nI would like you to highlight [gen_many_ref!](https://docs.rs/cookie-factory/0.2.4/src/cookie_factory/gen.rs.html#813-825)."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/400547884","html_url":"https://github.com/rust-lang/rust/issues/51830#issuecomment-400547884","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/51830","id":400547884,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDU0Nzg4NA==","user":{"login":"leonardo-m","id":22328461,"node_id":"MDQ6VXNlcjIyMzI4NDYx","avatar_url":"https://avatars0.githubusercontent.com/u/22328461?v=4","gravatar_id":"","url":"https://api.github.com/users/leonardo-m","html_url":"https://github.com/leonardo-m","followers_url":"https://api.github.com/users/leonardo-m/followers","following_url":"https://api.github.com/users/leonardo-m/following{/other_user}","gists_url":"https://api.github.com/users/leonardo-m/gists{/gist_id}","starred_url":"https://api.github.com/users/leonardo-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leonardo-m/subscriptions","organizations_url":"https://api.github.com/users/leonardo-m/orgs","repos_url":"https://api.github.com/users/leonardo-m/repos","events_url":"https://api.github.com/users/leonardo-m/events{/privacy}","received_events_url":"https://api.github.com/users/leonardo-m/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T05:33:01Z","updated_at":"2018-06-27T05:33:01Z","author_association":"NONE","body":"Dupe of #50897 ?"}}
{"actor":{"display_login":"leonardo-m"}}