]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/issue-72455.rs
Auto merge of #101017 - JohnTitor:rollup-73f2fhb, r=JohnTitor
[rust.git] / src / test / ui / traits / issue-72455.rs
1 // check-pass
2
3 pub trait ResultExt {
4     type Ok;
5     fn err_eprint_and_ignore(self) -> Option<Self::Ok>;
6 }
7
8 impl<O, E> ResultExt for std::result::Result<O, E>
9 where
10     E: std::error::Error,
11 {
12     type Ok = O;
13     fn err_eprint_and_ignore(self) -> Option<O>
14     where
15         Self: ,
16     {
17         match self {
18             Err(e) => {
19                 eprintln!("{}", e);
20                 None
21             }
22             Ok(o) => Some(o),
23         }
24     }
25 }
26
27 fn main() {}