keep-starknet-strange / cairo-lint

A collection of lints to catch common mistakes and improve your Cairo code.
21 stars 35 forks source link

Add `loop_match_pop_front` lint #6

Closed 0xLucqs closed 2 months ago

0xLucqs commented 3 months ago

Most likely due to legacy this pattern is quite common:

loop {
    match span.pop_front() {
        Option::Some(val) => do_something(val),
        Option::None => break,
    }
}

This is not good and can be rewrote to

for val in vec {
    do_something(val)
}