Skip to content

Commit

Permalink
mut Collection for intersect_manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Sep 18, 2024
1 parent f4e89f4 commit 9b9e17e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/core/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,8 @@ impl Collection {
Ok(sig)
}

pub fn intersect_manifest(self, mf: &Manifest) -> Self {
let manifest = self.manifest.intersect_manifest(mf);
Self {
manifest,
storage: self.storage.clone(),
}
pub fn intersect_manifest(&mut self, mf: &Manifest) -> () {

Check failure on line 219 in src/core/src/collection.rs

View workflow job for this annotation

GitHub Actions / Lints (stable)

unneeded unit return type

Check failure on line 219 in src/core/src/collection.rs

View workflow job for this annotation

GitHub Actions / Lints (beta)

unneeded unit return type
self.manifest = self.manifest.intersect_manifest(mf);
}
}

Expand Down Expand Up @@ -378,7 +374,7 @@ mod test {
let sigs: Vec<Signature> = serde_json::from_reader(reader).expect("Loading error");
assert_eq!(sigs.len(), 4);
// load sigs into collection + select compatible signatures
let cl = Collection::from_sigs(sigs).unwrap();
let mut cl = Collection::from_sigs(sigs).unwrap();
// all sigs should remain
assert_eq!(cl.len(), 4);

Expand All @@ -389,8 +385,8 @@ mod test {

// now intersect:
let manifest2 = Manifest::from(vr);
let cl2 = cl.intersect_manifest(&manifest2);
assert_eq!(cl2.len(), 1);
cl.intersect_manifest(&manifest2);
assert_eq!(cl.len(), 1);
}

#[test]
Expand Down

0 comments on commit 9b9e17e

Please sign in to comment.