Skip to content

Commit 160ab5e

Browse files
committed
Fix capitalization of lint message
1 parent afa010e commit 160ab5e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_lints/src/slice_as_bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'tcx> LateLintPass<'tcx> for SliceAsBytes {
4444
let range = snippet_with_applicability(cx,index.span,"..",&mut applicability);
4545
let sugg = format!("&{stringish}.as_bytes()[{range}]");
4646
let type_name = if is_str {"str"} else {"String"};
47-
let msg = format!("Slicing a {type_name} before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking");
47+
let msg = format!("slicing a {type_name} before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking");
4848
let sp = expr.span;
4949
span_lint_and_sugg(cx,SLICE_AS_BYTES ,sp , &msg, "try",sugg ,applicability);
5050
}

tests/ui/slice_as_bytes.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
error: Slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
1+
error: slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
22
--> $DIR/slice_as_bytes.rs:9:17
33
|
44
LL | let bytes = s[1..5].as_bytes();
55
| ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]`
66
|
77
= note: `-D clippy::slice-as-bytes` implied by `-D warnings`
88

9-
error: Slicing a String before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
9+
error: slicing a String before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
1010
--> $DIR/slice_as_bytes.rs:10:17
1111
|
1212
LL | let bytes = string[1..].as_bytes();
1313
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]`
1414

15-
error: Slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
15+
error: slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
1616
--> $DIR/slice_as_bytes.rs:11:17
1717
|
1818
LL | let bytes = "consectetur adipiscing"[..=5].as_bytes();

0 commit comments

Comments
 (0)