Merge pull request #2194 from serde-rs/exhaustive

Update exhaustive matching to syn 1.0.90
This commit is contained in:
David Tolnay 2022-03-28 10:27:27 -07:00 committed by GitHub
commit 6e94a27c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 11 deletions

View File

@ -59,6 +59,10 @@ jobs:
- run: cd serde && cargo test --features derive,rc,unstable - run: cd serde && cargo test --features derive,rc,unstable
- run: cd test_suite/no_std && cargo build - run: cd test_suite/no_std && cargo build
if: matrix.os != 'windows' if: matrix.os != 'windows'
- run: cd serde_derive && cargo check --tests
env:
RUSTFLAGS: --cfg exhaustive ${{env.RUSTFLAGS}}
if: matrix.os != 'windows'
msrv: msrv:
name: Rust 1.13.0 name: Rust 1.13.0

View File

@ -23,7 +23,7 @@ proc-macro = true
[dependencies] [dependencies]
proc-macro2 = "1.0" proc-macro2 = "1.0"
quote = "1.0" quote = "1.0"
syn = "1.0.60" syn = "1.0.90"
[dev-dependencies] [dev-dependencies]
serde = { version = "1.0", path = "../serde" } serde = { version = "1.0", path = "../serde" }

View File

@ -184,9 +184,7 @@ pub fn with_bound(
syn::Type::Infer(_) | syn::Type::Never(_) | syn::Type::Verbatim(_) => {} syn::Type::Infer(_) | syn::Type::Never(_) | syn::Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
syn::Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }

View File

@ -1912,9 +1912,7 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet<syn::Lifetime>) {
| syn::Type::Infer(_) | syn::Type::Infer(_)
| syn::Type::Verbatim(_) => {} | syn::Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
syn::Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }

View File

@ -147,9 +147,7 @@ impl ReplaceReceiver<'_> {
Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {} Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }

View File

@ -60,6 +60,7 @@
clippy::use_self, clippy::use_self,
clippy::wildcard_imports clippy::wildcard_imports
)] )]
#![cfg_attr(all(test, exhaustive), feature(non_exhaustive_omitted_patterns_lint))]
#[macro_use] #[macro_use]
extern crate quote; extern crate quote;

View File

@ -17,7 +17,7 @@ path = "lib.rs"
[dependencies] [dependencies]
proc-macro2 = "1.0" proc-macro2 = "1.0"
quote = "1.0" quote = "1.0"
syn = { version = "1.0.60", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] } syn = { version = "1.0.90", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] }
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]