about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSaleem Jaffer <ssaleem1992@gmail.com>2019-07-31 18:14:49 +0530
committerSaleem Jaffer <ssaleem1992@gmail.com>2019-07-31 18:14:49 +0530
commitc17d11fb39d93b1093fe19ca3c3db09130d3f47c (patch)
tree4083613860650e4747795ebdfb3cdf15994e0809
parenta1e59d17e33d317842ccbc3253517b3629e31eb0 (diff)
downloadrust-c17d11fb39d93b1093fe19ca3c3db09130d3f47c.tar.gz
rust-c17d11fb39d93b1093fe19ca3c3db09130d3f47c.zip
code review fixes
-rw-r--r--src/librustc/mir/interpret/allocation.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs
index a9393561bfd..ce04cca96e0 100644
--- a/src/librustc/mir/interpret/allocation.rs
+++ b/src/librustc/mir/interpret/allocation.rs
@@ -235,17 +235,17 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
     {
         assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes());
         let offset = ptr.offset.bytes() as usize;
-        match self.bytes[offset..].iter().position(|&c| c == 0) {
+        Ok(match self.bytes[offset..].iter().position(|&c| c == 0) {
             Some(size) => {
                 let size_with_null = Size::from_bytes((size + 1) as u64);
                 // Go through `get_bytes` for checks and AllocationExtra hooks.
                 // We read the null, so we include it in the request, but we want it removed
                 // from the result, so we do subslicing.
-                Ok(&self.get_bytes(cx, ptr, size_with_null)?[..size])
+                &self.get_bytes(cx, ptr, size_with_null)?[..size]
             }
             // This includes the case where `offset` is out-of-bounds to begin with.
             None => throw_unsup!(UnterminatedCString(ptr.erase_tag())),
-        }
+        })
     }
 
     /// Validates that `ptr.offset` and `ptr.offset + size` do not point to the middle of a