This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -42,20 +42,30 @@ fn func4() -> Option<i32> {
42
42
Some(1)
43
43
}
44
44
45
+ // should not be linted
46
+ fn func5() -> Option<i32> {
47
+ None
48
+ }
49
+
45
50
// should be linted
46
- fn func5 () -> Result<i32, ()> {
51
+ fn func6 () -> Result<i32, ()> {
47
52
Ok(1)
48
53
}
49
54
50
55
// should not be linted
51
- fn func6 (a: bool) -> Result<i32, ()> {
56
+ fn func7 (a: bool) -> Result<i32, ()> {
52
57
if a {
53
58
Ok(1)
54
59
} else {
55
60
Err(())
56
61
}
57
62
}
58
63
64
+ // should not be linted
65
+ fn func8(a: bool) -> Result<i32, ()> {
66
+ Err(())
67
+ }
68
+
59
69
fn main() {
60
70
// method calls are not linted
61
71
func1(true, true);
Original file line number Diff line number Diff line change @@ -42,20 +42,30 @@ fn func4() -> Option<i32> {
42
42
Some ( 1 )
43
43
}
44
44
45
+ // should not be linted
46
+ fn func5 ( ) -> Option < i32 > {
47
+ None
48
+ }
49
+
45
50
// should be linted
46
- fn func5 ( ) -> Result < i32 , ( ) > {
51
+ fn func6 ( ) -> Result < i32 , ( ) > {
47
52
Ok ( 1 )
48
53
}
49
54
50
55
// should not be linted
51
- fn func6 ( a : bool ) -> Result < i32 , ( ) > {
56
+ fn func7 ( a : bool ) -> Result < i32 , ( ) > {
52
57
if a {
53
58
Ok ( 1 )
54
59
} else {
55
60
Err ( ( ) )
56
61
}
57
62
}
58
63
64
+ // should not be linted
65
+ fn func8 ( a : bool ) -> Result < i32 , ( ) > {
66
+ Err ( ( ) )
67
+ }
68
+
59
69
fn main ( ) {
60
70
// method calls are not linted
61
71
func1 ( true , true ) ;
Original file line number Diff line number Diff line change @@ -36,16 +36,16 @@ LL | 1
36
36
|
37
37
38
38
error: this function returns unnecessarily wrapping data
39
- --> $DIR/unnecessary_wrap.rs:46 :1
39
+ --> $DIR/unnecessary_wrap.rs:51 :1
40
40
|
41
- LL | / fn func5 () -> Result<i32, ()> {
41
+ LL | / fn func6 () -> Result<i32, ()> {
42
42
LL | | Ok(1)
43
43
LL | | }
44
44
| |_^
45
45
|
46
46
help: factor this out to
47
47
|
48
- LL | fn func5 () -> i32 {
48
+ LL | fn func6 () -> i32 {
49
49
LL | 1
50
50
|
51
51
You can’t perform that action at this time.
0 commit comments