Skip to content

Commit c863739

Browse files
committed
cargo fix --edition=2018
1 parent 1326fc3 commit c863739

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

src/handle.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl Handle {
3636
pub fn write(&self, buf: &[u8]) -> io::Result<usize> {
3737
let mut bytes = 0;
3838
let len = cmp::min(buf.len(), <DWORD>::max_value() as usize) as DWORD;
39-
::cvt(unsafe {
39+
crate::cvt(unsafe {
4040
WriteFile(
4141
self.0,
4242
buf.as_ptr() as *const _,
@@ -51,7 +51,7 @@ impl Handle {
5151
pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
5252
let mut bytes = 0;
5353
let len = cmp::min(buf.len(), <DWORD>::max_value() as usize) as DWORD;
54-
::cvt(unsafe {
54+
crate::cvt(unsafe {
5555
ReadFile(
5656
self.0,
5757
buf.as_mut_ptr() as *mut _,
@@ -90,7 +90,7 @@ impl Handle {
9090
wait: BOOLEAN,
9191
) -> io::Result<Option<usize>> {
9292
let len = cmp::min(buf.len(), <DWORD>::max_value() as usize) as DWORD;
93-
let res = ::cvt({
93+
let res = crate::cvt({
9494
ReadFile(
9595
self.0,
9696
buf.as_mut_ptr() as *mut _,
@@ -106,7 +106,7 @@ impl Handle {
106106
}
107107

108108
let mut bytes = 0;
109-
let res = ::cvt({ GetOverlappedResult(self.0, overlapped, &mut bytes, wait as BOOL) });
109+
let res = crate::cvt({ GetOverlappedResult(self.0, overlapped, &mut bytes, wait as BOOL) });
110110
match res {
111111
Ok(_) => Ok(Some(bytes as usize)),
112112
Err(ref e) if e.raw_os_error() == Some(ERROR_IO_INCOMPLETE as i32) && wait == FALSE => {
@@ -143,7 +143,7 @@ impl Handle {
143143
wait: BOOLEAN,
144144
) -> io::Result<Option<usize>> {
145145
let len = cmp::min(buf.len(), <DWORD>::max_value() as usize) as DWORD;
146-
let res = ::cvt({
146+
let res = crate::cvt({
147147
WriteFile(
148148
self.0,
149149
buf.as_ptr() as *const _,
@@ -159,7 +159,7 @@ impl Handle {
159159
}
160160

161161
let mut bytes = 0;
162-
let res = ::cvt({ GetOverlappedResult(self.0, overlapped, &mut bytes, wait as BOOL) });
162+
let res = crate::cvt({ GetOverlappedResult(self.0, overlapped, &mut bytes, wait as BOOL) });
163163
match res {
164164
Ok(_) => Ok(Some(bytes as usize)),
165165
Err(ref e) if e.raw_os_error() == Some(ERROR_IO_INCOMPLETE as i32) && wait == FALSE => {

src/iocp.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use std::mem;
77
use std::os::windows::io::*;
88
use std::time::Duration;
99

10-
use handle::Handle;
10+
use crate::handle::Handle;
1111
use winapi::shared::basetsd::*;
1212
use winapi::shared::ntdef::*;
1313
use winapi::um::handleapi::*;
1414
use winapi::um::ioapiset::*;
1515
use winapi::um::minwinbase::*;
16-
use Overlapped;
16+
use crate::Overlapped;
1717

1818
/// A handle to an Windows I/O Completion Port.
1919
#[derive(Debug)]
@@ -110,7 +110,7 @@ impl CompletionPort {
110110
let mut bytes = 0;
111111
let mut token = 0;
112112
let mut overlapped = 0 as *mut _;
113-
let timeout = ::dur2ms(timeout);
113+
let timeout = crate::dur2ms(timeout);
114114
let ret = unsafe {
115115
GetQueuedCompletionStatus(
116116
self.handle.raw(),
@@ -120,7 +120,7 @@ impl CompletionPort {
120120
timeout,
121121
)
122122
};
123-
::cvt(ret).map(|_| {
123+
crate::cvt(ret).map(|_| {
124124
CompletionStatus(OVERLAPPED_ENTRY {
125125
dwNumberOfBytesTransferred: bytes,
126126
lpCompletionKey: token,
@@ -149,7 +149,7 @@ impl CompletionPort {
149149
mem::size_of::<OVERLAPPED_ENTRY>()
150150
);
151151
let mut removed = 0;
152-
let timeout = ::dur2ms(timeout);
152+
let timeout = crate::dur2ms(timeout);
153153
let len = cmp::min(list.len(), <ULONG>::max_value() as usize) as ULONG;
154154
let ret = unsafe {
155155
GetQueuedCompletionStatusEx(
@@ -161,7 +161,7 @@ impl CompletionPort {
161161
FALSE as i32,
162162
)
163163
};
164-
match ::cvt(ret) {
164+
match crate::cvt(ret) {
165165
Ok(_) => Ok(&mut list[..removed as usize]),
166166
Err(e) => Err(e),
167167
}
@@ -181,7 +181,7 @@ impl CompletionPort {
181181
status.0.lpOverlapped,
182182
)
183183
};
184-
::cvt(ret).map(|_| ())
184+
crate::cvt(ret).map(|_| ())
185185
}
186186
}
187187

@@ -273,7 +273,7 @@ mod tests {
273273
use winapi::shared::basetsd::*;
274274
use winapi::shared::winerror::*;
275275

276-
use iocp::{CompletionPort, CompletionStatus};
276+
use crate::iocp::{CompletionPort, CompletionStatus};
277277

278278
#[test]
279279
fn is_send_sync() {

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub mod iocp;
3535
pub mod net;
3636
pub mod pipe;
3737

38-
pub use overlapped::Overlapped;
38+
pub use crate::overlapped::Overlapped;
3939

4040
fn cvt(i: BOOL) -> io::Result<BOOL> {
4141
if i == 0 {

src/net.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -975,10 +975,10 @@ mod tests {
975975

976976
use socket2::{Domain, Socket, Type};
977977

978-
use iocp::CompletionPort;
979-
use net::{AcceptAddrsBuf, TcpListenerExt};
980-
use net::{SocketAddrBuf, TcpStreamExt, UdpSocketExt};
981-
use Overlapped;
978+
use crate::iocp::CompletionPort;
979+
use crate::net::{AcceptAddrsBuf, TcpListenerExt};
980+
use crate::net::{SocketAddrBuf, TcpStreamExt, UdpSocketExt};
981+
use crate::Overlapped;
982982

983983
fn each_ip(f: &mut dyn FnMut(SocketAddr)) {
984984
f(t!("127.0.0.1:0".parse()));

src/pipe.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use std::os::windows::ffi::*;
99
use std::os::windows::io::*;
1010
use std::time::Duration;
1111

12-
use handle::Handle;
13-
use overlapped::Overlapped;
12+
use crate::handle::Handle;
13+
use crate::overlapped::Overlapped;
1414
use winapi::shared::minwindef::*;
1515
use winapi::shared::ntdef::HANDLE;
1616
use winapi::shared::winerror::*;
@@ -54,7 +54,7 @@ pub struct NamedPipeBuilder {
5454
pub fn anonymous(buffer_size: u32) -> io::Result<(AnonRead, AnonWrite)> {
5555
let mut read = 0 as HANDLE;
5656
let mut write = 0 as HANDLE;
57-
::cvt(unsafe { CreatePipe(&mut read, &mut write, 0 as *mut _, buffer_size) })?;
57+
crate::cvt(unsafe { CreatePipe(&mut read, &mut write, 0 as *mut _, buffer_size) })?;
5858
Ok((AnonRead(Handle::new(read)), AnonWrite(Handle::new(write))))
5959
}
6060

@@ -181,8 +181,8 @@ impl NamedPipe {
181181

182182
fn _wait(addr: &OsStr, timeout: Option<Duration>) -> io::Result<()> {
183183
let addr = addr.encode_wide().chain(Some(0)).collect::<Vec<_>>();
184-
let timeout = ::dur2ms(timeout);
185-
::cvt(unsafe { WaitNamedPipeW(addr.as_ptr(), timeout) }).map(|_| ())
184+
let timeout = crate::dur2ms(timeout);
185+
crate::cvt(unsafe { WaitNamedPipeW(addr.as_ptr(), timeout) }).map(|_| ())
186186
}
187187

188188
/// Connects this named pipe to a client, blocking until one becomes
@@ -192,7 +192,7 @@ impl NamedPipe {
192192
/// client to connect. This can be called immediately after the pipe is
193193
/// created, or after it has been disconnected from a previous client.
194194
pub fn connect(&self) -> io::Result<()> {
195-
match ::cvt(unsafe { ConnectNamedPipe(self.0.raw(), 0 as *mut _) }) {
195+
match crate::cvt(unsafe { ConnectNamedPipe(self.0.raw(), 0 as *mut _) }) {
196196
Ok(_) => Ok(()),
197197
Err(ref e) if e.raw_os_error() == Some(ERROR_PIPE_CONNECTED as i32) => Ok(()),
198198
Err(e) => Err(e),
@@ -219,7 +219,7 @@ impl NamedPipe {
219219
/// valid until the I/O operation is completed, typically via completion
220220
/// ports and waiting to receive the completion notification on the port.
221221
pub unsafe fn connect_overlapped(&self, overlapped: *mut OVERLAPPED) -> io::Result<bool> {
222-
match ::cvt(ConnectNamedPipe(self.0.raw(), overlapped)) {
222+
match crate::cvt(ConnectNamedPipe(self.0.raw(), overlapped)) {
223223
Ok(_) => Ok(true),
224224
Err(ref e) if e.raw_os_error() == Some(ERROR_PIPE_CONNECTED as i32) => Ok(true),
225225
Err(ref e) if e.raw_os_error() == Some(ERROR_IO_PENDING as i32) => Ok(false),
@@ -229,7 +229,7 @@ impl NamedPipe {
229229

230230
/// Disconnects this named pipe from any connected client.
231231
pub fn disconnect(&self) -> io::Result<()> {
232-
::cvt(unsafe { DisconnectNamedPipe(self.0.raw()) }).map(|_| ())
232+
crate::cvt(unsafe { DisconnectNamedPipe(self.0.raw()) }).map(|_| ())
233233
}
234234

235235
/// Issues an overlapped read operation to occur on this pipe.
@@ -388,7 +388,7 @@ impl<'a> Write for &'a NamedPipe {
388388
})
389389
}
390390
fn flush(&mut self) -> io::Result<()> {
391-
::cvt(unsafe { FlushFileBuffers(self.0.raw()) }).map(|_| ())
391+
crate::cvt(unsafe { FlushFileBuffers(self.0.raw()) }).map(|_| ())
392392
}
393393
}
394394

@@ -528,8 +528,8 @@ mod tests {
528528
use rand::{thread_rng, Rng};
529529

530530
use super::{anonymous, NamedPipe, NamedPipeBuilder};
531-
use iocp::CompletionPort;
532-
use Overlapped;
531+
use crate::iocp::CompletionPort;
532+
use crate::Overlapped;
533533

534534
fn name() -> String {
535535
let name = thread_rng().gen_ascii_chars().take(30).collect::<String>();

0 commit comments

Comments
 (0)