]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_wraps.stderr
Auto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum
[rust.git] / tests / ui / unnecessary_wraps.stderr
1 error: this function's return value is unnecessarily wrapped by `Option`
2   --> $DIR/unnecessary_wraps.rs:8:1
3    |
4 LL | / fn func1(a: bool, b: bool) -> Option<i32> {
5 LL | |     if a && b {
6 LL | |         return Some(42);
7 LL | |     }
8 ...  |
9 LL | |     }
10 LL | | }
11    | |_^
12    |
13    = note: `-D clippy::unnecessary-wraps` implied by `-D warnings`
14 help: remove `Option` from the return type...
15    |
16 LL | fn func1(a: bool, b: bool) -> i32 {
17    |                               ^^^
18 help: ...and then change returning expressions
19    |
20 LL |         return 42;
21 LL |     }
22 LL |     if a {
23 LL |         Some(-1);
24 LL |         2
25 LL |     } else {
26  ...
27
28 error: this function's return value is unnecessarily wrapped by `Option`
29   --> $DIR/unnecessary_wraps.rs:21:1
30    |
31 LL | / fn func2(a: bool, b: bool) -> Option<i32> {
32 LL | |     if a && b {
33 LL | |         return Some(10);
34 LL | |     }
35 LL | |     if a { Some(20) } else { Some(30) }
36 LL | | }
37    | |_^
38    |
39 help: remove `Option` from the return type...
40    |
41 LL | fn func2(a: bool, b: bool) -> i32 {
42    |                               ^^^
43 help: ...and then change returning expressions
44    |
45 LL |         return 10;
46 LL |     }
47 LL |     if a { 20 } else { 30 }
48    |
49
50 error: this function's return value is unnecessarily wrapped by `Option`
51   --> $DIR/unnecessary_wraps.rs:39:1
52    |
53 LL | / fn func5() -> Option<i32> {
54 LL | |     Some(1)
55 LL | | }
56    | |_^
57    |
58 help: remove `Option` from the return type...
59    |
60 LL | fn func5() -> i32 {
61    |               ^^^
62 help: ...and then change returning expressions
63    |
64 LL |     1
65    |
66
67 error: this function's return value is unnecessarily wrapped by `Result`
68   --> $DIR/unnecessary_wraps.rs:49:1
69    |
70 LL | / fn func7() -> Result<i32, ()> {
71 LL | |     Ok(1)
72 LL | | }
73    | |_^
74    |
75 help: remove `Result` from the return type...
76    |
77 LL | fn func7() -> i32 {
78    |               ^^^
79 help: ...and then change returning expressions
80    |
81 LL |     1
82    |
83
84 error: this function's return value is unnecessarily wrapped by `Option`
85   --> $DIR/unnecessary_wraps.rs:77:5
86    |
87 LL | /     fn func12() -> Option<i32> {
88 LL | |         Some(1)
89 LL | |     }
90    | |_____^
91    |
92 help: remove `Option` from the return type...
93    |
94 LL |     fn func12() -> i32 {
95    |                    ^^^
96 help: ...and then change returning expressions
97    |
98 LL |         1
99    |
100
101 error: this function's return value is unnecessary
102   --> $DIR/unnecessary_wraps.rs:104:1
103    |
104 LL | / fn issue_6640_1(a: bool, b: bool) -> Option<()> {
105 LL | |     if a && b {
106 LL | |         return Some(());
107 LL | |     }
108 ...  |
109 LL | |     }
110 LL | | }
111    | |_^
112    |
113 help: remove the return type...
114    |
115 LL | fn issue_6640_1(a: bool, b: bool) -> Option<()> {
116    |                                      ^^^^^^^^^^
117 help: ...and then remove returned values
118    |
119 LL |         return ;
120 LL |     }
121 LL |     if a {
122 LL |         Some(());
123 LL |         
124 LL |     } else {
125  ...
126
127 error: this function's return value is unnecessary
128   --> $DIR/unnecessary_wraps.rs:117:1
129    |
130 LL | / fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
131 LL | |     if a && b {
132 LL | |         return Ok(());
133 LL | |     }
134 ...  |
135 LL | |     }
136 LL | | }
137    | |_^
138    |
139 help: remove the return type...
140    |
141 LL | fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
142    |                                      ^^^^^^^^^^^^^^^
143 help: ...and then remove returned values
144    |
145 LL |         return ;
146 LL |     }
147 LL |     if a {
148 LL |         
149 LL |     } else {
150 LL |         return ;
151    |
152
153 error: aborting due to 7 previous errors
154