We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 58fe05a commit 47e35cbCopy full SHA for 47e35cb
src/test/ui/issues/issue-72455.rs
@@ -0,0 +1,27 @@
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() {}
0 commit comments