File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,12 @@ mod issue6501 {
112112 };
113113 let _ = || {};
114114 }
115+
116+ struct Foo;
117+ #[allow(clippy::unnecessary_lazy_evaluations)]
118+ fn bar(res: Result<Foo, u8>) -> Foo {
119+ res.unwrap_or_else(|_| Foo)
120+ }
115121}
116122
117123fn main() {
Original file line number Diff line number Diff line change @@ -112,6 +112,12 @@ mod issue6501 {
112112 } ;
113113 let _ = || return ;
114114 }
115+
116+ struct Foo ;
117+ #[ allow( clippy:: unnecessary_lazy_evaluations) ]
118+ fn bar ( res : Result < Foo , u8 > ) -> Foo {
119+ res. unwrap_or_else ( |_| return Foo )
120+ }
115121}
116122
117123fn main ( ) {
Original file line number Diff line number Diff line change @@ -102,5 +102,11 @@ error: unneeded `return` statement
102102LL | let _ = || return;
103103 | ^^^^^^ help: replace `return` with an empty block: `{}`
104104
105- error: aborting due to 17 previous errors
105+ error: unneeded `return` statement
106+ --> $DIR/needless_return.rs:119:32
107+ |
108+ LL | res.unwrap_or_else(|_| return Foo)
109+ | ^^^^^^^^^^ help: remove `return`: `Foo`
110+
111+ error: aborting due to 18 previous errors
106112
You can’t perform that action at this time.
0 commit comments