Skip to content
Open
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/read_serialport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn main() -> io::Result<()> {
// This should never happen as we only registered our
// `UdpSocket` using the `UDP_SOCKET` token, but if it ever
// does we'll log it.
error!("Got event for unexpected token: {:?}", event);
error!("Got event for unexpected token: {event:?}");
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ mod os_prelude {
pub use winapi::um::fileapi::*;
pub use winapi::um::handleapi::INVALID_HANDLE_VALUE;
pub use winapi::um::winbase::{COMMTIMEOUTS, FILE_FLAG_OVERLAPPED};
pub use winapi::um::winnt::{
FILE_ATTRIBUTE_NORMAL, GENERIC_READ, GENERIC_WRITE, HANDLE,
};
pub use winapi::um::winnt::{FILE_ATTRIBUTE_NORMAL, GENERIC_READ, GENERIC_WRITE, HANDLE};
}
use os_prelude::*;

Expand Down Expand Up @@ -668,7 +666,7 @@ mod io {
}
}

impl<'a> Read for &'a SerialStream {
impl Read for &SerialStream {
fn read(&mut self, bytes: &mut [u8]) -> StdIoResult<usize> {
uninterruptibly!(match unsafe {
libc::read(
Expand All @@ -683,7 +681,7 @@ mod io {
}
}

impl<'a> Write for &'a SerialStream {
impl Write for &SerialStream {
fn write(&mut self, bytes: &[u8]) -> StdIoResult<usize> {
uninterruptibly!(match unsafe {
libc::write(
Expand Down
15 changes: 6 additions & 9 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ impl Drop for Fixture {
self.process.kill().ok();
thread::sleep(Duration::from_millis(1000));
log::trace!("removing link: {:?}", self.port_a);
std::fs::remove_file(&self.port_a).ok();
std::fs::remove_file(self.port_a).ok();
log::trace!("removing link: {:?}", self.port_b);
std::fs::remove_file(&self.port_b).ok();
std::fs::remove_file(self.port_b).ok();
thread::sleep(Duration::from_millis(1000));
}
}
Expand All @@ -200,14 +200,11 @@ impl Fixture {
pub fn new(port_a: &'static str, port_b: &'static str) -> Self {
use std::sync::atomic::{AtomicUsize, Ordering};
static N: AtomicUsize = AtomicUsize::new(0);
LOGGING_INIT.call_once(|| env_logger::init());
LOGGING_INIT.call_once(env_logger::init);
let n = N.fetch_add(1, Ordering::Relaxed);
let port_a = format!("{}{}", port_a, n).leak();
let port_b = format!("{}{}", port_b, n).leak();
let args = [
format!("PTY,link={}", port_a),
format!("PTY,link={}", port_b),
];
let port_a = format!("{port_a}{n}").leak();
let port_b = format!("{port_b}{n}").leak();
let args = [format!("PTY,link={port_a}"), format!("PTY,link={port_b}")];
log::trace!("starting process: socat {} {}", args[0], args[1]);

let process = process::Command::new("socat")
Expand Down
Loading