Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test for #72455
  • Loading branch information
JohnTitor committed May 23, 2020
commit 47e35cb9bdcb4d2fd66595d566633e9444325ad4
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() {}