Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d->p variable naming in Punctuated implementation #1082

Merged
merged 1 commit into from
Oct 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/punctuated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl<T, P> Punctuated<T, P> {
if self.last.is_some() {
self.last.take().map(|t| Pair::End(*t))
} else {
self.inner.pop().map(|(t, d)| Pair::Punctuated(t, d))
self.inner.pop().map(|(t, p)| Pair::Punctuated(t, p))
}
}

Expand Down Expand Up @@ -937,16 +937,16 @@ impl<T, P> Pair<T, P> {
/// the final one and there is no trailing punctuation.
pub fn punct(&self) -> Option<&P> {
match self {
Pair::Punctuated(_, d) => Some(d),
Pair::Punctuated(_, p) => Some(p),
Pair::End(_) => None,
}
}

/// Creates a punctuated pair out of a syntax tree node and an optional
/// following punctuation.
pub fn new(t: T, d: Option<P>) -> Self {
match d {
Some(d) => Pair::Punctuated(t, d),
pub fn new(t: T, p: Option<P>) -> Self {
match p {
Some(p) => Pair::Punctuated(t, p),
None => Pair::End(t),
}
}
Expand All @@ -955,7 +955,7 @@ impl<T, P> Pair<T, P> {
/// optional following punctuation.
pub fn into_tuple(self) -> (T, Option<P>) {
match self {
Pair::Punctuated(t, d) => (t, Some(d)),
Pair::Punctuated(t, p) => (t, Some(p)),
Pair::End(t) => (t, None),
}
}
Expand Down