Skip to content

Commit

Permalink
clippy: or_insert(default) -> or_default() (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 authored Oct 10, 2023
1 parent 19c733a commit e2bac72
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sea-streamer-file/src/producer/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl Writer {
stream
} else if sink.started_from() == Header::size() as u64 {
// this is a fresh new file stream
streams.entry(key).or_insert(StreamState::default())
streams.entry(key).or_default()
} else {
// we'll need to seek backwards until we find the last message of the same stream

Expand Down Expand Up @@ -211,7 +211,7 @@ impl Writer {
let m = &msg.message;
let entry = streams
.entry((m.stream_key(), m.shard_id()))
.or_insert(StreamState::default());
.or_default();
if entry.seq_no < m.sequence() {
entry.seq_no = m.sequence();
entry.ts = m.timestamp();
Expand All @@ -237,8 +237,7 @@ impl Writer {
file.seek(SeqPos::At(sink.offset())).await?; // restore offset
sink.use_file(FileSink::new(file, file_size_limit)?);
// now we've gone through the stream, we can safely assume the stream state
let entry =
streams.entry(key.clone()).or_insert(StreamState::default());
let entry = streams.entry(key.clone()).or_default();
sink.update_stream_state(
key,
BeaconState {
Expand Down

0 comments on commit e2bac72

Please sign in to comment.