Skip to content

Commit

Permalink
Fix usage of split_inclusive in event parser logic
Browse files Browse the repository at this point in the history
It was relying on old behavior where Some(empty slice) would be returned
if there were no matches. This was updated in more recent rust versions to return None,
but CircleCI was using a much older version of rust than I have locally.

Updated the usage and CircleCI config to use cimg/rust.
  • Loading branch information
cwaldren-ld committed Mar 24, 2022
1 parent febc97d commit eda88f5
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions eventsource-client/src/event_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,14 @@ impl EventParser {
// * the first line should be appended to the incomplete line, if any

if let Some(incomplete_line) = self.incomplete_line.as_mut() {
let line = lines.next().expect("Should not be none!");
// split always returns at least one item
trace!(
"extending line from previous chunk: {:?}+{:?}",
logify(incomplete_line),
logify(line)
);
if let Some(line) = lines.next() {
trace!(
"extending line from previous chunk: {:?}+{:?}",
logify(incomplete_line),
logify(line)
);

self.last_char_was_cr = false;
if !line.is_empty() {
self.last_char_was_cr = false;
// Checking the last character handles lines where the last character is a
// terminator, but also where the entire line is a terminator.
match line.last().unwrap() {
Expand Down

0 comments on commit eda88f5

Please sign in to comment.