Skip to content

Commit 3e1e0c9

Browse files
committed
redundant-static-lifetimes: make lint adhere to lint message convention
1 parent 5d69ca5 commit 3e1e0c9

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

clippy_lints/src/redundant_static_lifetimes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ impl EarlyLintPass for RedundantStaticLifetimes {
8686
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
8787
if !item.span.from_expansion() {
8888
if let ItemKind::Const(_, ref var_type, _) = item.kind {
89-
self.visit_type(var_type, cx, "Constants have by default a `'static` lifetime");
89+
self.visit_type(var_type, cx, "constants have by default a `'static` lifetime");
9090
// Don't check associated consts because `'static` cannot be elided on those (issue
9191
// #2438)
9292
}
9393

9494
if let ItemKind::Static(ref var_type, _, _) = item.kind {
95-
self.visit_type(var_type, cx, "Statics have by default a `'static` lifetime");
95+
self.visit_type(var_type, cx, "statics have by default a `'static` lifetime");
9696
}
9797
}
9898
}

tests/ui/redundant_static_lifetimes.stderr

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,96 @@
1-
error: Constants have by default a `'static` lifetime
1+
error: constants have by default a `'static` lifetime
22
--> $DIR/redundant_static_lifetimes.rs:8:17
33
|
44
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
55
| -^^^^^^^---- help: consider removing `'static`: `&str`
66
|
77
= note: `-D clippy::redundant-static-lifetimes` implied by `-D warnings`
88

9-
error: Constants have by default a `'static` lifetime
9+
error: constants have by default a `'static` lifetime
1010
--> $DIR/redundant_static_lifetimes.rs:12:21
1111
|
1212
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
1313
| -^^^^^^^---- help: consider removing `'static`: `&str`
1414

15-
error: Constants have by default a `'static` lifetime
15+
error: constants have by default a `'static` lifetime
1616
--> $DIR/redundant_static_lifetimes.rs:14:32
1717
|
1818
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
1919
| -^^^^^^^---- help: consider removing `'static`: `&str`
2020

21-
error: Constants have by default a `'static` lifetime
21+
error: constants have by default a `'static` lifetime
2222
--> $DIR/redundant_static_lifetimes.rs:14:47
2323
|
2424
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
2525
| -^^^^^^^---- help: consider removing `'static`: `&str`
2626

27-
error: Constants have by default a `'static` lifetime
27+
error: constants have by default a `'static` lifetime
2828
--> $DIR/redundant_static_lifetimes.rs:16:17
2929
|
3030
LL | const VAR_SIX: &'static u8 = &5;
3131
| -^^^^^^^--- help: consider removing `'static`: `&u8`
3232

33-
error: Constants have by default a `'static` lifetime
33+
error: constants have by default a `'static` lifetime
3434
--> $DIR/redundant_static_lifetimes.rs:18:20
3535
|
3636
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
3737
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
3838

39-
error: Constants have by default a `'static` lifetime
39+
error: constants have by default a `'static` lifetime
4040
--> $DIR/redundant_static_lifetimes.rs:20:19
4141
|
4242
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
4343
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
4444

45-
error: Constants have by default a `'static` lifetime
45+
error: constants have by default a `'static` lifetime
4646
--> $DIR/redundant_static_lifetimes.rs:22:19
4747
|
4848
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
4949
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
5050

51-
error: Constants have by default a `'static` lifetime
51+
error: constants have by default a `'static` lifetime
5252
--> $DIR/redundant_static_lifetimes.rs:24:19
5353
|
5454
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
5555
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
5656

57-
error: Statics have by default a `'static` lifetime
57+
error: statics have by default a `'static` lifetime
5858
--> $DIR/redundant_static_lifetimes.rs:26:25
5959
|
6060
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR Consider removing 'static.
6161
| -^^^^^^^---- help: consider removing `'static`: `&str`
6262

63-
error: Statics have by default a `'static` lifetime
63+
error: statics have by default a `'static` lifetime
6464
--> $DIR/redundant_static_lifetimes.rs:30:29
6565
|
6666
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
6767
| -^^^^^^^---- help: consider removing `'static`: `&str`
6868

