-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Remove len
from JoinCommaSeparatedBuilder
#6185
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
Conversation
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do like your enums and accessor methods :D
/// First entry, ending at the given position. | ||
First(TextSize), | ||
/// Second or any subsequent entry ending at the specific position. | ||
Rest(TextSize), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Call this AtLeastTwo
, Rest
makes it sound like a head/rest situation
@@ -245,12 +275,11 @@ impl<'fmt, 'ast, 'buf> JoinCommaSeparatedBuilder<'fmt, 'ast, 'buf> { | |||
Separator: Format<PyFormatContext<'ast>>, | |||
{ | |||
self.result = self.result.and_then(|_| { | |||
if self.end_of_last_entry.is_some() { | |||
if !self.last_entry.is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: invert and call has_last_element
PR Check ResultsBenchmarkLinux
Windows
|
Ohhh I do love them |
c85b721
to
e0e75a1
Compare
Summary
Replaces the
len
onJoinCommaSeparated
by a state enum that tracks whether there's no previous node, its the first node, or any subsequent node.Test Plan
cargo test