Skip to content

Commit cbe2de7

Browse files
committed
Address small nit
1 parent 4562040 commit cbe2de7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/loops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc::middle::ty;
99
use rustc_front::hir::*;
1010
use rustc_front::intravisit::{Visitor, walk_expr, walk_block, walk_decl};
1111
use std::borrow::Cow;
12-
use std::collections::{HashSet, HashMap};
12+
use std::collections::HashMap;
1313

1414
use utils::{snippet, span_lint, get_parent_expr, match_trait_method, match_type, in_external_macro, expr_block,
1515
span_help_and_lint, is_integer_literal, get_enclosing_block, span_lint_and_then, walk_ptrs_ty};
@@ -353,7 +353,7 @@ fn check_for_loop_range(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Expr, ex
353353
let (indexed, indexed_extent) = visitor.indexed
354354
.into_iter()
355355
.next()
356-
.expect("Len was nonzero, but no contents found");
356+
.unwrap_or_else(|| unreachable!() /* len == 1 */);
357357

358358
// ensure that the indexed variable was declared before the loop, see #601
359359
let pat_extent = cx.tcx.region_maps.var_scope(pat.id);

0 commit comments

Comments
 (0)