Import macros exclusively through serde_derive in test suite

This makes it easier to execute tests against the precompiled serde_derive.
This commit is contained in:
David Tolnay 2023-07-19 08:54:11 -07:00
parent be9c3fd69d
commit 2ef1cd4b35
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
20 changed files with 34 additions and 29 deletions

View File

@ -15,7 +15,7 @@ serde = { path = "../serde" }
automod = "1.0.1"
fnv = "1.0"
rustversion = "1.0"
serde = { path = "../serde", features = ["rc", "derive"] }
serde = { path = "../serde", features = ["rc"] }
serde_derive = { path = "../serde_derive", features = ["deserialize_in_place"] }
serde_test = { path = "../serde_test" }
trybuild = { version = "1.0.66", features = ["diff"] }

View File

@ -7,6 +7,7 @@ publish = false
[dependencies]
libc = { version = "0.2", default-features = false }
serde = { path = "../../serde", default-features = false, features = ["derive"] }
serde = { path = "../../serde", default-features = false }
serde_derive = { path = "../../serde_derive" }
[workspace]

View File

@ -19,7 +19,7 @@ fn panic(_info: &core::panic::PanicInfo) -> ! {
//////////////////////////////////////////////////////////////////////////////
use serde::{Deserialize, Serialize};
use serde_derive::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct Unit;

View File

@ -1,4 +1,4 @@
use serde::Deserialize;
use serde_derive::Deserialize;
#[derive(Deserialize)]
pub struct Nested;

View File

@ -1,4 +1,4 @@
use serde::Deserialize;
use serde_derive::Deserialize;
macro_rules! bug {
($serde_path:literal) => {

View File

@ -10,8 +10,9 @@
clippy::uninlined_format_args,
)]
use serde::de::{self, IgnoredAny, MapAccess, Unexpected, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::de::{self, Deserialize, Deserializer, IgnoredAny, MapAccess, Unexpected, Visitor};
use serde::ser::{Serialize, Serializer};
use serde_derive::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap};
use std::convert::TryFrom;

View File

@ -5,8 +5,8 @@
)]
use serde::de::value::{BorrowedStrDeserializer, MapDeserializer};
use serde::de::IntoDeserializer;
use serde::{Deserialize, Deserializer};
use serde::de::{Deserialize, Deserializer, IntoDeserializer};
use serde_derive::Deserialize;
use serde_test::{assert_de_tokens, assert_de_tokens_error, Token};
use std::borrow::Cow;

View File

@ -34,8 +34,8 @@ use std::time::{Duration, UNIX_EPOCH};
use std::sync::atomic::{AtomicI64, AtomicU64};
use fnv::FnvHasher;
use serde::de::{DeserializeOwned, IntoDeserializer};
use serde::{Deserialize, Deserializer};
use serde::de::{Deserialize, DeserializeOwned, Deserializer, IntoDeserializer};
use serde_derive::Deserialize;
use serde_test::{assert_de_tokens, Configure, Token};
#[macro_use]

View File

@ -5,8 +5,8 @@
)]
#![cfg_attr(feature = "unstable", feature(never_type))]
use serde::de::IntoDeserializer;
use serde::Deserialize;
use serde::de::{Deserialize, IntoDeserializer};
use serde_derive::Deserialize;
use serde_test::{assert_de_tokens_error, Token};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::ffi::{CStr, CString};

View File

@ -20,8 +20,9 @@
clippy::type_repetition_in_bounds
)]
use serde::de::DeserializeOwned;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::de::{Deserialize, DeserializeOwned, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_derive::{Deserialize, Serialize};
use std::borrow::Cow;
use std::marker::PhantomData;
@ -404,7 +405,7 @@ fn test_gen() {
}
mod vis {
use serde::{Deserialize, Serialize};
use serde_derive::{Deserialize, Serialize};
pub struct S;
@ -636,7 +637,7 @@ fn test_gen() {
mod restricted {
mod inner {
use serde::{Deserialize, Serialize};
use serde_derive::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct Restricted {

View File

@ -2,7 +2,7 @@
#![allow(clippy::derive_partial_eq_without_eq)]
use serde::Deserialize;
use serde_derive::Deserialize;
use serde_test::{assert_de_tokens, Token};
#[test]

View File

@ -2,9 +2,11 @@
use serde::de::value::{Error, MapDeserializer, SeqDeserializer};
use serde::de::{
DeserializeSeed, EnumAccess, IgnoredAny, IntoDeserializer, VariantAccess, Visitor,
Deserialize, DeserializeSeed, Deserializer, EnumAccess, IgnoredAny, IntoDeserializer,
VariantAccess, Visitor,
};
use serde::{forward_to_deserialize_any, Deserialize, Deserializer};
use serde::forward_to_deserialize_any;
use serde_derive::Deserialize;
#[derive(PartialEq, Debug, Deserialize)]
enum Target {

View File

@ -8,7 +8,7 @@
mod bytes;
use serde::{Deserialize, Serialize};
use serde_derive::{Deserialize, Serialize};
use serde_test::{
assert_de_tokens, assert_de_tokens_error, assert_ser_tokens, assert_tokens, Token,
};

View File

@ -1,6 +1,6 @@
#![allow(clippy::redundant_field_names)]
use serde::{Deserialize, Serialize};
use serde_derive::{Deserialize, Serialize};
mod remote {
pub struct Unit;

View File

@ -1,6 +1,6 @@
#![allow(clippy::used_underscore_binding)]
use serde::{Deserialize, Serialize};
use serde_derive::{Deserialize, Serialize};
#[test]
fn test_self() {

View File

@ -22,7 +22,7 @@ use std::str;
use std::sync::atomic::{AtomicI64, AtomicU64};
use fnv::FnvHasher;
use serde::Serialize;
use serde_derive::Serialize;
use serde_test::{assert_ser_tokens, assert_ser_tokens_error, Configure, Token};
#[macro_use]

View File

@ -5,7 +5,7 @@
#[test]
fn test_gen_custom_serde() {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(serde_derive::Serialize, serde_derive::Deserialize)]
#[serde(crate = "fake_serde")]
struct Foo;

View File

@ -1,8 +1,8 @@
#![allow(clippy::derive_partial_eq_without_eq, clippy::similar_names)]
use serde::de::value::{self, MapAccessDeserializer};
use serde::de::{IntoDeserializer, MapAccess, Visitor};
use serde::{Deserialize, Deserializer};
use serde::de::{Deserialize, Deserializer, IntoDeserializer, MapAccess, Visitor};
use serde_derive::Deserialize;
use serde_test::{assert_de_tokens, Token};
use std::fmt;

View File

@ -1,4 +1,4 @@
use serde::Serialize;
use serde_derive::Serialize;
#[derive(Serialize)]
#[serde(bound = ""huh)]

View File

@ -1,4 +1,4 @@
use serde::{Deserialize, Serialize};
use serde_derive::{Deserialize, Serialize};
use serde_test::{assert_tokens, Token};
#[test]