rust-lang/rust-clippy

transmute_ptr_to_ref suggestion doesn't with some outer expression types

Open

#1754 aperta il 12 mag 2017

Vedi su GitHub
 (1 commento) (0 reazioni) (1 assegnatario)Rust (1391 fork)batch import
C-bugT-middlegood first issue

Metriche repository

Star
 (10.406 star)
Metriche merge PR
 (Merge medio 19g 22h) (113 PR mergiate in 30 g)

Descrizione

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

Guida contributor