1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::borrow::Cow;

pub trait Moo {
    fn moo(&self) -> ! {
        panic!("Moooooooooo!")
    }
}

impl<'a, T> Moo for Cow<'a, T>
where
    T: ToOwned + ?Sized
{
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    #[should_panic(expected = "Moooooooooo!")]
    fn it_moos() {
        Cow::Borrowed("lol").moo()
    }
}