Skip to content

Commit

Permalink
Resolve redundant_static_lifetimes clippy lint from PR 2471
Browse files Browse the repository at this point in the history
    error: constants have by default a `'static` lifetime
        --> serde/src/de/impls.rs:2467:24
         |
    2467 |     pub const FIELDS: &'static [&'static str] = &["end"];
         |                       -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
         = note: `-D clippy::redundant-static-lifetimes` implied by `-D clippy::all`

    error: constants have by default a `'static` lifetime
        --> serde/src/de/impls.rs:2467:34
         |
    2467 |     pub const FIELDS: &'static [&'static str] = &["end"];
         |                                 -^^^^^^^---- help: consider removing `'static`: `&str`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes

    error: constants have by default a `'static` lifetime
        --> serde/src/de/impls.rs:2605:24
         |
    2605 |     pub const FIELDS: &'static [&'static str] = &["start"];
         |                       -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes

    error: constants have by default a `'static` lifetime
        --> serde/src/de/impls.rs:2605:34
         |
    2605 |     pub const FIELDS: &'static [&'static str] = &["start"];
         |                                 -^^^^^^^---- help: consider removing `'static`: `&str`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
  • Loading branch information
dtolnay committed Jul 6, 2023
1 parent e6a4a37 commit 2de7c2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions serde/src/de/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ macro_rules! variant_identifier {
$($variant),*
}

static $variants_name: &'static [&'static str] = &[$(stringify!($variant)),*];
static $variants_name: &[&str] = &[$(stringify!($variant)),*];

impl<'de> Deserialize<'de> for $name_kind {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
Expand Down Expand Up @@ -2464,7 +2464,7 @@ mod range_from {

use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};

pub const FIELDS: &'static [&'static str] = &["end"];
pub const FIELDS: &[&str] = &["end"];

// If this were outside of the serde crate, it would just use:
//
Expand Down Expand Up @@ -2602,7 +2602,7 @@ mod range_to {

use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};

pub const FIELDS: &'static [&'static str] = &["start"];
pub const FIELDS: &[&str] = &["start"];

// If this were outside of the serde crate, it would just use:
//
Expand Down

0 comments on commit 2de7c2b

Please sign in to comment.