#![allow(
clippy::unused_self,
clippy::needless_borrow,
reason = "the receiver shape is the autoref specialization probe"
)]
use crate::metis::{Cut, VersionVector};
use core::marker::PhantomData;
struct Probe<T>(PhantomData<T>);
impl<T: Default> Probe<T> {
fn has_default(&self) -> bool {
true
}
}
impl<T: From<VersionVector>> Probe<T> {
fn has_from(&self) -> bool {
true
}
}
trait FallbackDefault {
fn has_default(&self) -> bool {
false
}
}
impl<T> FallbackDefault for &Probe<T> {}
trait FallbackFrom {
fn has_from(&self) -> bool {
false
}
}
impl<T> FallbackFrom for &Probe<T> {}
#[test]
fn cut_has_no_default() {
assert!(!(&Probe::<Cut>(PhantomData)).has_default());
assert!((&Probe::<VersionVector>(PhantomData)).has_default());
}
#[test]
fn cut_has_no_vector_from() {
assert!(!(&Probe::<Cut>(PhantomData)).has_from());
assert!((&Probe::<VersionVector>(PhantomData)).has_from());
}