rust-lang/rust-clippy

Lint `static mut FOO: T` where `T` has a safe counterpart

Open

#4070 aperta il 8 mag 2019

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Rust (1391 fork)batch import
A-lintL-correctnessgood first issue

Metriche repository

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

Descrizione

There is no reason to ever write static mut FOO: u32. Instead one should use static FOO: AtomicU32 which does the same thing, is just as efficient and requires no unsafe code.

We should lint this for at least

  • u8, u16, u32, u64
  • i8, i16, i32, i64
  • isize, usize
  • bool
  • *mut T

Guida contributor