Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES.

This commit is contained in:
krk 2019-06-13 23:47:06 +02:00 committed by flip1995
parent 3b1080542b
commit 55740219b0
No known key found for this signature in database
GPG Key ID: 693086869D506637
5 changed files with 37 additions and 37 deletions

View File

@ -1067,7 +1067,7 @@ All notable changes to this project will be documented in this file.
[`redundant_field_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
[`redundant_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern
[`redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
[`redundant_static_lifetime`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetime
[`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
[`ref_in_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_in_deref
[`regex_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_macro
[`replace_consts`]: https://rust-lang.github.io/rust-clippy/master/index.html#replace_consts

View File

@ -248,7 +248,7 @@ pub mod ranges;
pub mod redundant_clone;
pub mod redundant_field_names;
pub mod redundant_pattern_matching;
pub mod redundant_static_lifetime;
pub mod redundant_static_lifetimes;
pub mod reference;
pub mod regex;
pub mod replace_consts;
@ -553,7 +553,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
reg.register_late_lint_pass(box invalid_ref::InvalidRef);
reg.register_late_lint_pass(box identity_conversion::IdentityConversion::default());
reg.register_late_lint_pass(box types::ImplicitHasher);
reg.register_early_lint_pass(box redundant_static_lifetime::RedundantStaticLifetime);
reg.register_early_lint_pass(box redundant_static_lifetimes::RedundantStaticLifetimes);
reg.register_late_lint_pass(box fallible_impl_from::FallibleImplFrom);
reg.register_late_lint_pass(box replace_consts::ReplaceConsts);
reg.register_late_lint_pass(box types::UnitArg);
@ -833,7 +833,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
ranges::RANGE_ZIP_WITH_LEN,
redundant_field_names::REDUNDANT_FIELD_NAMES,
redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
redundant_static_lifetime::REDUNDANT_STATIC_LIFETIME,
redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
reference::DEREF_ADDROF,
reference::REF_IN_DEREF,
regex::INVALID_REGEX,
@ -956,7 +956,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
question_mark::QUESTION_MARK,
redundant_field_names::REDUNDANT_FIELD_NAMES,
redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
redundant_static_lifetime::REDUNDANT_STATIC_LIFETIME,
redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
regex::REGEX_MACRO,
regex::TRIVIAL_REGEX,
returns::LET_AND_RETURN,

View File

@ -24,14 +24,14 @@ declare_clippy_lint! {
/// const FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
/// static FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
/// ```
pub REDUNDANT_STATIC_LIFETIME,
pub REDUNDANT_STATIC_LIFETIMES,
style,
"Using explicit `'static` lifetime for constants or statics when elision rules would allow omitting them."
}
declare_lint_pass!(RedundantStaticLifetime => [REDUNDANT_STATIC_LIFETIME]);
declare_lint_pass!(RedundantStaticLifetimes => [REDUNDANT_STATIC_LIFETIMES]);
impl RedundantStaticLifetime {
impl RedundantStaticLifetimes {
// Recursively visit types
fn visit_type(&mut self, ty: &Ty, cx: &EarlyContext<'_>, reason: &str) {
match ty.node {
@ -53,7 +53,7 @@ impl RedundantStaticLifetime {
if lifetime.ident.name == syntax::symbol::kw::StaticLifetime {
let snip = snippet(cx, borrow_type.ty.span, "<type>");
let sugg = format!("&{}", snip);
span_lint_and_then(cx, REDUNDANT_STATIC_LIFETIME, lifetime.ident.span, reason, |db| {
span_lint_and_then(cx, REDUNDANT_STATIC_LIFETIMES, lifetime.ident.span, reason, |db| {
db.span_suggestion(
ty.span,
"consider removing `'static`",
@ -76,7 +76,7 @@ impl RedundantStaticLifetime {
}
}
impl EarlyLintPass for RedundantStaticLifetime {
impl EarlyLintPass for RedundantStaticLifetimes {
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
if !in_macro_or_desugar(item.span) {
if let ItemKind::Const(ref var_type, _) = item.node {

View File

@ -1,157 +1,157 @@
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:4:17
--> $DIR/redundant_static_lifetimes.rs:4:17
|
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
= note: `-D clippy::redundant-static-lifetime` implied by `-D warnings`
= note: `-D clippy::redundant-static-lifetimes` implied by `-D warnings`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:8:21
--> $DIR/redundant_static_lifetimes.rs:8:21
|
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:10:32
--> $DIR/redundant_static_lifetimes.rs:10:32
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:10:47
--> $DIR/redundant_static_lifetimes.rs:10:47
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:12:18
--> $DIR/redundant_static_lifetimes.rs:12:18
|
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:12:30
--> $DIR/redundant_static_lifetimes.rs:12:30
|
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:14:17
--> $DIR/redundant_static_lifetimes.rs:14:17
|
LL | const VAR_SIX: &'static u8 = &5;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:16:29
--> $DIR/redundant_static_lifetimes.rs:16:29
|
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:16:39
--> $DIR/redundant_static_lifetimes.rs:16:39
|
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:18:20
--> $DIR/redundant_static_lifetimes.rs:18:20
|
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:20:19
--> $DIR/redundant_static_lifetimes.rs:20:19
|
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:22:19
--> $DIR/redundant_static_lifetimes.rs:22:19
|
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
error: Constants have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:24:19
--> $DIR/redundant_static_lifetimes.rs:24:19
|
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:26:25
--> $DIR/redundant_static_lifetimes.rs:26:25
|
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR Consider removing 'static.
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:30:29
--> $DIR/redundant_static_lifetimes.rs:30:29
|
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:32:40
--> $DIR/redundant_static_lifetimes.rs:32:40
|
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:32:55
--> $DIR/redundant_static_lifetimes.rs:32:55
|
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:34:26
--> $DIR/redundant_static_lifetimes.rs:34:26
|
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:34:38
--> $DIR/redundant_static_lifetimes.rs:34:38
|
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:36:25
--> $DIR/redundant_static_lifetimes.rs:36:25
|
LL | static STATIC_VAR_SIX: &'static u8 = &5;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:38:37
--> $DIR/redundant_static_lifetimes.rs:38:37
|
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:38:47
--> $DIR/redundant_static_lifetimes.rs:38:47
|
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:40:28
--> $DIR/redundant_static_lifetimes.rs:40:28
|
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:42:27
--> $DIR/redundant_static_lifetimes.rs:42:27
|
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR Consider removing 'static.
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:44:27
--> $DIR/redundant_static_lifetimes.rs:44:27
|
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
error: Statics have by default a `'static` lifetime
--> $DIR/redundant_static_lifetime.rs:46:27
--> $DIR/redundant_static_lifetimes.rs:46:27
|
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`