[Media] Guess how long it took to spot this little syntactical screwup?
![[Media] Guess how long it took to spot this little syntactical screwup?](https://i.redd.it/88cwct39vghg1.png)
I must have read past this line dozens of times while trying to track down the associated bug. The line was so simple, it hardly warranted inspection, right?
In fairness to myself, the Git history tells me that this line was written in my first month with Rust, when I was still learning the syntax by typing things and letting the compiler yell at me. But unfortunately for me, for _ in [0..N] { is completely valid syntax, even it it is just an exotic way of writing {.
And while I'm making excuses for myself, MAX_ATTEMPTS is only 3 and this loop returns on the first iteration 99.9% of the time, so my non-looping loop did a remarkably good job of approximating the correct behaviour.