Push Ifs Up And Fors Down Nov 15, 2023 A short note on two related rules of thumb. Push Ifs Up If there’s an if condition inside a function, consider if it could be moved to the caller instead: // GOOD fn frobnicate(walrus: Walrus) { ... } // BAD fn frobnicate(walrus: Option<Walrus>) { let walrus = match walrus { Some(it) => it, None => return, }; ... } As in the example above, this often comes up