Rust

Rust

By DeepSource

Found const declaration of atomic type RS-W1076

Anti-pattern

Atomic types provide shared-memory communication between threads, and cannot be constants. Consider changing const to static.

Examples

Bad practice

const GLOBAL_THREAD_COUNT: AtomicUsize = AtomicUsize::new(0);

Recommended

static GLOBAL_THREAD_COUNT: AtomicUsize = AtomicUsize::new(0);