rust-lang/rust-clippy

transmute_ptr_to_ref suggestion doesn't with some outer expression types

Open

#1.754 geöffnet am 12. Mai 2017

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (1 zugewiesene Person)Rust (1.391 Forks)batch import
C-bugT-middlegood first issue

Repository-Metriken

Stars
 (10.406 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 19T 22h) (113 gemergte PRs in 30 T)

Beschreibung

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