Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues pointed out by Clippy in examples and tests #172

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/clear_input_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn input_service() -> mpsc::Receiver<()> {
drop(tx); // EOF, drop the channel and stop the thread
break;
}
Ok(_) => tx.send(()).unwrap(), // Signal main to clear the buffer
Ok(_bytes_read) => tx.send(()).unwrap(), // Signal main to clear the buffer
Err(e) => panic_any(e),
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/clear_output_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn run(port_name: &str, baud_rate: &str, block_size: usize) -> Result<(), Box<dy
// This loop writes the block repeatedly, as fast as possible, to try to saturate the
// output buffer. If you don't see much data queued to send, try changing the block size.
loop {
match port.write(&block) {
match port.write_all(&block) {
Ok(_) => (),
Err(ref e) if e.kind() == io::ErrorKind::TimedOut => (),
Err(e) => panic!("Error while writing data to the port: {}", e),
Expand Down Expand Up @@ -125,7 +125,7 @@ fn input_service() -> mpsc::Receiver<()> {
drop(tx); // EOF, drop the channel and stop the thread
break;
}
Ok(_) => tx.send(()).unwrap(), // Signal main to clear the buffer
Ok(_bytes_read) => tx.send(()).unwrap(), // Signal main to clear the buffer
Err(e) => panic_any(e),
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn test_osx_pty_pair() {
let (output_sink, output_stream) = std::sync::mpsc::sync_channel(1);
let name = slave.name().unwrap();

master.write("12".as_bytes()).expect("");
master.write_all("12".as_bytes()).expect("");

let reader_thread = std::thread::spawn(move || {
let mut port = TTYPort::open(&serialport::new(&name, 0)).expect("unable to open");
Expand Down
Loading