{"action":"created","issue":{"url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/273","labels_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/273/labels{/name}","comments_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/273/comments","events_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/273/events","html_url":"https://github.com/Manishearth/rust-clippy/issues/273","id":104329314,"number":273,"title":"warn_self_convention and copy?","user":{"login":"wackywendell","id":245071,"avatar_url":"https://avatars.githubusercontent.com/u/245071?v=3","gravatar_id":"","url":"https://api.github.com/users/wackywendell","html_url":"https://github.com/wackywendell","followers_url":"https://api.github.com/users/wackywendell/followers","following_url":"https://api.github.com/users/wackywendell/following{/other_user}","gists_url":"https://api.github.com/users/wackywendell/gists{/gist_id}","starred_url":"https://api.github.com/users/wackywendell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wackywendell/subscriptions","organizations_url":"https://api.github.com/users/wackywendell/orgs","repos_url":"https://api.github.com/users/wackywendell/repos","events_url":"https://api.github.com/users/wackywendell/events{/privacy}","received_events_url":"https://api.github.com/users/wackywendell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-01T18:41:03Z","updated_at":"2015-09-01T18:42:28Z","closed_at":null,"body":"I recently got a `warn_self_convention` lint on a type that implements `Copy`, something like this:\r\n\r\n```rust\r\n#[derive(Copy)]\r\npub struct Color(pub u8, pub u8, pub u8);\r\n\r\nimpl Color {\r\n    /// Convert to a 3-tuple, from 0 to 1\r\n    pub fn as_floats(self) -> (f32, f32, f32) {\r\n        let Color(r,g,b) = self;\r\n        (\r\n            (r as f32) / (u8::max_value() as f32),\r\n            (g as f32) / (u8::max_value() as f32),\r\n            (b as f32) / (u8::max_value() as f32),\r\n        )\r\n    }\r\n```\r\n```\r\nsrc/palette.rs:43:22: 43:30 warning: methods called `as_*` usually take self by reference; consider choosing a less ambiguous name, #[warn(wrong_self_convention)] on by default\r\nsrc/palette.rs:43     pub fn as_floats(self) -> (f32, f32, f32) {\r\n```\r\n\r\nIt seems to me that types that implement `Copy` should be permitted to use pass-by-value instead of pass-by-reference for `as_`, `to_`, and other such methods."},"comment":{"url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/comments/136824068","html_url":"https://github.com/Manishearth/rust-clippy/issues/273#issuecomment-136824068","issue_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/273","id":136824068,"user":{"login":"birkenfeld","id":144359,"avatar_url":"https://avatars.githubusercontent.com/u/144359?v=3","gravatar_id":"","url":"https://api.github.com/users/birkenfeld","html_url":"https://github.com/birkenfeld","followers_url":"https://api.github.com/users/birkenfeld/followers","following_url":"https://api.github.com/users/birkenfeld/following{/other_user}","gists_url":"https://api.github.com/users/birkenfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/birkenfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birkenfeld/subscriptions","organizations_url":"https://api.github.com/users/birkenfeld/orgs","repos_url":"https://api.github.com/users/birkenfeld/repos","events_url":"https://api.github.com/users/birkenfeld/events{/privacy}","received_events_url":"https://api.github.com/users/birkenfeld/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T18:42:28Z","updated_at":"2015-09-01T18:42:28Z","body":"Agree. I'll see how easy it is to fix this."}}