Keep conditional compilation cfg naming consistent with serde crate

The serde crate's build.rs uses names like `core_duration` or
`integer128`, not `has_core_duration` / `has_integer128`.
This commit is contained in:
David Tolnay 2021-01-23 14:57:10 -08:00
parent 9add5812e2
commit 012ea8eb84
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ fn main() {
// #[track_caller] stabilized in Rust 1.46:
// https://blog.rust-lang.org/2020/08/27/Rust-1.46.0.html#track_caller
if minor >= 46 {
println!("cargo:rustc-cfg=has_track_caller");
println!("cargo:rustc-cfg=track_caller");
}
}

View File

@ -28,7 +28,7 @@ use std::fmt::Debug;
/// Token::StructEnd,
/// ]);
/// ```
#[cfg_attr(has_track_caller, track_caller)]
#[cfg_attr(track_caller, track_caller)]
pub fn assert_tokens<'de, T>(value: &T, tokens: &'de [Token])
where
T: Serialize + Deserialize<'de> + PartialEq + Debug,
@ -59,7 +59,7 @@ where
/// Token::StructEnd,
/// ]);
/// ```
#[cfg_attr(has_track_caller, track_caller)]
#[cfg_attr(track_caller, track_caller)]
pub fn assert_ser_tokens<T>(value: &T, tokens: &[Token])
where
T: Serialize,
@ -112,7 +112,7 @@ where
/// assert_ser_tokens_error(&example, expected, error);
/// }
/// ```
#[cfg_attr(has_track_caller, track_caller)]
#[cfg_attr(track_caller, track_caller)]
pub fn assert_ser_tokens_error<T>(value: &T, tokens: &[Token], error: &str)
where
T: Serialize,
@ -150,7 +150,7 @@ where
/// Token::StructEnd,
/// ]);
/// ```
#[cfg_attr(has_track_caller, track_caller)]
#[cfg_attr(track_caller, track_caller)]
pub fn assert_de_tokens<'de, T>(value: &T, tokens: &'de [Token])
where
T: Deserialize<'de> + PartialEq + Debug,
@ -203,7 +203,7 @@ where
/// "unknown field `x`, expected `a` or `b`",
/// );
/// ```
#[cfg_attr(has_track_caller, track_caller)]
#[cfg_attr(track_caller, track_caller)]
pub fn assert_de_tokens_error<'de, T>(tokens: &'de [Token], error: &str)
where
T: Deserialize<'de>,