Commit 13eff4e
committed
refactor: clean up "event_observer" logic
The `event_observer` field in the Vmm struct is of type Option<Stdin>.
There are two problems
1. With the way the code is written, it will never be `None`
2. `Stdin` is a singleton, there is no need to store it _anywhere_.
With that in mind, we can just remove this field, and update its two
uses to just directly operate on std::io::stdin(). Since it never
`None', we can also remove the logic that matches and handles the `None`
case. Furthermore, the `Drop` impl used to print the same error message
twice in case resetting stdin to canonical mode failed, so fix that to
only print it once.
Signed-off-by: Patrick Roy <[email protected]>1 parent 1b1e9a6 commit 13eff4e
2 files changed
+11
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | 275 | | |
277 | 276 | | |
278 | 277 | | |
| |||
473 | 472 | | |
474 | 473 | | |
475 | 474 | | |
476 | | - | |
477 | 475 | | |
478 | 476 | | |
479 | 477 | | |
| |||
722 | 720 | | |
723 | 721 | | |
724 | 722 | | |
725 | | - | |
726 | 723 | | |
727 | 724 | | |
728 | 725 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | 248 | | |
253 | 249 | | |
254 | 250 | | |
| |||
293 | 289 | | |
294 | 290 | | |
295 | 291 | | |
296 | | - | |
297 | 292 | | |
298 | 293 | | |
299 | 294 | | |
| |||
343 | 338 | | |
344 | 339 | | |
345 | 340 | | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
351 | 346 | | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
357 | 351 | | |
358 | 352 | | |
359 | 353 | | |
| |||
760 | 754 | | |
761 | 755 | | |
762 | 756 | | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
| 757 | + | |
| 758 | + | |
770 | 759 | | |
771 | 760 | | |
772 | 761 | | |
| |||
0 commit comments