Skip to content

Commit

Permalink
revert to indexset
Browse files Browse the repository at this point in the history
Signed-off-by: iGxnon <igxnon@gmail.com>
  • Loading branch information
iGxnon committed Feb 7, 2024
1 parent 269d472 commit d339316
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ tokio-util = { version = "0.7.9", features = ["codec", "net", "io-util"] }
[dev-dependencies]
criterion = { version = "0.5", features = ["async_futures"] }
env_logger = "0.11.1"
indexmap = "2"
minitrace = { version = "0.6", features = ["enable"] }
rand = "0.8"

Expand Down
11 changes: 4 additions & 7 deletions src/codec/decoder/dedup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ where
#[cfg(test)]
mod test {

use std::collections::BTreeSet;
use std::ops::Sub;

use bytes::Bytes;
use futures::StreamExt;
use futures_async_stream::stream;
use indexmap::IndexSet;

use super::*;
use crate::errors::CodecError;
Expand Down Expand Up @@ -409,8 +409,8 @@ mod test {
.take(scale)
.collect::<Vec<_>>();

let idx1_set: BTreeSet<u32> = idx1.clone().into_iter().collect();
let idx2_set: BTreeSet<u32> = idx2.clone().into_iter().collect();
let idx1_set: IndexSet<u32> = idx1.clone().into_iter().collect();
let idx2_set: IndexSet<u32> = idx2.clone().into_iter().collect();
let diff = idx2_set.sub(&idx1_set);

let frame = {
Expand All @@ -428,10 +428,7 @@ mod test {
window: DuplicateWindow::default(),
outgoing_ack_tx,
};
assert_eq!(
dedup.next().await.unwrap().unwrap(),
frame_set(idx1_set.clone())
);
assert_eq!(dedup.next().await.unwrap().unwrap(), frame_set(idx1_set));

if diff.is_empty() {
assert!(dedup.next().await.is_none());
Expand Down

0 comments on commit d339316

Please sign in to comment.