summaryrefslogtreecommitdiffstats
path: root/src/worker.rs
diff options
context:
space:
mode:
authorBalaji Sivaraman <balaji@balajisivaraman.com>2018-01-01 19:52:35 +0530
committerAndrew Gallant <jamslam@gmail.com>2018-01-01 09:22:35 -0500
commitb6177f0459044a7e3fb882ecda9c80e44e4d95de (patch)
tree281e058e4fbe87c6293ea5260d4f798a05ce7b4d /src/worker.rs
parentba1023e1e45d7bd6edffa43d06c9613d3b84de8f (diff)
cleanup: replace try! with ?
Diffstat (limited to 'src/worker.rs')
-rw-r--r--src/worker.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/worker.rs b/src/worker.rs
index 9aa0fdc0..b487c7d5 100644
--- a/src/worker.rs
+++ b/src/worker.rs
@@ -282,7 +282,7 @@ impl Worker {
path: &Path,
file: &File,
) -> Result<u64> {
- if try!(file.metadata()).len() == 0 {
+ if file.metadata()?.len() == 0 {
// Opening a memory map with an empty file results in an error.
// However, this may not actually be an empty file! For example,
// /proc/cpuinfo reports itself as an empty file, but it can
@@ -290,7 +290,7 @@ impl Worker {
// regular read calls.
return self.search(printer, path, file);
}
- let mmap = unsafe { try!(Mmap::map(file)) };
+ let mmap = unsafe { Mmap::map(file)? };
let buf = &*mmap;
if buf.len() >= 3 && Encoding::for_bom(buf).is_some() {
// If we have a UTF-16 bom in our memory map, then we need to fall