3 #![allow(unused, clippy::needless_bool)]
4 #![allow(clippy::if_same_then_else, clippy::single_match)]
5 #![warn(clippy::needless_return)]
7 macro_rules! the_answer {
13 fn test_end_of_fn() -> bool {
21 fn test_no_semicolon() -> bool {
25 fn test_if_block() -> bool {
33 fn test_match(x: bool) -> bool {
49 fn test_macro_call() -> i32 {
57 fn test_void_if_fun(b: bool) {
65 fn test_void_match(x: u32) {
72 fn read_line() -> String {
74 let stdin = ::std::io::stdin();
75 return stdin.lock().lines().next().unwrap().unwrap();
78 fn borrows_but_not_last(value: bool) -> String {
81 let stdin = ::std::io::stdin();
82 let _a = stdin.lock().lines().next().unwrap().unwrap();
89 macro_rules! needed_return {
97 fn test_return_in_macro() {
98 // This will return and the macro below won't be executed. Removing the `return` from the macro
99 // will change semantics.
105 fn foo(bar: Result<(), ()>) {
106 bar.unwrap_or_else(|_| {})
117 #[allow(clippy::unnecessary_lazy_evaluations)]
118 fn bar(res: Result<Foo, u8>) -> Foo {
119 res.unwrap_or_else(|_| Foo)
124 let _ = test_end_of_fn();
125 let _ = test_no_semicolon();
126 let _ = test_if_block();
127 let _ = test_match(true);