69-
error: Statics have by default a `'static` lifetime
69+
error: statics have by default a `'static` lifetime
7070
--> $DIR/redundant_static_lifetimes.rs:32:25
7171
|
7272
LL | static STATIC_VAR_SIX: &'static u8 = &5;
7373
| -^^^^^^^--- help: consider removing `'static`: `&u8`
7474

75-
error: Statics have by default a `'static` lifetime
75+
error: statics have by default a `'static` lifetime
7676
--> $DIR/redundant_static_lifetimes.rs:34:28
7777
|
7878
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
7979
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
8080

81-
error: Statics have by default a `'static` lifetime
81+
error: statics have by default a `'static` lifetime
8282
--> $DIR/redundant_static_lifetimes.rs:36:27
8383
|
8484
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR Consider removing 'static.
8585
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
8686

87-
error: Statics have by default a `'static` lifetime
87+
error: statics have by default a `'static` lifetime
8888
--> $DIR/redundant_static_lifetimes.rs:38:27
8989
|
9090
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
9191
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
9292

93-
error: Statics have by default a `'static` lifetime
93+
error: statics have by default a `'static` lifetime
9494
--> $DIR/redundant_static_lifetimes.rs:40:27
9595
|
9696
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.

tests/ui/redundant_static_lifetimes_multiple.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
error: Constants have by default a `'static` lifetime
1+
error: constants have by default a `'static` lifetime
22
--> $DIR/redundant_static_lifetimes_multiple.rs:3:18
33
|
44
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
55
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
66
|
77
= note: `-D clippy::redundant-static-lifetimes` implied by `-D warnings`
88

9-
error: Constants have by default a `'static` lifetime
9+
error: constants have by default a `'static` lifetime
1010
--> $DIR/redundant_static_lifetimes_multiple.rs:3:30
1111
|
1212
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
1313
| -^^^^^^^---- help: consider removing `'static`: `&str`
1414

15-
error: Constants have by default a `'static` lifetime
15+
error: constants have by default a `'static` lifetime
1616
--> $DIR/redundant_static_lifetimes_multiple.rs:5:29
1717
|
1818
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
1919
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
2020

21-
error: Constants have by default a `'static` lifetime
21+
error: constants have by default a `'static` lifetime
2222
--> $DIR/redundant_static_lifetimes_multiple.rs:5:39
2323
|
2424
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
2525
| -^^^^^^^---- help: consider removing `'static`: `&str`
2626

27-
error: Statics have by default a `'static` lifetime
27+
error: statics have by default a `'static` lifetime
2828
--> $DIR/redundant_static_lifetimes_multiple.rs:7:40
2929
|
3030
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
3131
| -^^^^^^^---- help: consider removing `'static`: `&str`
3232

33-
error: Statics have by default a `'static` lifetime
33+
error: statics have by default a `'static` lifetime
3434
--> $DIR/redundant_static_lifetimes_multiple.rs:7:55
3535
|
3636
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
3737
| -^^^^^^^---- help: consider removing `'static`: `&str`
3838

39-
error: Statics have by default a `'static` lifetime
39+
error: statics have by default a `'static` lifetime
4040
--> $DIR/redundant_static_lifetimes_multiple.rs:9:26
4141
|
4242
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
4343
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
4444

45-
error: Statics have by default a `'static` lifetime
45+
error: statics have by default a `'static` lifetime
4646
--> $DIR/redundant_static_lifetimes_multiple.rs:9:38
4747
|
4848
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
4949
| -^^^^^^^---- help: consider removing `'static`: `&str`
5050

51-
error: Statics have by default a `'static` lifetime
51+
error: statics have by default a `'static` lifetime
5252
--> $DIR/redundant_static_lifetimes_multiple.rs:11:37
5353
|
5454
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
5555
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
5656

57-
error: Statics have by default a `'static` lifetime
57+
error: statics have by default a `'static` lifetime
5858
--> $DIR/redundant_static_lifetimes_multiple.rs:11:47
5959
|
6060
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];

0 commit comments

Comments
 (0)