about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2016-03-22 22:01:37 -0500
committerJorge Aparicio <japaricious@gmail.com>2016-03-22 22:01:37 -0500
commit0f02309e4b0ea05ee905205278fb6d131341c41f (patch)
treea259129eeb84705de15b51587ddebd0f82735075 /src/libstd/sys/windows
parent0dcc413e42f15f4fc51a0ca88a99cc89454ec43d (diff)
downloadrust-0f02309e4b0ea05ee905205278fb6d131341c41f.tar.gz
rust-0f02309e4b0ea05ee905205278fb6d131341c41f.zip
try! -> ?
Automated conversion using the untry tool [1] and the following command:

```
$ find -name '*.rs' -type f | xargs untry
```

at the root of the Rust repo.

[1]: https://github.com/japaric/untry
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/backtrace.rs4
-rw-r--r--src/libstd/sys/windows/dynamic_lib.rs2
-rw-r--r--src/libstd/sys/windows/fs.rs106
-rw-r--r--src/libstd/sys/windows/handle.rs8
-rw-r--r--src/libstd/sys/windows/net.rs30
-rw-r--r--src/libstd/sys/windows/os.rs8
-rw-r--r--src/libstd/sys/windows/pipe.rs18
-rw-r--r--src/libstd/sys/windows/printing/msvc.rs2
-rw-r--r--src/libstd/sys/windows/process.rs48
-rw-r--r--src/libstd/sys/windows/stdio.rs8
10 files changed, 117 insertions, 117 deletions
diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs
index 3cc3a631b89..0e10a8d8e8d 100644
--- a/src/libstd/sys/windows/backtrace.rs
+++ b/src/libstd/sys/windows/backtrace.rs
@@ -131,7 +131,7 @@ pub fn write(w: &mut Write) -> io::Result<()> {
         // Start from -1 to avoid printing this stack frame, which will
         // always be exactly the same.
         let mut i = -1;
-        try!(write!(w, "stack backtrace:\n"));
+        write!(w, "stack backtrace:\n")?;
         while StackWalk64(image, process, thread, &mut frame, &mut context,
                           ptr::null_mut(),
                           ptr::null_mut(),
@@ -144,7 +144,7 @@ pub fn write(w: &mut Write) -> io::Result<()> {
             i += 1;
 
             if i >= 0 {
-                try!(printing::print(w, i, addr - 1, process, &dbghelp));
+                printing::print(w, i, addr - 1, process, &dbghelp)?;
             }
         }
 
diff --git a/src/libstd/sys/windows/dynamic_lib.rs b/src/libstd/sys/windows/dynamic_lib.rs
index 84cfbe5e721..dde13ec8364 100644
--- a/src/libstd/sys/windows/dynamic_lib.rs
+++ b/src/libstd/sys/windows/dynamic_lib.rs
@@ -36,7 +36,7 @@ impl DynamicLibrary {
     }
 
     pub fn symbol(&self, symbol: &str) -> io::Result<usize> {
-        let symbol = try!(CString::new(symbol));
+        let symbol = CString::new(symbol)?;
         unsafe {
             match c::GetProcAddress(self.handle, symbol.as_ptr()) as usize {
                 0 => Err(io::Error::last_os_error()),
diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs
index 624fef097fc..46397e14718 100644
--- a/src/libstd/sys/windows/fs.rs
+++ b/src/libstd/sys/windows/fs.rs
@@ -248,13 +248,13 @@ impl OpenOptions {
 
 impl File {
     pub fn open(path: &Path, opts: &OpenOptions) -> io::Result<File> {
-        let path = try!(to_u16s(path));
+        let path = to_u16s(path)?;
         let handle = unsafe {
             c::CreateFileW(path.as_ptr(),
-                           try!(opts.get_access_mode()),
+                           opts.get_access_mode()?,
                            opts.share_mode,
                            opts.security_attributes as *mut _,
-                           try!(opts.get_creation_mode()),
+                           opts.get_creation_mode()?,
                            opts.get_flags_and_attributes(),
                            ptr::null_mut())
         };
@@ -266,7 +266,7 @@ impl File {
     }
 
     pub fn fsync(&self) -> io::Result<()> {
-        try!(cvt(unsafe { c::FlushFileBuffers(self.handle.raw()) }));
+        cvt(unsafe { c::FlushFileBuffers(self.handle.raw()) })?;
         Ok(())
     }
 
@@ -277,20 +277,20 @@ impl File {
             EndOfFile: size as c::LARGE_INTEGER,
         };
         let size = mem::size_of_val(&info);
-        try!(cvt(unsafe {
+        cvt(unsafe {
             c::SetFileInformationByHandle(self.handle.raw(),
                                           c::FileEndOfFileInfo,
                                           &mut info as *mut _ as *mut _,
                                           size as c::DWORD)
-        }));
+        })?;
         Ok(())
     }
 
     pub fn file_attr(&self) -> io::Result<FileAttr> {
         unsafe {
             let mut info: c::BY_HANDLE_FILE_INFORMATION = mem::zeroed();
-            try!(cvt(c::GetFileInformationByHandle(self.handle.raw(),
-                                                   &mut info)));
+            cvt(c::GetFileInformationByHandle(self.handle.raw(),
+                                                   &mut info))?;
             let mut attr = FileAttr {
                 attributes: info.dwFileAttributes,
                 creation_time: info.ftCreationTime,
@@ -331,16 +331,16 @@ impl File {
         };
         let pos = pos as c::LARGE_INTEGER;
         let mut newpos = 0;
-        try!(cvt(unsafe {
+        cvt(unsafe {
             c::SetFilePointerEx(self.handle.raw(), pos,
                                 &mut newpos, whence)
-        }));
+        })?;
         Ok(newpos as u64)
     }
 
     pub fn duplicate(&self) -> io::Result<File> {
         Ok(File {
-            handle: try!(self.handle.duplicate(0, true, c::DUPLICATE_SAME_ACCESS)),
+            handle: self.handle.duplicate(0, true, c::DUPLICATE_SAME_ACCESS)?,
         })
     }
 
@@ -353,7 +353,7 @@ impl File {
                          -> io::Result<(c::DWORD, &'a c::REPARSE_DATA_BUFFER)> {
         unsafe {
             let mut bytes = 0;
-            try!(cvt({
+            cvt({
                 c::DeviceIoControl(self.handle.raw(),
                                    c::FSCTL_GET_REPARSE_POINT,
                                    ptr::null_mut(),
@@ -362,14 +362,14 @@ impl File {
                                    space.len() as c::DWORD,
                                    &mut bytes,
                                    ptr::null_mut())
-            }));
+            })?;
             Ok((bytes, &*(space.as_ptr() as *const c::REPARSE_DATA_BUFFER)))
         }
     }
 
     fn readlink(&self) -> io::Result<PathBuf> {
         let mut space = [0u8; c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
-        let (_bytes, buf) = try!(self.reparse_point(&mut space));
+        let (_bytes, buf) = self.reparse_point(&mut space)?;
         unsafe {
             let (path_buffer, subst_off, subst_len, relative) = match buf.ReparseTag {
                 c::IO_REPARSE_TAG_SYMLINK => {
@@ -516,10 +516,10 @@ impl DirBuilder {
     pub fn new() -> DirBuilder { DirBuilder }
 
     pub fn mkdir(&self, p: &Path) -> io::Result<()> {
-        let p = try!(to_u16s(p));
-        try!(cvt(unsafe {
+        let p = to_u16s(p)?;
+        cvt(unsafe {
             c::CreateDirectoryW(p.as_ptr(), ptr::null_mut())
-        }));
+        })?;
         Ok(())
     }
 }
@@ -527,7 +527,7 @@ impl DirBuilder {
 pub fn readdir(p: &Path) -> io::Result<ReadDir> {
     let root = p.to_path_buf();
     let star = p.join("*");
-    let path = try!(to_u16s(&star));
+    let path = to_u16s(&star)?;
 
     unsafe {
         let mut wfd = mem::zeroed();
@@ -545,28 +545,28 @@ pub fn readdir(p: &Path) -> io::Result<ReadDir> {
 }
 
 pub fn unlink(p: &Path) -> io::Result<()> {
-    let p_u16s = try!(to_u16s(p));
-    try!(cvt(unsafe { c::DeleteFileW(p_u16s.as_ptr()) }));
+    let p_u16s = to_u16s(p)?;
+    cvt(unsafe { c::DeleteFileW(p_u16s.as_ptr()) })?;
     Ok(())
 }
 
 pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
-    let old = try!(to_u16s(old));
-    let new = try!(to_u16s(new));
-    try!(cvt(unsafe {
+    let old = to_u16s(old)?;
+    let new = to_u16s(new)?;
+    cvt(unsafe {
         c::MoveFileExW(old.as_ptr(), new.as_ptr(), c::MOVEFILE_REPLACE_EXISTING)
-    }));
+    })?;
     Ok(())
 }
 
 pub fn rmdir(p: &Path) -> io::Result<()> {
-    let p = try!(to_u16s(p));
-    try!(cvt(unsafe { c::RemoveDirectoryW(p.as_ptr()) }));
+    let p = to_u16s(p)?;
+    cvt(unsafe { c::RemoveDirectoryW(p.as_ptr()) })?;
     Ok(())
 }
 
 pub fn remove_dir_all(path: &Path) -> io::Result<()> {
-    let filetype = try!(lstat(path)).file_type();
+    let filetype = lstat(path)?.file_type();
     if filetype.is_symlink() {
         // On Windows symlinks to files and directories are removed differently.
         // rmdir only deletes dir symlinks and junctions, not file symlinks.
@@ -577,15 +577,15 @@ pub fn remove_dir_all(path: &Path) -> io::Result<()> {
 }
 
 fn remove_dir_all_recursive(path: &Path) -> io::Result<()> {
-    for child in try!(readdir(path)) {
-        let child = try!(child);
-        let child_type = try!(child.file_type());
+    for child in readdir(path)? {
+        let child = child?;
+        let child_type = child.file_type()?;
         if child_type.is_dir() {
-            try!(remove_dir_all_recursive(&child.path()));
+            remove_dir_all_recursive(&child.path())?;
         } else if child_type.is_symlink_dir() {
-            try!(rmdir(&child.path()));
+            rmdir(&child.path())?;
         } else {
-            try!(unlink(&child.path()));
+            unlink(&child.path())?;
         }
     }
     rmdir(path)
@@ -599,7 +599,7 @@ pub fn readlink(path: &Path) -> io::Result<PathBuf> {
     opts.access_mode(0);
     opts.custom_flags(c::FILE_FLAG_OPEN_REPARSE_POINT |
                       c::FILE_FLAG_BACKUP_SEMANTICS);
-    let file = try!(File::open(&path, &opts));
+    let file = File::open(&path, &opts)?;
     file.readlink()
 }
 
@@ -608,21 +608,21 @@ pub fn symlink(src: &Path, dst: &Path) -> io::Result<()> {
 }
 
 pub fn symlink_inner(src: &Path, dst: &Path, dir: bool) -> io::Result<()> {
-    let src = try!(to_u16s(src));
-    let dst = try!(to_u16s(dst));
+    let src = to_u16s(src)?;
+    let dst = to_u16s(dst)?;
     let flags = if dir { c::SYMBOLIC_LINK_FLAG_DIRECTORY } else { 0 };
-    try!(cvt(unsafe {
+    cvt(unsafe {
         c::CreateSymbolicLinkW(dst.as_ptr(), src.as_ptr(), flags) as c::BOOL
-    }));
+    })?;
     Ok(())
 }
 
 pub fn link(src: &Path, dst: &Path) -> io::Result<()> {
-    let src = try!(to_u16s(src));
-    let dst = try!(to_u16s(dst));
-    try!(cvt(unsafe {
+    let src = to_u16s(src)?;
+    let dst = to_u16s(dst)?;
+    cvt(unsafe {
         c::CreateHardLinkW(dst.as_ptr(), src.as_ptr(), ptr::null_mut())
-    }));
+    })?;
     Ok(())
 }
 
@@ -632,7 +632,7 @@ pub fn stat(path: &Path) -> io::Result<FileAttr> {
     opts.access_mode(0);
     // This flag is so we can open directories too
     opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS);
-    let file = try!(File::open(path, &opts));
+    let file = File::open(path, &opts)?;
     file.file_attr()
 }
 
@@ -641,14 +641,14 @@ pub fn lstat(path: &Path) -> io::Result<FileAttr> {
     // No read or write permissions are necessary
     opts.access_mode(0);
     opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS | c::FILE_FLAG_OPEN_REPARSE_POINT);
-    let file = try!(File::open(path, &opts));
+    let file = File::open(path, &opts)?;
     file.file_attr()
 }
 
 pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {
-    let p = try!(to_u16s(p));
+    let p = to_u16s(p)?;
     unsafe {
-        try!(cvt(c::SetFileAttributesW(p.as_ptr(), perm.attrs)));
+        cvt(c::SetFileAttributesW(p.as_ptr(), perm.attrs))?;
         Ok(())
     }
 }
@@ -668,7 +668,7 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
     opts.access_mode(0);
     // This flag is so we can open directories too
     opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS);
-    let f = try!(File::open(p, &opts));
+    let f = File::open(p, &opts)?;
     get_path(&f)
 }
 
@@ -687,13 +687,13 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
         *(lpData as *mut i64) = TotalBytesTransferred;
         c::PROGRESS_CONTINUE
     }
-    let pfrom = try!(to_u16s(from));
-    let pto = try!(to_u16s(to));
+    let pfrom = to_u16s(from)?;
+    let pto = to_u16s(to)?;
     let mut size = 0i64;
-    try!(cvt(unsafe {
+    cvt(unsafe {
         c::CopyFileExW(pfrom.as_ptr(), pto.as_ptr(), Some(callback),
                        &mut size as *mut _ as *mut _, ptr::null_mut(), 0)
-    }));
+    })?;
     Ok(size as u64)
 }
 
@@ -710,13 +710,13 @@ pub fn symlink_junction<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::R
 #[allow(dead_code)]
 fn symlink_junction_inner(target: &Path, junction: &Path) -> io::Result<()> {
     let d = DirBuilder::new();
-    try!(d.mkdir(&junction));
+    d.mkdir(&junction)?;
 
     let mut opts = OpenOptions::new();
     opts.write(true);
     opts.custom_flags(c::FILE_FLAG_OPEN_REPARSE_POINT |
                       c::FILE_FLAG_BACKUP_SEMANTICS);
-    let f = try!(File::open(junction, &opts));
+    let f = File::open(junction, &opts)?;
     let h = f.handle().raw();
 
     unsafe {
diff --git a/src/libstd/sys/windows/handle.rs b/src/libstd/sys/windows/handle.rs
index 1396d670902..74546bb893b 100644
--- a/src/libstd/sys/windows/handle.rs
+++ b/src/libstd/sys/windows/handle.rs
@@ -169,22 +169,22 @@ impl RawHandle {
         // WriteFile takes a DWORD (u32) for the length so it only supports
         // writing u32::MAX bytes at a time.
         let len = cmp::min(buf.len(), u32::MAX as usize) as c::DWORD;
-        try!(cvt(unsafe {
+        cvt(unsafe {
             c::WriteFile(self.0, buf.as_ptr() as c::LPVOID,
                          len, &mut amt, ptr::null_mut())
-        }));
+        })?;
         Ok(amt as usize)
     }
 
     pub fn duplicate(&self, access: c::DWORD, inherit: bool,
                      options: c::DWORD) -> io::Result<Handle> {
         let mut ret = 0 as c::HANDLE;
-        try!(cvt(unsafe {
+        cvt(unsafe {
             let cur_proc = c::GetCurrentProcess();
             c::DuplicateHandle(cur_proc, self.0, cur_proc, &mut ret,
                             access, inherit as c::BOOL,
                             options)
-        }));
+        })?;
         Ok(Handle::new(ret))
     }
 }
diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs
index 3a2f06418cf..ab2d969fe0a 100644
--- a/src/libstd/sys/windows/net.rs
+++ b/src/libstd/sys/windows/net.rs
@@ -92,35 +92,35 @@ impl Socket {
             SocketAddr::V4(..) => c::AF_INET,
             SocketAddr::V6(..) => c::AF_INET6,
         };
-        let socket = try!(unsafe {
+        let socket = unsafe {
             match c::WSASocketW(fam, ty, 0, ptr::null_mut(), 0,
                                 c::WSA_FLAG_OVERLAPPED) {
                 c::INVALID_SOCKET => Err(last_error()),
                 n => Ok(Socket(n)),
             }
-        });
-        try!(socket.set_no_inherit());
+        }?;
+        socket.set_no_inherit()?;
         Ok(socket)
     }
 
     pub fn accept(&self, storage: *mut c::SOCKADDR,
                   len: *mut c_int) -> io::Result<Socket> {
-        let socket = try!(unsafe {
+        let socket = unsafe {
             match c::accept(self.0, storage, len) {
                 c::INVALID_SOCKET => Err(last_error()),
                 n => Ok(Socket(n)),
             }
-        });
-        try!(socket.set_no_inherit());
+        }?;
+        socket.set_no_inherit()?;
         Ok(socket)
     }
 
     pub fn duplicate(&self) -> io::Result<Socket> {
-        let socket = try!(unsafe {
+        let socket = unsafe {
             let mut info: c::WSAPROTOCOL_INFO = mem::zeroed();
-            try!(cvt(c::WSADuplicateSocketW(self.0,
+            cvt(c::WSADuplicateSocketW(self.0,
                                             c::GetCurrentProcessId(),
-                                            &mut info)));
+                                            &mut info))?;
             match c::WSASocketW(info.iAddressFamily,
                                 info.iSocketType,
                                 info.iProtocol,
@@ -129,8 +129,8 @@ impl Socket {
                 c::INVALID_SOCKET => Err(last_error()),
                 n => Ok(Socket(n)),
             }
-        });
-        try!(socket.set_no_inherit());
+        }?;
+        socket.set_no_inherit()?;
         Ok(socket)
     }
 
@@ -169,7 +169,7 @@ impl Socket {
     }
 
     pub fn timeout(&self, kind: c_int) -> io::Result<Option<Duration>> {
-        let raw: c::DWORD = try!(net::getsockopt(self, c::SOL_SOCKET, kind));
+        let raw: c::DWORD = net::getsockopt(self, c::SOL_SOCKET, kind)?;
         if raw == 0 {
             Ok(None)
         } else {
@@ -192,7 +192,7 @@ impl Socket {
             Shutdown::Read => c::SD_RECEIVE,
             Shutdown::Both => c::SD_BOTH,
         };
-        try!(cvt(unsafe { c::shutdown(self.0, how) }));
+        cvt(unsafe { c::shutdown(self.0, how) })?;
         Ok(())
     }
 
@@ -211,12 +211,12 @@ impl Socket {
     }
 
     pub fn nodelay(&self) -> io::Result<bool> {
-        let raw: c::BYTE = try!(net::getsockopt(self, c::IPPROTO_TCP, c::TCP_NODELAY));
+        let raw: c::BYTE = net::getsockopt(self, c::IPPROTO_TCP, c::TCP_NODELAY)?;
         Ok(raw != 0)
     }
 
     pub fn take_error(&self) -> io::Result<Option<io::Error>> {
-        let raw: c_int = try!(net::getsockopt(self, c::SOL_SOCKET, c::SO_ERROR));
+        let raw: c_int = net::getsockopt(self, c::SOL_SOCKET, c::SO_ERROR)?;
         if raw == 0 {
             Ok(None)
         } else {
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index 688475a7565..32ca32e76cb 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -239,7 +239,7 @@ pub fn chdir(p: &path::Path) -> io::Result<()> {
 }
 
 pub fn getenv(k: &OsStr) -> io::Result<Option<OsString>> {
-    let k = try!(to_u16s(k));
+    let k = to_u16s(k)?;
     let res = super::fill_utf16_buf(|buf, sz| unsafe {
         c::GetEnvironmentVariableW(k.as_ptr(), buf, sz)
     }, |buf| {
@@ -258,8 +258,8 @@ pub fn getenv(k: &OsStr) -> io::Result<Option<OsString>> {
 }
 
 pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
-    let k = try!(to_u16s(k));
-    let v = try!(to_u16s(v));
+    let k = to_u16s(k)?;
+    let v = to_u16s(v)?;
 
     cvt(unsafe {
         c::SetEnvironmentVariableW(k.as_ptr(), v.as_ptr())
@@ -267,7 +267,7 @@ pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
 }
 
 pub fn unsetenv(n: &OsStr) -> io::Result<()> {
-    let v = try!(to_u16s(n));
+    let v = to_u16s(n)?;
     cvt(unsafe {
         c::SetEnvironmentVariableW(v.as_ptr(), ptr::null())
     }).map(|_| ())
diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs
index fbe38d76e95..8631a63d653 100644
--- a/src/libstd/sys/windows/pipe.rs
+++ b/src/libstd/sys/windows/pipe.rs
@@ -95,7 +95,7 @@ pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
         opts.read(false);
         opts.share_mode(0);
         opts.attributes(c::FILE_FLAG_OVERLAPPED);
-        let writer = try!(File::open(Path::new(&name), &opts));
+        let writer = File::open(Path::new(&name), &opts)?;
         let writer = AnonPipe { inner: writer.into_handle() };
 
         Ok((AnonPipe { inner: reader }, AnonPipe { inner: writer.into_handle() }))
@@ -126,8 +126,8 @@ pub fn read2(p1: AnonPipe,
     let p1 = p1.into_handle();
     let p2 = p2.into_handle();
 
-    let mut p1 = try!(AsyncPipe::new(p1, v1));
-    let mut p2 = try!(AsyncPipe::new(p2, v2));
+    let mut p1 = AsyncPipe::new(p1, v1)?;
+    let mut p2 = AsyncPipe::new(p2, v2)?;
     let objs = [p1.event.raw(), p2.event.raw()];
 
     // In a loop we wait for either pipe's scheduled read operation to complete.
@@ -143,11 +143,11 @@ pub fn read2(p1: AnonPipe,
             c::WaitForMultipleObjects(2, objs.as_ptr(), c::FALSE, c::INFINITE)
         };
         if res == c::WAIT_OBJECT_0 {
-            if !try!(p1.result()) || !try!(p1.schedule_read()) {
+            if !p1.result()? || !p1.schedule_read()? {
                 return p2.finish()
             }
         } else if res == c::WAIT_OBJECT_0 + 1 {
-            if !try!(p2.result()) || !try!(p2.schedule_read()) {
+            if !p2.result()? || !p2.schedule_read()? {
                 return p1.finish()
             }
         } else {
@@ -183,7 +183,7 @@ impl<'a> AsyncPipe<'a> {
         // WaitForMultipleObjects call above for pipes created initially,
         // and the only time an even will go back to "unset" will be once an
         // I/O operation is successfully scheduled (what we want).
-        let event = try!(Handle::new_event(true, true));
+        let event = Handle::new_event(true, true)?;
         let mut overlapped: Box<c::OVERLAPPED> = unsafe {
             Box::new(mem::zeroed())
         };
@@ -207,7 +207,7 @@ impl<'a> AsyncPipe<'a> {
         assert_eq!(self.state, State::NotReading);
         let amt = unsafe {
             let slice = slice_to_end(self.dst);
-            try!(self.pipe.read_overlapped(slice, &mut *self.overlapped))
+            self.pipe.read_overlapped(slice, &mut *self.overlapped)?
         };
 
         // If this read finished immediately then our overlapped event will
@@ -240,7 +240,7 @@ impl<'a> AsyncPipe<'a> {
         let amt = match self.state {
             State::NotReading => return Ok(true),
             State::Reading => {
-                try!(self.pipe.overlapped_result(&mut *self.overlapped, true))
+                self.pipe.overlapped_result(&mut *self.overlapped, true)?
             }
             State::Read(amt) => amt,
         };
@@ -257,7 +257,7 @@ impl<'a> AsyncPipe<'a> {
     /// Waits for any pending and schedule read, and then calls `read_to_end`
     /// if necessary to read all the remaining information.
     fn finish(&mut self) -> io::Result<()> {
-        while try!(self.result()) && try!(self.schedule_read()) {
+        while self.result()? && self.schedule_read()? {
             // ...
         }
         Ok(())
diff --git a/src/libstd/sys/windows/printing/msvc.rs b/src/libstd/sys/windows/printing/msvc.rs
index 37aaa1f1b0e..9c29ac4082a 100644
--- a/src/libstd/sys/windows/printing/msvc.rs
+++ b/src/libstd/sys/windows/printing/msvc.rs
@@ -53,7 +53,7 @@ pub fn print(w: &mut Write,
             None
         };
 
-        try!(output(w, i, addr as usize as *mut c_void, name));
+        output(w, i, addr as usize as *mut c_void, name)?;
 
         // Now find out the filename and line number
         let mut line: c::IMAGEHLP_LINE64 = mem::zeroed();
diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs
index 524c932eed4..f479b36ebbd 100644
--- a/src/libstd/sys/windows/process.rs
+++ b/src/libstd/sys/windows/process.rs
@@ -151,7 +151,7 @@ impl Command {
         si.dwFlags = c::STARTF_USESTDHANDLES;
 
         let program = program.as_ref().unwrap_or(&self.program);
-        let mut cmd_str = try!(make_command_line(program, &self.args));
+        let mut cmd_str = make_command_line(program, &self.args)?;
         cmd_str.push(0); // add null terminator
 
         // stolen from the libuv code.
@@ -160,8 +160,8 @@ impl Command {
             flags |= c::DETACHED_PROCESS | c::CREATE_NEW_PROCESS_GROUP;
         }
 
-        let (envp, _data) = try!(make_envp(self.env.as_ref()));
-        let (dirp, _data) = try!(make_dirp(self.cwd.as_ref()));
+        let (envp, _data) = make_envp(self.env.as_ref())?;
+        let (dirp, _data) = make_dirp(self.cwd.as_ref())?;
         let mut pi = zeroed_process_information();
 
         // Prepare all stdio handles to be inherited by the child. This
@@ -186,23 +186,23 @@ impl Command {
         let stdin = self.stdin.as_ref().unwrap_or(default_stdin);
         let stdout = self.stdout.as_ref().unwrap_or(&default);
         let stderr = self.stderr.as_ref().unwrap_or(&default);
-        let stdin = try!(stdin.to_handle(c::STD_INPUT_HANDLE, &mut pipes.stdin));
-        let stdout = try!(stdout.to_handle(c::STD_OUTPUT_HANDLE,
-                                           &mut pipes.stdout));
-        let stderr = try!(stderr.to_handle(c::STD_ERROR_HANDLE,
-                                           &mut pipes.stderr));
+        let stdin = stdin.to_handle(c::STD_INPUT_HANDLE, &mut pipes.stdin)?;
+        let stdout = stdout.to_handle(c::STD_OUTPUT_HANDLE,
+                                           &mut pipes.stdout)?;
+        let stderr = stderr.to_handle(c::STD_ERROR_HANDLE,
+                                           &mut pipes.stderr)?;
         si.hStdInput = stdin.raw();
         si.hStdOutput = stdout.raw();
         si.hStdError = stderr.raw();
 
-        try!(unsafe {
+        unsafe {
             cvt(c::CreateProcessW(ptr::null(),
                                   cmd_str.as_mut_ptr(),
                                   ptr::null_mut(),
                                   ptr::null_mut(),
                                   c::TRUE, flags, envp, dirp,
                                   &mut si, &mut pi))
-        });
+        }?;
 
         // We close the thread handle because we don't care about keeping
         // the thread id valid, and we aren't keeping the thread handle
@@ -216,9 +216,9 @@ impl Command {
 
 impl fmt::Debug for Command {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{:?}", self.program));
+        write!(f, "{:?}", self.program)?;
         for arg in &self.args {
-            try!(write!(f, " {:?}", arg));
+            write!(f, " {:?}", arg)?;
         }
         Ok(())
     }
@@ -240,18 +240,18 @@ impl Stdio {
             }
 
             Stdio::MakePipe => {
-                let (reader, writer) = try!(pipe::anon_pipe());
+                let (reader, writer) = pipe::anon_pipe()?;
                 let (ours, theirs) = if stdio_id == c::STD_INPUT_HANDLE {
                     (writer, reader)
                 } else {
                     (reader, writer)
                 };
                 *pipe = Some(ours);
-                try!(cvt(unsafe {
+                cvt(unsafe {
                     c::SetHandleInformation(theirs.handle().raw(),
                                             c::HANDLE_FLAG_INHERIT,
                                             c::HANDLE_FLAG_INHERIT)
-                }));
+                })?;
                 Ok(theirs.into_handle())
             }
 
@@ -296,9 +296,9 @@ pub struct Process {
 
 impl Process {
     pub fn kill(&mut self) -> io::Result<()> {
-        try!(cvt(unsafe {
+        cvt(unsafe {
             c::TerminateProcess(self.handle.raw(), 1)
-        }));
+        })?;
         Ok(())
     }
 
@@ -315,7 +315,7 @@ impl Process {
                 return Err(Error::last_os_error())
             }
             let mut status = 0;
-            try!(cvt(c::GetExitCodeProcess(self.handle.raw(), &mut status)));
+            cvt(c::GetExitCodeProcess(self.handle.raw(), &mut status))?;
             Ok(ExitStatus(status))
         }
     }
@@ -381,10 +381,10 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result<Vec<u16>> {
     // Encode the command and arguments in a command line string such
     // that the spawned process may recover them using CommandLineToArgvW.
     let mut cmd: Vec<u16> = Vec::new();
-    try!(append_arg(&mut cmd, prog));
+    append_arg(&mut cmd, prog)?;
     for arg in args {
         cmd.push(' ' as u16);
-        try!(append_arg(&mut cmd, arg));
+        append_arg(&mut cmd, arg)?;
     }
     return Ok(cmd);
 
@@ -392,7 +392,7 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result<Vec<u16>> {
         // If an argument has 0 characters then we need to quote it to ensure
         // that it actually gets passed through on the command line or otherwise
         // it will be dropped entirely when parsed on the other end.
-        try!(ensure_no_nuls(arg));
+        ensure_no_nuls(arg)?;
         let arg_bytes = &arg.as_inner().inner.as_inner();
         let quote = arg_bytes.iter().any(|c| *c == b' ' || *c == b'\t')
             || arg_bytes.is_empty();
@@ -438,9 +438,9 @@ fn make_envp(env: Option<&collections::HashMap<OsString, OsString>>)
             let mut blk = Vec::new();
 
             for pair in env {
-                blk.extend(try!(ensure_no_nuls(pair.0)).encode_wide());
+                blk.extend(ensure_no_nuls(pair.0)?.encode_wide());
                 blk.push('=' as u16);
-                blk.extend(try!(ensure_no_nuls(pair.1)).encode_wide());
+                blk.extend(ensure_no_nuls(pair.1)?.encode_wide());
                 blk.push(0);
             }
             blk.push(0);
@@ -454,7 +454,7 @@ fn make_dirp(d: Option<&OsString>) -> io::Result<(*const u16, Vec<u16>)> {
 
     match d {
         Some(dir) => {
-            let mut dir_str: Vec<u16> = try!(ensure_no_nuls(dir)).encode_wide().collect();
+            let mut dir_str: Vec<u16> = ensure_no_nuls(dir)?.encode_wide().collect();
             dir_str.push(0);
             Ok((dir_str.as_ptr(), dir_str))
         },
diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs
index 0a0851ffac3..fa3cab2191e 100644
--- a/src/libstd/sys/windows/stdio.rs
+++ b/src/libstd/sys/windows/stdio.rs
@@ -78,13 +78,13 @@ fn write(out: &Output, data: &[u8]) -> io::Result<usize> {
     };
     let utf16 = utf8.encode_utf16().collect::<Vec<u16>>();
     let mut written = 0;
-    try!(cvt(unsafe {
+    cvt(unsafe {
         c::WriteConsoleW(handle,
                          utf16.as_ptr() as c::LPCVOID,
                          utf16.len() as u32,
                          &mut written,
                          ptr::null_mut())
-    }));
+    })?;
 
     // FIXME if this only partially writes the utf16 buffer then we need to
     //       figure out how many bytes of `data` were actually written
@@ -112,13 +112,13 @@ impl Stdin {
         if utf8.position() as usize == utf8.get_ref().len() {
             let mut utf16 = vec![0u16; 0x1000];
             let mut num = 0;
-            try!(cvt(unsafe {
+            cvt(unsafe {
                 c::ReadConsoleW(handle,
                                 utf16.as_mut_ptr() as c::LPVOID,
                                 utf16.len() as u32,
                                 &mut num,
                                 ptr::null_mut())
-            }));
+            })?;
             utf16.truncate(num as usize);
             // FIXME: what to do about this data that has already been read?
             let data = match String::from_utf16(&utf16) {