Fix some lifetime problems and mutable borrows in pattern guards.