1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 15:42:57 +01:00

fix bytestring test on older rust versions

This commit is contained in:
Rob Ede 2021-11-28 01:19:57 +00:00
parent de5908bfe7
commit 5556afd524
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 12 additions and 5 deletions

View File

@ -25,3 +25,4 @@ serde = { version = "1.0", optional = true }
ahash = { version = "0.7.6", default-features = false } ahash = { version = "0.7.6", default-features = false }
serde_json = "1.0" serde_json = "1.0"
static_assertions = "1.1" static_assertions = "1.1"
rustversion = "1"

View File

@ -231,10 +231,7 @@ mod serde {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use alloc::borrow::ToOwned; use alloc::borrow::ToOwned;
use core::{ use core::hash::{Hash, Hasher};
hash::{Hash, Hasher},
panic::{RefUnwindSafe, UnwindSafe},
};
use ahash::AHasher; use ahash::AHasher;
use static_assertions::assert_impl_all; use static_assertions::assert_impl_all;
@ -242,10 +239,19 @@ mod test {
use super::*; use super::*;
assert_impl_all!(ByteString: Send, Sync, Unpin, Sized); assert_impl_all!(ByteString: Send, Sync, Unpin, Sized);
assert_impl_all!(ByteString: UnwindSafe, RefUnwindSafe);
assert_impl_all!(ByteString: Clone, Default, Eq, PartialOrd, Ord); assert_impl_all!(ByteString: Clone, Default, Eq, PartialOrd, Ord);
assert_impl_all!(ByteString: fmt::Debug, fmt::Display); assert_impl_all!(ByteString: fmt::Debug, fmt::Display);
#[rustversion::since(1.56)]
mod above_1_56_impls {
// `[Ref]UnwindSafe` traits were only in std until rust 1.56
use core::panic::{RefUnwindSafe, UnwindSafe};
use super::*;
assert_impl_all!(ByteString: UnwindSafe, RefUnwindSafe);
}
#[test] #[test]
fn test_partial_eq() { fn test_partial_eq() {
let s: ByteString = ByteString::from_static("test"); let s: ByteString = ByteString::from_static("test");