Skip to content

Commit

Permalink
Add test for rust-lang#72455
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed May 23, 2020
1 parent 58fe05a commit 47e35cb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/test/ui/issues/issue-72455.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// check-pass

pub trait ResultExt {
type Ok;
fn err_eprint_and_ignore(self) -> Option<Self::Ok>;
}

impl<O, E> ResultExt for std::result::Result<O, E>
where
E: std::error::Error,
{
type Ok = O;
fn err_eprint_and_ignore(self) -> Option<O>
where
Self: ,
{
match self {
Err(e) => {
eprintln!("{}", e);
None
}
Ok(o) => Some(o),
}
}
}

fn main() {}

0 comments on commit 47e35cb

Please sign in to comment.