]> git.lizzy.rs Git - rust.git/blob - src/test/ui/autoref-autoderef/autoref-intermediate-types-issue-3585.rs
Rollup merge of #62806 - mati865:clippy, r=TimNN
[rust.git] / src / test / ui / autoref-autoderef / autoref-intermediate-types-issue-3585.rs
1 // run-pass
2 #![feature(box_syntax)]
3
4 trait Foo {
5     fn foo(&self) -> String;
6 }
7
8 impl<T:Foo> Foo for Box<T> {
9     fn foo(&self) -> String {
10         format!("box {}", (**self).foo())
11     }
12 }
13
14 impl Foo for usize {
15     fn foo(&self) -> String {
16         format!("{}", *self)
17     }
18 }
19
20 pub fn main() {
21     let x: Box<_> = box 3;
22     assert_eq!(x.foo(), "box 3".to_string());
23 }