about summary refs log tree commit diff
path: root/src/librustc/mir/interpret
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-13 09:44:59 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-24 11:36:31 +0100
commit3a0e8254b06c8a9c8e4b775a18524797f1e3d44c (patch)
tree6c2df8a97f050905595f2e4c4e2b40005439b107 /src/librustc/mir/interpret
parent07e7804110c77d572012f913a341523bdbaac4dd (diff)
downloadrust-3a0e8254b06c8a9c8e4b775a18524797f1e3d44c.tar.gz
rust-3a0e8254b06c8a9c8e4b775a18524797f1e3d44c.zip
Remove unnecessary `Result` (function always returned `Ok`)
Diffstat (limited to 'src/librustc/mir/interpret')
-rw-r--r--src/librustc/mir/interpret/allocation.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs
index 6ef7a5a266d..42bcd3a9027 100644
--- a/src/librustc/mir/interpret/allocation.rs
+++ b/src/librustc/mir/interpret/allocation.rs
@@ -406,12 +406,12 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
         cx: &impl HasDataLayout,
         ptr: Pointer<Tag>,
         size: Size,
-    ) -> EvalResult<'tcx, &[(Size, (Tag, AllocId))]> {
+    ) -> &[(Size, (Tag, AllocId))] {
         // We have to go back `pointer_size - 1` bytes, as that one would still overlap with
         // the beginning of this range.
         let start = ptr.offset.bytes().saturating_sub(cx.data_layout().pointer_size.bytes() - 1);
         let end = ptr.offset + size; // this does overflow checking
-        Ok(self.relocations.range(Size::from_bytes(start)..end))
+        self.relocations.range(Size::from_bytes(start)..end)
     }
 
     /// Check that there ar eno relocations overlapping with the given range.
@@ -422,10 +422,10 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
         ptr: Pointer<Tag>,
         size: Size,
     ) -> EvalResult<'tcx> {
-        if self.relocations(cx, ptr, size)?.len() != 0 {
-            err!(ReadPointerAsBytes)
-        } else {
+        if self.relocations(cx, ptr, size).is_empty() {
             Ok(())
+        } else {
+            err!(ReadPointerAsBytes)
         }
     }
 
@@ -444,7 +444,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
         // Find the start and end of the given range and its outermost relocations.
         let (first, last) = {
             // Find all relocations overlapping the given range.
-            let relocations = self.relocations(cx, ptr, size)?;
+            let relocations = self.relocations(cx, ptr, size);
             if relocations.is_empty() {
                 return Ok(());
             }