From f5dffcc7f089b3f33db0a2f771d56f330609b7e4 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 9 Dec 2022 11:02:30 +0800 Subject: refactor: take AsFd by value --- test/sys/test_termios.rs | 2 +- test/test.rs | 2 +- test/test_pty.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/sys/test_termios.rs b/test/sys/test_termios.rs index cf55b10c..83919378 100644 --- a/test/sys/test_termios.rs +++ b/test/sys/test_termios.rs @@ -8,7 +8,7 @@ use nix::sys::termios::{self, tcgetattr, LocalFlags, OutputFlags}; use nix::unistd::{read, write}; /// Helper function analogous to `std::io::Write::write_all`, but for `Fd`s -fn write_all(f: &Fd, buf: &[u8]) { +fn write_all(f: Fd, buf: &[u8]) { let mut len = 0; while len < buf.len() { len += write(f.as_fd().as_raw_fd(), &buf[len..]).unwrap(); diff --git a/test/test.rs b/test/test.rs index b139ec3a..efd5fd2a 100644 --- a/test/test.rs +++ b/test/test.rs @@ -70,7 +70,7 @@ use std::os::unix::io::{AsFd, AsRawFd}; use std::path::PathBuf; /// Helper function analogous to `std::io::Read::read_exact`, but for `Fd`s -fn read_exact(f: &Fd, buf: &mut [u8]) { +fn read_exact(f: Fd, buf: &mut [u8]) { let mut len = 0; while len < buf.len() { // get_mut would be better than split_at_mut, but it requires nightly diff --git a/test/test_pty.rs b/test/test_pty.rs index e1286e55..9ee94470 100644 --- a/test/test_pty.rs +++ b/test/test_pty.rs @@ -135,7 +135,7 @@ fn test_open_ptty_pair() { } /// Put the terminal in raw mode. -fn make_raw(fd: &Fd) { +fn make_raw(fd: Fd) { let mut termios = tcgetattr(fd).unwrap(); cfmakeraw(&mut termios); tcsetattr(fd, SetArg::TCSANOW, &termios).unwrap(); -- cgit v1.2.3