From 2130ba57885357b56e7087e164a33be0288371e4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 5 Jun 2025 22:09:58 -0700 Subject: [PATCH] Ignore mismatched_lifetime_syntaxes lint warning: lifetime flowing from input to output with different syntax can be confusing --> serde/src/private/de.rs:266:23 | 266 | fn unexpected(&self) -> Unexpected { | ^^^^^ ---------- the lifetime gets resolved as `'_` | | | this lifetime flows to the output | = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default help: one option is to remove the lifetime for references and use the anonymous lifetime for paths | 266 | fn unexpected(&self) -> Unexpected<'_> { | ++++ warning: lifetime flowing from input to output with different syntax can be confusing --> serde/src/private/mod.rs:27:35 | 27 | pub fn from_utf8_lossy(bytes: &[u8]) -> Cow { | ^^^^^ -------- the lifetime gets resolved as `'_` | | | this lifetime flows to the output | help: one option is to remove the lifetime for references and use the anonymous lifetime for paths | 27 | pub fn from_utf8_lossy(bytes: &[u8]) -> Cow<'_, str> { | +++ warning: lifetime flowing from input to output with different syntax can be confusing --> serde_derive/src/internals/attr.rs:612:23 | 612 | pub fn serde_path(&self) -> Cow { | ^^^^^ -------------- the lifetime gets resolved as `'_` | | | this lifetime flows to the output | = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default help: one option is to remove the lifetime for references and use the anonymous lifetime for paths | 612 | pub fn serde_path(&self) -> Cow<'_, syn::Path> { | +++ warning: lifetime flowing from input to output with different syntax can be confusing --> serde_derive/src/internals/case.rs:45:37 | 45 | pub fn from_str(rename_all_str: &str) -> Result { | ^^^^ ---------- the lifetime gets resolved as `'_` | | | this lifetime flows to the output | help: one option is to remove the lifetime for references and use the anonymous lifetime for paths | 45 | pub fn from_str(rename_all_str: &str) -> Result> { | ++++ warning: lifetime flowing from input to output with different syntax can be confusing --> serde_derive/src/de.rs:3228:13 | 3228 | params: &Parameters, | ^^^^^^^^^^^ this lifetime flows to the output 3229 | ) -> ( 3230 | DeImplGenerics, | -------------- the lifetimes get resolved as `'_` 3231 | DeTypeGenerics, | -------------- the lifetimes get resolved as `'_` 3232 | syn::TypeGenerics, | ----------------- the lifetimes get resolved as `'_` 3233 | Option<&syn::WhereClause>, | ----------------- the lifetimes get resolved as `'_` | help: one option is to remove the lifetime for references and use the anonymous lifetime for paths | 3230 ~ DeImplGenerics<'_>, 3231 ~ DeTypeGenerics<'_>, 3232 ~ syn::TypeGenerics<'_>, | --- serde/src/lib.rs | 2 +- serde_derive/src/lib.rs | 1 + serde_derive_internals/lib.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/serde/src/lib.rs b/serde/src/lib.rs index 84b5cd7e..5054263c 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -106,7 +106,7 @@ // // https://github.com/serde-rs/serde/issues/812 #![cfg_attr(feature = "unstable", feature(never_type))] -#![allow(unknown_lints, bare_trait_objects, deprecated)] +#![allow(unknown_lints, bare_trait_objects, deprecated, mismatched_lifetime_syntaxes)] // Ignored clippy and clippy_pedantic lints #![allow( // clippy bug: https://github.com/rust-lang/rust-clippy/issues/5704 diff --git a/serde_derive/src/lib.rs b/serde_derive/src/lib.rs index 715c2fab..a02ba990 100644 --- a/serde_derive/src/lib.rs +++ b/serde_derive/src/lib.rs @@ -64,6 +64,7 @@ clippy::wildcard_imports )] #![cfg_attr(all(test, exhaustive), feature(non_exhaustive_omitted_patterns_lint))] +#![allow(unknown_lints, mismatched_lifetime_syntaxes)] extern crate proc_macro2; extern crate quote; diff --git a/serde_derive_internals/lib.rs b/serde_derive_internals/lib.rs index c4a009c7..73680082 100644 --- a/serde_derive_internals/lib.rs +++ b/serde_derive_internals/lib.rs @@ -41,6 +41,7 @@ clippy::unused_self, clippy::wildcard_imports )] +#![allow(unknown_lints, mismatched_lifetime_syntaxes)] extern crate proc_macro2; extern crate quote;