{"action":"closed","issue":{"url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/930","repository_url":"https://api.github.com/repos/Manishearth/rust-clippy","labels_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/930/labels{/name}","comments_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/930/comments","events_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/930/events","html_url":"https://github.com/Manishearth/rust-clippy/issues/930","id":154909400,"number":930,"title":"Lint unnecessary transmutes from ref to ptr","user":{"login":"crumblingstatue","id":1521976,"avatar_url":"https://avatars.githubusercontent.com/u/1521976?v=3","gravatar_id":"","url":"https://api.github.com/users/crumblingstatue","html_url":"https://github.com/crumblingstatue","followers_url":"https://api.github.com/users/crumblingstatue/followers","following_url":"https://api.github.com/users/crumblingstatue/following{/other_user}","gists_url":"https://api.github.com/users/crumblingstatue/gists{/gist_id}","starred_url":"https://api.github.com/users/crumblingstatue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crumblingstatue/subscriptions","organizations_url":"https://api.github.com/users/crumblingstatue/orgs","repos_url":"https://api.github.com/users/crumblingstatue/repos","events_url":"https://api.github.com/users/crumblingstatue/events{/privacy}","received_events_url":"https://api.github.com/users/crumblingstatue/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Manishearth/rust-clippy/labels/E-easy","name":"E-easy","color":"009800"},{"url":"https://api.github.com/repos/Manishearth/rust-clippy/labels/L-enhancement","name":"L-enhancement","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-05-15T13:44:23Z","updated_at":"2016-06-27T15:19:00Z","closed_at":"2016-06-27T15:19:00Z","body":"We already have `transmute_ptr_to_ref`, but we could also lint the opposite case.\r\n\r\n```\r\n fn type_(evt: &mut sfEvent) -> *mut sfEventType {\r\n -    unsafe { ::std::mem::transmute(evt) }\r\n +    evt as *mut _ as _\r\n  }\r\n```\r\n\r\n```\r\n fn size(evt: &mut sfEvent) -> event::Event {\r\n -    let e: *mut sfSizeEvent = unsafe { ::std::mem::transmute(evt) };\r\n +    let e: *mut sfSizeEvent = evt as *mut _ as _;\r\n      unsafe { event::Resized { width: (*e).width, height: (*e).height } }\r\n  }\r\n```\r\n\r\nRef https://github.com/jeremyletang/rust-sfml/commit/d84ce7543ed8af55c8c85c346c72c3204e7a1890?diff=unified\r\n\r\nEdit: The `as _` trick for the second `as` only works on 1.10 nightly (https://github.com/rust-lang/rust/issues/33657)"}}
{"actor":{"display_login":"oli-obk"}}