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

error: this function's return value is unnecessarily wrapped by `Option`
  --> $DIR/unnecessary_wraps.rs:21:1
   |
LL | / fn func2(a: bool, b: bool) -> Option<i32> {
LL | |     if a && b {
LL | |         return Some(10);
LL | |     }
LL | |     if a { Some(20) } else { Some(30) }
LL | | }
   | |_^
   |
help: remove `Option` from the return type...
   |
LL | fn func2(a: bool, b: bool) -> i32 {
   |                               ~~~
help: ...and then change returning expressions
   |
LL ~         return 10;
LL |     }
LL ~     if a { 20 } else { 30 }
   |

error: this function's return value is unnecessarily wrapped by `Option`
  --> $DIR/unnecessary_wraps.rs:39:1
   |
LL | / fn func5() -> Option<i32> {
LL | |     Some(1)
LL | | }
   | |_^
   |
help: remove `Option` from the return type...
   |
LL | fn func5() -> i32 {
   |               ~~~
help: ...and then change returning expressions
   |
LL |     1
   |

error: this function's return value is unnecessarily wrapped by `Result`
  --> $DIR/unnecessary_wraps.rs:49:1
   |
LL | / fn func7() -> Result<i32, ()> {
LL | |     Ok(1)
LL | | }
   | |_^
   |
help: remove `Result` from the return type...
   |
LL | fn func7() -> i32 {
   |               ~~~
help: ...and then change returning expressions
   |
LL |     1
   |

error: this function's return value is unnecessarily wrapped by `Option`
  --> $DIR/unnecessary_wraps.rs:77:5
   |
LL | /     fn func12() -> Option<i32> {
LL | |         Some(1)
LL | |     }
   | |_____^
   |
help: remove `Option` from the return type...
   |
LL |     fn func12() -> i32 {
   |                    ~~~
help: ...and then change returning expressions
   |
LL |         1
   |

error: this function's return value is unnecessary
  --> $DIR/unnecessary_wraps.rs:104:1
   |
LL | / fn issue_6640_1(a: bool, b: bool) -> Option<()> {
LL | |     if a && b {
LL | |         return Some(());
LL | |     }
...  |
LL | |     }
LL | | }
   | |_^
   |
help: remove the return type...
   |
LL | fn issue_6640_1(a: bool, b: bool) -> Option<()> {
   |                                      ~~~~~~~~~~
help: ...and then remove returned values
   |
LL ~         return ;
LL |     }
LL |     if a {
LL |         Some(());
LL ~         
LL |     } else {
LL ~         return ;
   |

error: this function's return value is unnecessary
  --> $DIR/unnecessary_wraps.rs:117:1
   |
LL | / fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
LL | |     if a && b {
LL | |         return Ok(());
LL | |     }
...  |
LL | |     }
LL | | }
   | |_^
   |
help: remove the return type...
   |
LL | fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
   |                                      ~~~~~~~~~~~~~~~
help: ...and then remove returned values
   |
LL ~         return ;
LL |     }
LL |     if a {
LL ~         
LL |     } else {
LL ~         return ;
   |

error: aborting due to 7 previous errors