1 #![warn(clippy::unnecessary_wraps)]
2 #![allow(clippy::no_effect)]
3 #![allow(clippy::needless_return)]
4 #![allow(clippy::if_same_then_else)]
8 fn func1(a: bool, b: bool) -> Option<i32> {
21 fn func2(a: bool, b: bool) -> Option<i32> {
25 if a { Some(20) } else { Some(30) }
28 // public fns should not be linted
29 pub fn func3(a: bool) -> Option<i32> {
30 if a { Some(1) } else { Some(1) }
33 // should not be linted
34 fn func4(a: bool) -> Option<i32> {
35 if a { Some(1) } else { None }
39 fn func5() -> Option<i32> {
43 // should not be linted
44 fn func6() -> Option<i32> {
49 fn func7() -> Result<i32, ()> {
53 // should not be linted
54 fn func8(a: bool) -> Result<i32, ()> {
55 if a { Ok(1) } else { Err(()) }
58 // should not be linted
59 fn func9(a: bool) -> Result<i32, ()> {
63 // should not be linted
64 fn func10() -> Option<()> {
71 // should not be linted
72 pub fn func11() -> Option<i32> {
77 fn func12() -> Option<i32> {
83 // trait impls are not linted
84 fn func13() -> Option<i32> {
90 // trait impls are not linted
91 fn func13() -> Option<i32> {
96 fn issue_6384(s: &str) -> Option<&str> {
104 fn issue_6640_1(a: bool, b: bool) -> Option<()> {
117 fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
128 // should not be linted
129 fn issue_6640_3() -> Option<()> {
130 if true { Some(()) } else { None }
133 // should not be linted
134 fn issue_6640_4() -> Result<(), ()> {
135 if true { Ok(()) } else { Err(()) }
139 // method calls are not linted
142 issue_6640_1(true, true);
143 issue_6640_2(true, true);