Skip to content

Commit 4134e60

Browse files
committed
Update Unicode lint tests
1 parent 6d9ee9e commit 4134e60

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

clippy_lints/src/unicode.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ declare_clippy_lint! {
5656
///
5757
/// **Known problems** None.
5858
///
59-
/// **Example:** You may not see it, but “à” and “à” aren't the same string. The
59+
/// **Example:** You may not see it, but "à"" and "à"" aren't the same string. The
6060
/// former when escaped is actually `"a\u{300}"` while the latter is `"\u{e0}"`.
6161
pub UNICODE_NOT_NFC,
6262
pedantic,
63-
"using a unicode literal not in NFC normal form (see [unicode tr15](http://www.unicode.org/reports/tr15/) for further information)"
63+
"using a Unicode literal not in NFC normal form (see [Unicode tr15](http://www.unicode.org/reports/tr15/) for further information)"
6464
}
6565

6666
declare_lint_pass!(Unicode => [ZERO_WIDTH_SPACE, NON_ASCII_LITERAL, UNICODE_NOT_NFC]);
6767

68-
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Unicode {
69-
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
68+
impl LateLintPass<'_, '_> for Unicode {
69+
fn check_expr(&mut self, cx: &LateContext<'_, '_>, expr: &'_ Expr) {
7070
if let ExprKind::Lit(ref lit) = expr.node {
7171
if let LitKind::Str(_, _) = lit.node {
7272
check_str(cx, lit.span, expr.hir_id)
@@ -122,7 +122,7 @@ fn check_str(cx: &LateContext<'_, '_>, span: Span, id: HirId) {
122122
cx,
123123
UNICODE_NOT_NFC,
124124
span,
125-
"non-nfc unicode sequence detected",
125+
"non-NFC Unicode sequence detected",
126126
"consider replacing the string with",
127127
string.nfc().collect::<String>(),
128128
Applicability::MachineApplicable,

tests/ui/unicode.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ error: zero-width space detected
22
--> $DIR/unicode.rs:3:12
33
|
44
LL | print!("Here >​< is a ZWS, and ​another");
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >/u{200B}< is a ZWS, and /u{200B}another"`
66
|
77
= note: `-D clippy::zero-width-space` implied by `-D warnings`
88

9-
error: non-nfc unicode sequence detected
9+
error: non-NFC Unicode sequence detected
1010
--> $DIR/unicode.rs:9:12
1111
|
1212
LL | print!("̀àh?");
13-
| ^^^^^
13+
| ^^^^^ help: consider replacing the string with: `"̀àh?"`
1414
|
1515
= note: `-D clippy::unicode-not-nfc` implied by `-D warnings`
1616

1717
error: literal non-ASCII character detected
1818
--> $DIR/unicode.rs:15:12
1919
|
2020
LL | print!("Üben!");
21-
| ^^^^^^^
21+
| ^^^^^^^ help: consider replacing the string with: `"/u{dc}ben!"`
2222
|
2323
= note: `-D clippy::non-ascii-literal` implied by `-D warnings`
2424

0 commit comments

Comments
 (0)