3 #![feature(custom_inner_attributes)]
9 const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
11 const VAR_TWO: &str = "Test constant #2"; // This line should not raise a warning.
13 const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
15 const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
17 const VAR_SIX: &'static u8 = &5;
19 const VAR_HEIGHT: &'static Foo = &Foo {};
21 const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
23 const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
25 const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
27 static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR Consider removing 'static.
29 static STATIC_VAR_TWO: &str = "Test static #2"; // This line should not raise a warning.
31 static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
33 static STATIC_VAR_SIX: &'static u8 = &5;
35 static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
37 static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR Consider removing 'static.
39 static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
41 static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
44 let false_positive: &'static str = "test";
48 const TRAIT_VAR: &'static str;
52 const IMPL_VAR: &'static str = "var";
56 const TRAIT_VAR: &'static str = "foo";
60 #![clippy::msrv = "1.16"]
62 static V: &'static u8 = &16;
66 #![clippy::msrv = "1.17"]
68 static V: &'static u8 = &17;