Skip to content

Commit 5574021

Browse files
krkflip1995
authored andcommitted
Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES.
1 parent 3b10805 commit 5574021

File tree

5 files changed

+37
-37
lines changed

5 files changed

+37
-37
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ All notable changes to this project will be documented in this file.
10671067
[`redundant_field_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
10681068
[`redundant_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern
10691069
[`redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
1070-
[`redundant_static_lifetime`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetime
1070+
[`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
10711071
[`ref_in_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_in_deref
10721072
[`regex_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_macro
10731073
[`replace_consts`]: https://rust-lang.github.io/rust-clippy/master/index.html#replace_consts

clippy_lints/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ pub mod ranges;
248248
pub mod redundant_clone;
249249
pub mod redundant_field_names;
250250
pub mod redundant_pattern_matching;
251-
pub mod redundant_static_lifetime;
251+
pub mod redundant_static_lifetimes;
252252
pub mod reference;
253253
pub mod regex;
254254
pub mod replace_consts;
@@ -553,7 +553,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
553553
reg.register_late_lint_pass(box invalid_ref::InvalidRef);
554554
reg.register_late_lint_pass(box identity_conversion::IdentityConversion::default());
555555
reg.register_late_lint_pass(box types::ImplicitHasher);
556-
reg.register_early_lint_pass(box redundant_static_lifetime::RedundantStaticLifetime);
556+
reg.register_early_lint_pass(box redundant_static_lifetimes::RedundantStaticLifetimes);
557557
reg.register_late_lint_pass(box fallible_impl_from::FallibleImplFrom);
558558
reg.register_late_lint_pass(box replace_consts::ReplaceConsts);
559559
reg.register_late_lint_pass(box types::UnitArg);
@@ -833,7 +833,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
833833
ranges::RANGE_ZIP_WITH_LEN,
834834
redundant_field_names::REDUNDANT_FIELD_NAMES,
835835
redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
836-
redundant_static_lifetime::REDUNDANT_STATIC_LIFETIME,
836+
redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
837837
reference::DEREF_ADDROF,
838838
reference::REF_IN_DEREF,
839839
regex::INVALID_REGEX,
@@ -956,7 +956,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
956956
question_mark::QUESTION_MARK,
957957
redundant_field_names::REDUNDANT_FIELD_NAMES,
958958
redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
959-
redundant_static_lifetime::REDUNDANT_STATIC_LIFETIME,
959+
redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
960960
regex::REGEX_MACRO,
961961
regex::TRIVIAL_REGEX,
962962
returns::LET_AND_RETURN,

clippy_lints/src/redundant_static_lifetime.rs renamed to clippy_lints/src/redundant_static_lifetimes.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ declare_clippy_lint! {
2424
/// const FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
2525
/// static FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
2626
/// ```
27-
pub REDUNDANT_STATIC_LIFETIME,
27+
pub REDUNDANT_STATIC_LIFETIMES,
2828
style,
2929
"Using explicit `'static` lifetime for constants or statics when elision rules would allow omitting them."
3030
}
3131

32-
declare_lint_pass!(RedundantStaticLifetime => [REDUNDANT_STATIC_LIFETIME]);
32+
declare_lint_pass!(RedundantStaticLifetimes => [REDUNDANT_STATIC_LIFETIMES]);
3333

34-
impl RedundantStaticLifetime {
34+
impl RedundantStaticLifetimes {
3535
// Recursively visit types
3636
fn visit_type(&mut self, ty: &Ty, cx: &EarlyContext<'_>, reason: &str) {
3737
match ty.node {
@@ -53,7 +53,7 @@ impl RedundantStaticLifetime {
5353
if lifetime.ident.name == syntax::symbol::kw::StaticLifetime {
5454
let snip = snippet(cx, borrow_type.ty.span, "<type>");
5555
let sugg = format!("&{}", snip);
56-
span_lint_and_then(cx, REDUNDANT_STATIC_LIFETIME, lifetime.ident.span, reason, |db| {
56+
span_lint_and_then(cx, REDUNDANT_STATIC_LIFETIMES, lifetime.ident.span, reason, |db| {
5757
db.span_suggestion(
5858
ty.span,
5959
"consider removing `'static`",
@@ -76,7 +76,7 @@ impl RedundantStaticLifetime {
7676
}
7777
}
7878

79-
impl EarlyLintPass for RedundantStaticLifetime {
79+
impl EarlyLintPass for RedundantStaticLifetimes {
8080
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
8181
if !in_macro_or_desugar(item.span) {
8282
if let ItemKind::Const(ref var_type, _) = item.node {

tests/ui/redundant_static_lifetime.stderr renamed to tests/ui/redundant_static_lifetimes.stderr

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

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

1515
error: Constants have by default a `'static` lifetime
16-
--> $DIR/redundant_static_lifetime.rs:10:32
16+
--> $DIR/redundant_static_lifetimes.rs:10: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

2121
error: Constants have by default a `'static` lifetime
22-
--> $DIR/redundant_static_lifetime.rs:10:47
22+
--> $DIR/redundant_static_lifetimes.rs:10: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

2727
error: Constants have by default a `'static` lifetime
28-
--> $DIR/redundant_static_lifetime.rs:12:18
28+
--> $DIR/redundant_static_lifetimes.rs:12:18
2929
|
3030
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
3131
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
3232

3333
error: Constants have by default a `'static` lifetime
34-
--> $DIR/redundant_static_lifetime.rs:12:30
34+
--> $DIR/redundant_static_lifetimes.rs:12:30
3535
|
3636
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
3737
| -^^^^^^^---- help: consider removing `'static`: `&str`
3838

3939
error: Constants have by default a `'static` lifetime
40-
--> $DIR/redundant_static_lifetime.rs:14:17
40+
--> $DIR/redundant_static_lifetimes.rs:14:17
4141
|
4242
LL | const VAR_SIX: &'static u8 = &5;
4343
| -^^^^^^^--- help: consider removing `'static`: `&u8`
4444

4545
error: Constants have by default a `'static` lifetime
46-
--> $DIR/redundant_static_lifetime.rs:16:29
46+
--> $DIR/redundant_static_lifetimes.rs:16:29
4747
|
4848
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
4949
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
5050

5151
error: Constants have by default a `'static` lifetime
52-
--> $DIR/redundant_static_lifetime.rs:16:39
52+
--> $DIR/redundant_static_lifetimes.rs:16:39
5353
|
5454
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
5555
| -^^^^^^^---- help: consider removing `'static`: `&str`
5656

5757
error: Constants have by default a `'static` lifetime
58-
--> $DIR/redundant_static_lifetime.rs:18:20
58+
--> $DIR/redundant_static_lifetimes.rs:18:20
5959
|
6060
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
6161
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
6262

6363
error: Constants have by default a `'static` lifetime
64-
--> $DIR/redundant_static_lifetime.rs:20:19
64+
--> $DIR/redundant_static_lifetimes.rs:20:19
6565
|
6666
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
6767
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
6868

6969
error: Constants have by default a `'static` lifetime
70-
--> $DIR/redundant_static_lifetime.rs:22:19
70+
--> $DIR/redundant_static_lifetimes.rs:22:19
7171
|
7272
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
7373
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
7474

7575
error: Constants have by default a `'static` lifetime
76-
--> $DIR/redundant_static_lifetime.rs:24:19
76+
--> $DIR/redundant_static_lifetimes.rs:24:19
7777
|
7878
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
7979
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
8080

8181
error: Statics have by default a `'static` lifetime
82-
--> $DIR/redundant_static_lifetime.rs:26:25
82+
--> $DIR/redundant_static_lifetimes.rs:26:25
8383
|
8484
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR Consider removing 'static.
8585
| -^^^^^^^---- help: consider removing `'static`: `&str`
8686

8787
error: Statics have by default a `'static` lifetime
88-
--> $DIR/redundant_static_lifetime.rs:30:29
88+
--> $DIR/redundant_static_lifetimes.rs:30:29
8989
|
9090
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
9191
| -^^^^^^^---- help: consider removing `'static`: `&str`
9292

9393
error: Statics have by default a `'static` lifetime
94-
--> $DIR/redundant_static_lifetime.rs:32:40
94+
--> $DIR/redundant_static_lifetimes.rs:32:40
9595
|
9696
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
9797
| -^^^^^^^---- help: consider removing `'static`: `&str`
9898

9999
error: Statics have by default a `'static` lifetime
100-
--> $DIR/redundant_static_lifetime.rs:32:55
100+
--> $DIR/redundant_static_lifetimes.rs:32:55
101101
|
102102
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
103103
| -^^^^^^^---- help: consider removing `'static`: `&str`
104104

105105
error: Statics have by default a `'static` lifetime
106-
--> $DIR/redundant_static_lifetime.rs:34:26
106+
--> $DIR/redundant_static_lifetimes.rs:34:26
107107
|
108108
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
109109
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
110110

111111
error: Statics have by default a `'static` lifetime
112-
--> $DIR/redundant_static_lifetime.rs:34:38
112+
--> $DIR/redundant_static_lifetimes.rs:34:38
113113
|
114114
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
115115
| -^^^^^^^---- help: consider removing `'static`: `&str`
116116

117117
error: Statics have by default a `'static` lifetime
118-
--> $DIR/redundant_static_lifetime.rs:36:25
118+
--> $DIR/redundant_static_lifetimes.rs:36:25
119119
|
120120
LL | static STATIC_VAR_SIX: &'static u8 = &5;
121121
| -^^^^^^^--- help: consider removing `'static`: `&u8`
122122

123123
error: Statics have by default a `'static` lifetime
124-
--> $DIR/redundant_static_lifetime.rs:38:37
124+
--> $DIR/redundant_static_lifetimes.rs:38:37
125125
|
126126
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
127127
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
128128

129129
error: Statics have by default a `'static` lifetime
130-
--> $DIR/redundant_static_lifetime.rs:38:47
130+
--> $DIR/redundant_static_lifetimes.rs:38:47
131131
|
132132
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
133133
| -^^^^^^^---- help: consider removing `'static`: `&str`
134134

135135
error: Statics have by default a `'static` lifetime
136-
--> $DIR/redundant_static_lifetime.rs:40:28
136+
--> $DIR/redundant_static_lifetimes.rs:40:28
137137
|
138138
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
139139
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
140140

141141
error: Statics have by default a `'static` lifetime
142-
--> $DIR/redundant_static_lifetime.rs:42:27
142+
--> $DIR/redundant_static_lifetimes.rs:42:27
143143
|
144144
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR Consider removing 'static.
145145
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
146146

147147
error: Statics have by default a `'static` lifetime
148-
--> $DIR/redundant_static_lifetime.rs:44:27
148+
--> $DIR/redundant_static_lifetimes.rs:44:27
149149
|
150150
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
151151
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
152152

153153
error: Statics have by default a `'static` lifetime
154-
--> $DIR/redundant_static_lifetime.rs:46:27
154+
--> $DIR/redundant_static_lifetimes.rs:46:27
155155
|
156156
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
157157
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`

0 commit comments

Comments
 (0)