And declaring a static variable inside a function, even if in main, smells.
static mut COUNTER: u32 = 0;
If on 2024 edition, you will additionally need
#![allow(static_mut_refs)]
And declaring a static variable inside a function, even if in main, smells.