{"action":"opened","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/rust-clippy/issues/2721","repository_url":"https://api.github.com/repos/rust-lang-nursery/rust-clippy","labels_url":"https://api.github.com/repos/rust-lang-nursery/rust-clippy/issues/2721/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/rust-clippy/issues/2721/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/rust-clippy/issues/2721/events","html_url":"https://github.com/rust-lang-nursery/rust-clippy/issues/2721","id":319847274,"number":2721,"title":"False positive `map_clone` lint on coercion map.","user":{"login":"vorner","id":11783500,"avatar_url":"https://avatars2.githubusercontent.com/u/11783500?v=4","gravatar_id":"","url":"https://api.github.com/users/vorner","html_url":"https://github.com/vorner","followers_url":"https://api.github.com/users/vorner/followers","following_url":"https://api.github.com/users/vorner/following{/other_user}","gists_url":"https://api.github.com/users/vorner/gists{/gist_id}","starred_url":"https://api.github.com/users/vorner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vorner/subscriptions","organizations_url":"https://api.github.com/users/vorner/orgs","repos_url":"https://api.github.com/users/vorner/repos","events_url":"https://api.github.com/users/vorner/events{/privacy}","received_events_url":"https://api.github.com/users/vorner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-03T09:29:20Z","updated_at":"2018-05-03T09:29:20Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hello\r\n\r\nI have a `Vec<String>` and I want `HashSet<&str>`, which I do with this code:\r\n\r\n```rust\r\nvec.iter().map(|v| -> &str { v }).collect::<HashSet<&str>>()\r\n```\r\n\r\nThe map there is the place where rust can coerce `&String` into `&str`.\r\n\r\nHowever, clippy suggests to use `.cloned` with the `map_clone` lint. This seems wrong for several reasons:\r\n\r\n* What I do is not cloning (there's a copy of reference and a coercion)\r\n* The proposed solution doesn't compile (because `.cloned()` still produces iterator over `&String`).\r\n\r\nThis is clippy 0.0.195.\r\n"}}
{"actor":{"display_login":"vorner"}}