Skip to content

Commit

Permalink
fix: Remove unnecessary clones
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-bjareholt committed Jul 5, 2020
1 parent 091362f commit db720bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions aw-transform/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub fn chunk_events_by_key(events: Vec<Event>, key: &str) -> Vec<Event> {
for event in events {
if chunked_events.is_empty() && event.data.get(key).is_some() {
// TODO: Add sub-chunks
chunked_events.push(event.clone());
chunked_events.push(event);
} else {
let val = match event.data.get(key) {
None => continue,
Expand All @@ -20,7 +20,7 @@ pub fn chunk_events_by_key(events: Vec<Event>, key: &str) -> Vec<Event> {
chunked_events.push(last_event);
if &last_val != val {
// TODO: Add sub-chunks
chunked_events.push(event.clone());
chunked_events.push(event);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions aw-transform/src/filter_keyvals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn filter_keyvals(mut events: Vec<Event>, key: &str, vals: &[Value]) -> Vec<
if let Some(v) = event.data.get(key) {
for val in vals {
if val == v {
filtered_events.push(event.clone());
filtered_events.push(event);
break;
}
}
Expand All @@ -24,7 +24,7 @@ pub fn filter_keyvals_regex(mut events: Vec<Event>, key: &str, regex: &Regex) ->
for event in events.drain(..) {
if let Some(v) = event.data.get(key) {
if regex.is_match(v.as_str().unwrap()) {
filtered_events.push(event.clone());
filtered_events.push(event);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion aw-transform/src/flood.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn flood(events: Vec<Event>, pulsetime: chrono::Duration) -> Vec<Event> {
gap_prev = Some(gap);
}
}
new_events.push(e1.clone());
new_events.push(e1);
}
new_events
}
Expand Down

0 comments on commit db720bf

Please sign in to comment.