diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-03-04 13:06:01 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2021-03-18 14:25:54 +0100 |
| commit | cfb4ad4f2abf42ff603d5f9e89f1352cb79a451c (patch) | |
| tree | 19cfc48983d2549969452202de101fd8e3846233 /compiler/rustc_mir/src/interpret | |
| parent | 895a8e71b1a9fc42631f81b071bc855f7fb3e9a4 (diff) | |
| download | rust-cfb4ad4f2abf42ff603d5f9e89f1352cb79a451c.tar.gz rust-cfb4ad4f2abf42ff603d5f9e89f1352cb79a451c.zip | |
Remove unwrap_none/expect_none from compiler/.
Diffstat (limited to 'compiler/rustc_mir/src/interpret')
| -rw-r--r-- | compiler/rustc_mir/src/interpret/memory.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/rustc_mir/src/interpret/memory.rs b/compiler/rustc_mir/src/interpret/memory.rs index f3e373813ca..fe5ebf0b6fe 100644 --- a/compiler/rustc_mir/src/interpret/memory.rs +++ b/compiler/rustc_mir/src/interpret/memory.rs @@ -854,7 +854,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { Some(ptr) => ptr, None => { // zero-sized access - src.next().expect_none("iterator said it was empty but returned an element"); + assert_matches!( + src.next(), + None, + "iterator said it was empty but returned an element" + ); return Ok(()); } }; @@ -880,7 +884,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { Some(ptr) => ptr, None => { // zero-sized access - src.next().expect_none("iterator said it was empty but returned an element"); + assert_matches!( + src.next(), + None, + "iterator said it was empty but returned an element" + ); return Ok(()); } }; @@ -894,7 +902,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { let offset_ptr = ptr.offset(Size::from_bytes(idx) * 2, &tcx)?; // `Size` multiplication allocation.write_scalar(&tcx, offset_ptr, val.into(), Size::from_bytes(2))?; } - src.next().expect_none("iterator was longer than it said it would be"); + assert_matches!(src.next(), None, "iterator was longer than it said it would be"); Ok(()) } |
