rust-lang/rust-clippy

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

Open

#4.070 geöffnet am 8. Mai 2019

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (1.391 Forks)batch import
A-lintL-correctnessgood first issue

Repository-Metriken

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

Beschreibung

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

Contributor Guide