Skip to content

Commit

Permalink
Remove assert_matches users
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum authored and pietroalbini committed May 4, 2021
1 parent 607a225 commit d18f0a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
6 changes: 1 addition & 5 deletions compiler/rustc_middle/src/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ impl<'ctx> rustc_ast::HashStableContext for StableHashingContext<'ctx> {
item.hash_stable(self, hasher);
style.hash_stable(self, hasher);
span.hash_stable(self, hasher);
assert_matches!(
tokens.as_ref(),
None,
"Tokens should have been removed during lowering!"
);
assert!(tokens.as_ref().is_none(), "Tokens should have been removed during lowering!");
} else {
unreachable!();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
for dest in bytes {
*dest = src.next().expect("iterator was shorter than it said it would be");
}
assert_matches!(src.next(), None, "iterator was longer than it said it would be");
assert!(src.next().is_none(), "iterator was longer than it said it would be");
Ok(())
}

Expand Down
14 changes: 3 additions & 11 deletions compiler/rustc_mir/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,11 +854,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
Some(ptr) => ptr,
None => {
// zero-sized access
assert_matches!(
src.next(),
None,
"iterator said it was empty but returned an element"
);
assert!(src.next().is_none(), "iterator said it was empty but returned an element");
return Ok(());
}
};
Expand All @@ -884,11 +880,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
Some(ptr) => ptr,
None => {
// zero-sized access
assert_matches!(
src.next(),
None,
"iterator said it was empty but returned an element"
);
assert!(src.next().is_none(), "iterator said it was empty but returned an element");
return Ok(());
}
};
Expand All @@ -902,7 +894,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))?;
}
assert_matches!(src.next(), None, "iterator was longer than it said it would be");
assert!(src.next().is_none(), "iterator was longer than it said it would be");
Ok(())
}

Expand Down
11 changes: 0 additions & 11 deletions src/test/ui/macros/assert-matches-macro-msg.rs

This file was deleted.

0 comments on commit d18f0a4

Please sign in to comment.