Skip to content

Commit ad6bf18

Browse files
committed
refactor: drop usage of std::io::Sink
This type is only useful if we are dynamically dispatching io via the Read/Write traits, but we are not doing that (we converted everything to static dispatch a while back, for better or for worse, and to avoid conflicts with the PCI branch, I'm not reverting that here). Signed-off-by: Patrick Roy <[email protected]>
1 parent 0041df7 commit ad6bf18

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/vmm/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ pub(crate) mod tests {
889889
SerialEventsWrapper {
890890
buffer_ready_event_fd: None,
891891
},
892-
SerialOut::Sink(std::io::sink()),
892+
SerialOut::Sink,
893893
),
894894
input: None,
895895
}))),

src/vmm/src/device_manager/legacy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl PortIODeviceManager {
111111
SerialEventsWrapper {
112112
buffer_ready_event_fd: None,
113113
},
114-
SerialOut::Sink(std::io::sink()),
114+
SerialOut::Sink
115115
),
116116
input: None,
117117
})));
@@ -121,7 +121,7 @@ impl PortIODeviceManager {
121121
SerialEventsWrapper {
122122
buffer_ready_event_fd: None,
123123
},
124-
SerialOut::Sink(std::io::sink()),
124+
SerialOut::Sink
125125
),
126126
input: None,
127127
})));
@@ -257,7 +257,7 @@ mod tests {
257257
SerialEventsWrapper {
258258
buffer_ready_event_fd: None,
259259
},
260-
SerialOut::Sink(std::io::sink()),
260+
SerialOut::Sink,
261261
),
262262
input: None,
263263
}))),

src/vmm/src/devices/legacy/serial.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,19 @@ impl SerialEvents for SerialEventsWrapper {
125125

126126
#[derive(Debug)]
127127
pub enum SerialOut {
128-
Sink(std::io::Sink),
128+
Sink,
129129
Stdout(std::io::Stdout),
130130
}
131131
impl std::io::Write for SerialOut {
132132
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
133133
match self {
134-
Self::Sink(sink) => sink.write(buf),
134+
Self::Sink => Ok(buf.len()),
135135
Self::Stdout(stdout) => stdout.write(buf),
136136
}
137137
}
138138
fn flush(&mut self) -> std::io::Result<()> {
139139
match self {
140-
Self::Sink(sink) => sink.flush(),
140+
Self::Sink => Ok(()),
141141
Self::Stdout(stdout) => stdout.flush(),
142142
}
143143
}
@@ -382,7 +382,7 @@ mod tests {
382382
SerialEventsWrapper {
383383
buffer_ready_event_fd: None,
384384
},
385-
SerialOut::Sink(std::io::sink()),
385+
SerialOut::Sink,
386386
),
387387
input: None::<std::io::Stdin>,
388388
};

0 commit comments

Comments
 (0)