mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Rename const_static_lifetime to redundant_static_lifetime.
This commit is contained in:
parent
b38ce08e76
commit
637e92d44e
5 changed files with 37 additions and 38 deletions
|
@ -881,7 +881,6 @@ All notable changes to this project will be documented in this file.
|
||||||
[`cmp_owned`]: https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned
|
[`cmp_owned`]: https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned
|
||||||
[`cognitive_complexity`]: https://rust-lang.github.io/rust-clippy/master/index.html#cognitive_complexity
|
[`cognitive_complexity`]: https://rust-lang.github.io/rust-clippy/master/index.html#cognitive_complexity
|
||||||
[`collapsible_if`]: https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
|
[`collapsible_if`]: https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
|
||||||
[`const_static_lifetime`]: https://rust-lang.github.io/rust-clippy/master/index.html#const_static_lifetime
|
|
||||||
[`copy_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#copy_iterator
|
[`copy_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#copy_iterator
|
||||||
[`crosspointer_transmute`]: https://rust-lang.github.io/rust-clippy/master/index.html#crosspointer_transmute
|
[`crosspointer_transmute`]: https://rust-lang.github.io/rust-clippy/master/index.html#crosspointer_transmute
|
||||||
[`dbg_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#dbg_macro
|
[`dbg_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#dbg_macro
|
||||||
|
@ -1068,6 +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_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`]: 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_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
|
||||||
[`ref_in_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_in_deref
|
[`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
|
[`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
|
[`replace_consts`]: https://rust-lang.github.io/rust-clippy/master/index.html#replace_consts
|
||||||
|
@ -1088,7 +1088,6 @@ All notable changes to this project will be documented in this file.
|
||||||
[`single_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match
|
[`single_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match
|
||||||
[`single_match_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
|
[`single_match_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
|
||||||
[`slow_vector_initialization`]: https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization
|
[`slow_vector_initialization`]: https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization
|
||||||
[`static_static_lifetime`]: https://rust-lang.github.io/rust-clippy/master/index.html#static_static_lifetime
|
|
||||||
[`str_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
|
[`str_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
|
||||||
[`string_add`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_add
|
[`string_add`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_add
|
||||||
[`string_add_assign`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_add_assign
|
[`string_add_assign`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_add_assign
|
||||||
|
|
|
@ -157,7 +157,6 @@ pub mod cargo_common_metadata;
|
||||||
pub mod checked_conversions;
|
pub mod checked_conversions;
|
||||||
pub mod cognitive_complexity;
|
pub mod cognitive_complexity;
|
||||||
pub mod collapsible_if;
|
pub mod collapsible_if;
|
||||||
pub mod const_static_lifetime;
|
|
||||||
pub mod copies;
|
pub mod copies;
|
||||||
pub mod copy_iterator;
|
pub mod copy_iterator;
|
||||||
pub mod dbg_macro;
|
pub mod dbg_macro;
|
||||||
|
@ -249,6 +248,7 @@ pub mod ranges;
|
||||||
pub mod redundant_clone;
|
pub mod redundant_clone;
|
||||||
pub mod redundant_field_names;
|
pub mod redundant_field_names;
|
||||||
pub mod redundant_pattern_matching;
|
pub mod redundant_pattern_matching;
|
||||||
|
pub mod redundant_static_lifetime;
|
||||||
pub mod reference;
|
pub mod reference;
|
||||||
pub mod regex;
|
pub mod regex;
|
||||||
pub mod replace_consts;
|
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 invalid_ref::InvalidRef);
|
||||||
reg.register_late_lint_pass(box identity_conversion::IdentityConversion::default());
|
reg.register_late_lint_pass(box identity_conversion::IdentityConversion::default());
|
||||||
reg.register_late_lint_pass(box types::ImplicitHasher);
|
reg.register_late_lint_pass(box types::ImplicitHasher);
|
||||||
reg.register_early_lint_pass(box const_static_lifetime::StaticConst);
|
reg.register_early_lint_pass(box redundant_static_lifetime::RedundantStaticLifetime);
|
||||||
reg.register_late_lint_pass(box fallible_impl_from::FallibleImplFrom);
|
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 replace_consts::ReplaceConsts);
|
||||||
reg.register_late_lint_pass(box types::UnitArg);
|
reg.register_late_lint_pass(box types::UnitArg);
|
||||||
|
@ -686,7 +686,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
|
||||||
bytecount::NAIVE_BYTECOUNT,
|
bytecount::NAIVE_BYTECOUNT,
|
||||||
cognitive_complexity::COGNITIVE_COMPLEXITY,
|
cognitive_complexity::COGNITIVE_COMPLEXITY,
|
||||||
collapsible_if::COLLAPSIBLE_IF,
|
collapsible_if::COLLAPSIBLE_IF,
|
||||||
const_static_lifetime::CONST_STATIC_LIFETIME,
|
|
||||||
copies::IFS_SAME_COND,
|
copies::IFS_SAME_COND,
|
||||||
copies::IF_SAME_THEN_ELSE,
|
copies::IF_SAME_THEN_ELSE,
|
||||||
derive::DERIVE_HASH_XOR_EQ,
|
derive::DERIVE_HASH_XOR_EQ,
|
||||||
|
@ -834,6 +833,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
|
||||||
ranges::RANGE_ZIP_WITH_LEN,
|
ranges::RANGE_ZIP_WITH_LEN,
|
||||||
redundant_field_names::REDUNDANT_FIELD_NAMES,
|
redundant_field_names::REDUNDANT_FIELD_NAMES,
|
||||||
redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
|
redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
|
||||||
|
redundant_static_lifetime::REDUNDANT_STATIC_LIFETIME,
|
||||||
reference::DEREF_ADDROF,
|
reference::DEREF_ADDROF,
|
||||||
reference::REF_IN_DEREF,
|
reference::REF_IN_DEREF,
|
||||||
regex::INVALID_REGEX,
|
regex::INVALID_REGEX,
|
||||||
|
@ -901,7 +901,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
|
||||||
block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
|
block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
|
||||||
block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
|
block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
|
||||||
collapsible_if::COLLAPSIBLE_IF,
|
collapsible_if::COLLAPSIBLE_IF,
|
||||||
const_static_lifetime::CONST_STATIC_LIFETIME,
|
|
||||||
enum_variants::ENUM_VARIANT_NAMES,
|
enum_variants::ENUM_VARIANT_NAMES,
|
||||||
enum_variants::MODULE_INCEPTION,
|
enum_variants::MODULE_INCEPTION,
|
||||||
eq_op::OP_REF,
|
eq_op::OP_REF,
|
||||||
|
@ -957,6 +956,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
|
||||||
question_mark::QUESTION_MARK,
|
question_mark::QUESTION_MARK,
|
||||||
redundant_field_names::REDUNDANT_FIELD_NAMES,
|
redundant_field_names::REDUNDANT_FIELD_NAMES,
|
||||||
redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
|
redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
|
||||||
|
redundant_static_lifetime::REDUNDANT_STATIC_LIFETIME,
|
||||||
regex::REGEX_MACRO,
|
regex::REGEX_MACRO,
|
||||||
regex::TRIVIAL_REGEX,
|
regex::TRIVIAL_REGEX,
|
||||||
returns::LET_AND_RETURN,
|
returns::LET_AND_RETURN,
|
||||||
|
|
|
@ -24,14 +24,14 @@ declare_clippy_lint! {
|
||||||
/// const FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
|
/// const FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
|
||||||
/// static FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
|
/// static FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
|
||||||
/// ```
|
/// ```
|
||||||
pub CONST_STATIC_LIFETIME,
|
pub REDUNDANT_STATIC_LIFETIME,
|
||||||
style,
|
style,
|
||||||
"Using explicit `'static` lifetime for constants or statics when elision rules would allow omitting them."
|
"Using explicit `'static` lifetime for constants or statics when elision rules would allow omitting them."
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint_pass!(StaticConst => [CONST_STATIC_LIFETIME]);
|
declare_lint_pass!(RedundantStaticLifetime => [REDUNDANT_STATIC_LIFETIME]);
|
||||||
|
|
||||||
impl StaticConst {
|
impl RedundantStaticLifetime {
|
||||||
// Recursively visit types
|
// Recursively visit types
|
||||||
pub fn visit_type(&mut self, ty: &Ty, cx: &EarlyContext<'_>, reason: &str) {
|
pub fn visit_type(&mut self, ty: &Ty, cx: &EarlyContext<'_>, reason: &str) {
|
||||||
match ty.node {
|
match ty.node {
|
||||||
|
@ -53,7 +53,7 @@ impl StaticConst {
|
||||||
if lifetime.ident.name == syntax::symbol::kw::StaticLifetime {
|
if lifetime.ident.name == syntax::symbol::kw::StaticLifetime {
|
||||||
let snip = snippet(cx, borrow_type.ty.span, "<type>");
|
let snip = snippet(cx, borrow_type.ty.span, "<type>");
|
||||||
let sugg = format!("&{}", snip);
|
let sugg = format!("&{}", snip);
|
||||||
span_lint_and_then(cx, CONST_STATIC_LIFETIME, lifetime.ident.span, reason, |db| {
|
span_lint_and_then(cx, REDUNDANT_STATIC_LIFETIME, lifetime.ident.span, reason, |db| {
|
||||||
db.span_suggestion(
|
db.span_suggestion(
|
||||||
ty.span,
|
ty.span,
|
||||||
"consider removing `'static`",
|
"consider removing `'static`",
|
||||||
|
@ -76,7 +76,7 @@ impl StaticConst {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EarlyLintPass for StaticConst {
|
impl EarlyLintPass for RedundantStaticLifetime {
|
||||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
||||||
if !in_macro_or_desugar(item.span) {
|
if !in_macro_or_desugar(item.span) {
|
||||||
if let ItemKind::Const(ref var_type, _) = item.node {
|
if let ItemKind::Const(ref var_type, _) = item.node {
|
|
@ -1,157 +1,157 @@
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:4:17
|
--> $DIR/redundant_static_lifetime.rs:4:17
|
||||||
|
|
|
|
||||||
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
|
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
|
|
||||||
= note: `-D clippy::const-static-lifetime` implied by `-D warnings`
|
= note: `-D clippy::redundant-static-lifetime` implied by `-D warnings`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:8:21
|
--> $DIR/redundant_static_lifetime.rs:8:21
|
||||||
|
|
|
|
||||||
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
|
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:10:32
|
--> $DIR/redundant_static_lifetime.rs:10:32
|
||||||
|
|
|
|
||||||
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:10:47
|
--> $DIR/redundant_static_lifetime.rs:10:47
|
||||||
|
|
|
|
||||||
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:12:18
|
--> $DIR/redundant_static_lifetime.rs:12:18
|
||||||
|
|
|
|
||||||
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
|
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
|
||||||
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
|
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:12:30
|
--> $DIR/redundant_static_lifetime.rs:12:30
|
||||||
|
|
|
|
||||||
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
|
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:14:17
|
--> $DIR/redundant_static_lifetime.rs:14:17
|
||||||
|
|
|
|
||||||
LL | const VAR_SIX: &'static u8 = &5;
|
LL | const VAR_SIX: &'static u8 = &5;
|
||||||
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:16:29
|
--> $DIR/redundant_static_lifetime.rs:16:29
|
||||||
|
|
|
|
||||||
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
|
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
|
||||||
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
|
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:16:39
|
--> $DIR/redundant_static_lifetime.rs:16:39
|
||||||
|
|
|
|
||||||
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
|
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:18:20
|
--> $DIR/redundant_static_lifetime.rs:18:20
|
||||||
|
|
|
|
||||||
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
|
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
|
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:20:19
|
--> $DIR/redundant_static_lifetime.rs:20:19
|
||||||
|
|
|
|
||||||
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
|
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
|
||||||
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
|
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:22:19
|
--> $DIR/redundant_static_lifetime.rs:22:19
|
||||||
|
|
|
|
||||||
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
|
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
|
||||||
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
|
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
|
||||||
|
|
||||||
error: Constants have by default a `'static` lifetime
|
error: Constants have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:24:19
|
--> $DIR/redundant_static_lifetime.rs:24:19
|
||||||
|
|
|
|
||||||
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
|
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
|
||||||
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
|
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:26:25
|
--> $DIR/redundant_static_lifetime.rs:26:25
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR Consider removing 'static.
|
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR Consider removing 'static.
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:30:29
|
--> $DIR/redundant_static_lifetime.rs:30:29
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
|
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:32:40
|
--> $DIR/redundant_static_lifetime.rs:32:40
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
|
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:32:55
|
--> $DIR/redundant_static_lifetime.rs:32:55
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
|
LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:34:26
|
--> $DIR/redundant_static_lifetime.rs:34:26
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
|
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
|
||||||
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
|
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:34:38
|
--> $DIR/redundant_static_lifetime.rs:34:38
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
|
LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:36:25
|
--> $DIR/redundant_static_lifetime.rs:36:25
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_SIX: &'static u8 = &5;
|
LL | static STATIC_VAR_SIX: &'static u8 = &5;
|
||||||
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:38:37
|
--> $DIR/redundant_static_lifetime.rs:38:37
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
|
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
|
||||||
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
|
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:38:47
|
--> $DIR/redundant_static_lifetime.rs:38:47
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
|
LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:40:28
|
--> $DIR/redundant_static_lifetime.rs:40:28
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
|
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
|
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:42:27
|
--> $DIR/redundant_static_lifetime.rs:42:27
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR Consider removing 'static.
|
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR Consider removing 'static.
|
||||||
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
|
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:44:27
|
--> $DIR/redundant_static_lifetime.rs:44:27
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
|
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
|
||||||
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
|
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
|
||||||
|
|
||||||
error: Statics have by default a `'static` lifetime
|
error: Statics have by default a `'static` lifetime
|
||||||
--> $DIR/const_static_lifetime.rs:46:27
|
--> $DIR/redundant_static_lifetime.rs:46:27
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
|
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
|
||||||
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
|
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
|
Loading…
Reference in a new issue