]> git.lizzy.rs Git - rust.git/commitdiff
remove no-longer-needed zero checks
authorRalf Jung <post@ralfj.de>
Thu, 14 Nov 2019 09:29:43 +0000 (10:29 +0100)
committerRalf Jung <post@ralfj.de>
Thu, 14 Nov 2019 09:30:00 +0000 (10:30 +0100)
src/shims/fs.rs

index 4de59ad32ff59dc2ae2b9478a07870e394622c69..79e57cf2c8f5db79045d6623d5f0f5691c7dc1ad 100644 (file)
@@ -175,10 +175,7 @@ fn read(
             .to_machine_usize(&*this.tcx)?
             .min((1 << (ptr_size - 1)) - 1) // max value of target `isize`
             .min(isize::max_value() as u64);
-        // Reading zero bytes should not change `buf`.
-        if count == 0 {
-            return Ok(0);
-        }
+
         let fd = this.read_scalar(fd_op)?.to_i32()?;
         let buf = this.read_scalar(buf_op)?.not_undef()?;
 
@@ -231,10 +228,7 @@ fn write(
             .to_machine_usize(&*this.tcx)?
             .min((1 << (ptr_size - 1)) - 1) // max value of target `isize`
             .min(isize::max_value() as u64);
-        // Writing zero bytes should not change `buf`.
-        if count == 0 {
-            return Ok(0);
-        }
+
         let fd = this.read_scalar(fd_op)?.to_i32()?;
         let buf = this.read_scalar(buf_op)?.not_undef()?;