]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/indexing_slicing.rs
Rollup merge of #83092 - petrochenkov:qspan, r=estebank
[rust.git] / clippy_lints / src / indexing_slicing.rs
index 741195f3b10d5eee8f1da6577ec18919b95574b3..c919ec097a2393a5c3c5ea1189e68278c7b54dfe 100644 (file)
@@ -132,13 +132,13 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
                 }
 
                 let help_msg = match (range.start, range.end) {
-                    (None, Some(_)) => "Consider using `.get(..n)`or `.get_mut(..n)` instead",
-                    (Some(_), None) => "Consider using `.get(n..)` or .get_mut(n..)` instead",
-                    (Some(_), Some(_)) => "Consider using `.get(n..m)` or `.get_mut(n..m)` instead",
+                    (None, Some(_)) => "consider using `.get(..n)`or `.get_mut(..n)` instead",
+                    (Some(_), None) => "consider using `.get(n..)` or .get_mut(n..)` instead",
+                    (Some(_), Some(_)) => "consider using `.get(n..m)` or `.get_mut(n..m)` instead",
                     (None, None) => return, // [..] is ok.
                 };
 
-                span_lint_and_help(cx, INDEXING_SLICING, expr.span, "slicing may panic.", None, help_msg);
+                span_lint_and_help(cx, INDEXING_SLICING, expr.span, "slicing may panic", None, help_msg);
             } else {
                 // Catchall non-range index, i.e., [n] or [n << m]
                 if let ty::Array(..) = ty.kind() {
@@ -153,9 +153,9 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
                     cx,
                     INDEXING_SLICING,
                     expr.span,
-                    "indexing may panic.",
+                    "indexing may panic",
                     None,
-                    "Consider using `.get(n)` or `.get_mut(n)` instead",
+                    "consider using `.get(n)` or `.get_mut(n)` instead",
                 );
             }
         }