Skip to content

Commit d18f0a4

Browse files
Mark-Simulacrumpietroalbini
authored andcommitted
Remove assert_matches users
1 parent 607a225 commit d18f0a4

File tree

4 files changed

+5
-28
lines changed

4 files changed

+5
-28
lines changed

compiler/rustc_middle/src/ich/impls_syntax.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ impl<'ctx> rustc_ast::HashStableContext for StableHashingContext<'ctx> {
4545
item.hash_stable(self, hasher);
4646
style.hash_stable(self, hasher);
4747
span.hash_stable(self, hasher);
48-
assert_matches!(
49-
tokens.as_ref(),
50-
None,
51-
"Tokens should have been removed during lowering!"
52-
);
48+
assert!(tokens.as_ref().is_none(), "Tokens should have been removed during lowering!");
5349
} else {
5450
unreachable!();
5551
}

compiler/rustc_middle/src/mir/interpret/allocation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
339339
for dest in bytes {
340340
*dest = src.next().expect("iterator was shorter than it said it would be");
341341
}
342-
assert_matches!(src.next(), None, "iterator was longer than it said it would be");
342+
assert!(src.next().is_none(), "iterator was longer than it said it would be");
343343
Ok(())
344344
}
345345

compiler/rustc_mir/src/interpret/memory.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -854,11 +854,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
854854
Some(ptr) => ptr,
855855
None => {
856856
// zero-sized access
857-
assert_matches!(
858-
src.next(),
859-
None,
860-
"iterator said it was empty but returned an element"
861-
);
857+
assert!(src.next().is_none(), "iterator said it was empty but returned an element");
862858
return Ok(());
863859
}
864860
};
@@ -884,11 +880,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
884880
Some(ptr) => ptr,
885881
None => {
886882
// zero-sized access
887-
assert_matches!(
888-
src.next(),
889-
None,
890-
"iterator said it was empty but returned an element"
891-
);
883+
assert!(src.next().is_none(), "iterator said it was empty but returned an element");
892884
return Ok(());
893885
}
894886
};
@@ -902,7 +894,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
902894
let offset_ptr = ptr.offset(Size::from_bytes(idx) * 2, &tcx)?; // `Size` multiplication
903895
allocation.write_scalar(&tcx, offset_ptr, val.into(), Size::from_bytes(2))?;
904896
}
905-
assert_matches!(src.next(), None, "iterator was longer than it said it would be");
897+
assert!(src.next().is_none(), "iterator was longer than it said it would be");
906898
Ok(())
907899
}
908900

src/test/ui/macros/assert-matches-macro-msg.rs

-11
This file was deleted.

0 commit comments

Comments
 (0)