Commit 28f7ec2
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 ad6bf18 commit 28f7ec2
2 files changed
+11
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | 181 | | |
183 | 182 | | |
184 | 183 | | |
| |||
900 | 899 | | |
901 | 900 | | |
902 | 901 | | |
903 | | - | |
904 | 902 | | |
905 | 903 | | |
906 | 904 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | 256 | | |
261 | 257 | | |
262 | 258 | | |
| |||
299 | 295 | | |
300 | 296 | | |
301 | 297 | | |
302 | | - | |
303 | 298 | | |
304 | 299 | | |
305 | 300 | | |
| |||
363 | 358 | | |
364 | 359 | | |
365 | 360 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
371 | 366 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
377 | 371 | | |
378 | 372 | | |
379 | 373 | | |
| |||
850 | 844 | | |
851 | 845 | | |
852 | 846 | | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
| 847 | + | |
| 848 | + | |
860 | 849 | | |
861 | 850 | | |
862 | 851 | | |
| |||
0 commit comments