diff --git a/src/array_indexing.rs b/src/array_indexing.rs
index 3c6acb932843..ece66ae20a23 100644
--- a/src/array_indexing.rs
+++ b/src/array_indexing.rs
@@ -83,7 +83,7 @@ impl LateLintPass for ArrayIndexing {
eval_const_expr_partial(cx.tcx, end, ExprTypeChecked, None)).map(|v| v.ok());
if let Some((start, end)) = to_const_range(start, end, range.limits, size) {
- if start >= size || end >= size {
+ if start > size || end > size {
utils::span_lint(cx,
OUT_OF_BOUNDS_INDEXING,
e.span,
@@ -109,14 +109,11 @@ impl LateLintPass for ArrayIndexing {
}
}
-/// Returns an option containing a tuple with the start and end (exclusive) of the range
-///
-/// Note: we assume the start and the end of the range are unsigned, since array slicing
-/// works only on usize
+/// Returns an option containing a tuple with the start and end (exclusive) of the range.
fn to_const_range(start: Option