rust-lang/rust-clippy

transmute_ptr_to_ref suggestion doesn't with some outer expression types

Open

#1,754 opened on May 12, 2017

View on GitHub
 (1 comment) (0 reactions) (1 assignee)Rust (1,391 forks)batch import
C-bugT-middlegood first issue

Repository metrics

Stars
 (10,406 stars)
PR merge metrics
 (Avg merge 19d 22h) (113 merged PRs in 30d)

Description

clippy suggests the following replacement

-                mem::transmute::<*mut c_void, &mut Box<FnMut(&Button)>>(data)(&button)
+                &mut *(data as *mut Box<FnMut(&Button)>)(&button)

but we should suggest parens around the &mut *...

bonus points if the parens only appear if necessary

Contributor guide