Commit 83f77b3
committed
refactor: use #[from] in VmmError
When a variant wraps another error type, and this error type does not
appear in any other variant, use thiserrors #[from] directive to
implement a `From` impl. This allows eliminating almost all remaining
`map_err`s from `create_vmm_and_vcpus`, as the `?` operator will
automatically call .from() once (although it cannot do it for multiple
layers of wrapping, which is why it was important to change the function
to return VmmError).
Signed-off-by: Patrick Roy <[email protected]>1 parent 5bc902b commit 83f77b3
2 files changed
+8
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
166 | | - | |
167 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| |||
0 commit comments