Skip to content

Commit 289d7cc

Browse files
committed
Reduce code size of assert_matches_failed
1 parent a1bea15 commit 289d7cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/panicking.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ pub fn assert_matches_failed<T: fmt::Debug + ?Sized>(
190190
right: &str,
191191
args: Option<fmt::Arguments<'_>>,
192192
) -> ! {
193-
// Use the Display implementation to display the pattern.
193+
// The pattern is a string so it can be displayed directly.
194194
struct Pattern<'a>(&'a str);
195195
impl fmt::Debug for Pattern<'_> {
196196
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
197-
fmt::Display::fmt(self.0, f)
197+
f.write_str(self.0)
198198
}
199199
}
200200
assert_failed_inner(AssertKind::Match, &left, &Pattern(right), args);

0 commit comments

Comments
 (0)