Skip to content

Commit

Permalink
Touch up assertion messages from PR 970
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 5, 2021
1 parent f6460f4 commit 38d99a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/punctuated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl<T, P> Punctuated<T, P> {
pub fn push_value(&mut self, value: T) {
assert!(
self.empty_or_trailing(),
"Punctuated::push_value: Punctuated is not empty or does not have a trailing punctuation",
"Punctuated::push_value: cannot push value if Punctuated is missing trailing punctuation",
);

self.last = Some(Box::new(value));
Expand All @@ -180,8 +180,9 @@ impl<T, P> Punctuated<T, P> {
pub fn push_punct(&mut self, punctuation: P) {
assert!(
self.last.is_some(),
"Punctuated::push_punct: Punctuated doesn't have any items",
"Punctuated::push_punct: cannot push punctuation if Punctuated is empty or already has trailing punctuation",
);

let last = self.last.take().unwrap();
self.inner.push((*last, punctuation));
}
Expand Down

0 comments on commit 38d99a7

Please sign in to comment.