diff --git a/src/store/memory.rs b/src/store/memory.rs index ac9170ee..5b871b40 100644 --- a/src/store/memory.rs +++ b/src/store/memory.rs @@ -347,29 +347,29 @@ impl EncodedQuadsStore for MemoryStore { fn insert(&self, quad: &EncodedQuad) -> Result<()> { let mut graph_indexes = self.graph_indexes.write()?; let graph = graph_indexes - .entry(quad.graph_name.clone()) + .entry(quad.graph_name) .or_insert_with(MemoryGraphIndexes::default); graph .spo - .entry(quad.subject.clone()) + .entry(quad.subject) .or_default() - .entry(quad.predicate.clone()) + .entry(quad.predicate) .or_default() - .insert(quad.object.clone()); + .insert(quad.object); graph .pos - .entry(quad.predicate.clone()) + .entry(quad.predicate) .or_default() - .entry(quad.object.clone()) + .entry(quad.object) .or_default() - .insert(quad.subject.clone()); + .insert(quad.subject); graph .osp - .entry(quad.object.clone()) + .entry(quad.object) .or_default() - .entry(quad.subject.clone()) + .entry(quad.subject) .or_default() - .insert(quad.predicate.clone()); + .insert(quad.predicate); Ok(()) } @@ -446,10 +446,5 @@ fn encoded_quad( object: &EncodedTerm, graph_name: &EncodedTerm, ) -> EncodedQuad { - EncodedQuad::new( - subject.clone(), - predicate.clone(), - object.clone(), - graph_name.clone(), - ) + EncodedQuad::new(*subject, *predicate, *object, *graph_name) } diff --git a/src/store/numeric_encoder.rs b/src/store/numeric_encoder.rs index 2d2ffe50..3086f6dc 100644 --- a/src/store/numeric_encoder.rs +++ b/src/store/numeric_encoder.rs @@ -24,7 +24,7 @@ const TYPE_TYPED_LITERAL_ID: u8 = 4; pub static ENCODED_DEFAULT_GRAPH: EncodedTerm = EncodedTerm::DefaultGraph {}; -#[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Hash)] +#[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Copy, Hash)] pub enum EncodedTerm { DefaultGraph {}, NamedNode { iri_id: u64 }, @@ -252,7 +252,7 @@ impl Encoder { object: self.encode_term(quad.object())?, graph_name: match quad.graph_name() { Some(graph_name) => self.encode_named_or_blank_node(&graph_name)?, - None => ENCODED_DEFAULT_GRAPH.clone(), + None => ENCODED_DEFAULT_GRAPH, }, }) } @@ -266,7 +266,7 @@ impl Encoder { subject: self.encode_named_or_blank_node(triple.subject())?, predicate: self.encode_named_node(triple.predicate())?, object: self.encode_term(triple.object())?, - graph_name: graph_name.clone(), + graph_name: *graph_name, }) } diff --git a/src/store/rocksdb.rs b/src/store/rocksdb.rs index d1d5cca4..103556a4 100644 --- a/src/store/rocksdb.rs +++ b/src/store/rocksdb.rs @@ -130,7 +130,7 @@ impl EncodedQuadsStore for RocksDbStore { iter.seek(&encode_term(subject)?); Ok(FilteringEncodedQuadsIterator { iter: SPOGIndexIterator { iter }, - filter: EncodedQuadPattern::new(Some(subject.clone()), None, None, None), + filter: EncodedQuadPattern::new(Some(*subject), None, None, None), }) } @@ -143,12 +143,7 @@ impl EncodedQuadsStore for RocksDbStore { iter.seek(&encode_term_pair(subject, predicate)?); Ok(FilteringEncodedQuadsIterator { iter: SPOGIndexIterator { iter }, - filter: EncodedQuadPattern::new( - Some(subject.clone()), - Some(predicate.clone()), - None, - None, - ), + filter: EncodedQuadPattern::new(Some(*subject), Some(*predicate), None, None), }) } @@ -162,12 +157,7 @@ impl EncodedQuadsStore for RocksDbStore { iter.seek(&encode_term_triple(subject, predicate, object)?); Ok(FilteringEncodedQuadsIterator { iter: SPOGIndexIterator { iter }, - filter: EncodedQuadPattern::new( - Some(subject.clone()), - Some(predicate.clone()), - Some(object.clone()), - None, - ), + filter: EncodedQuadPattern::new(Some(*subject), Some(*predicate), Some(*object), None), }) } @@ -180,12 +170,7 @@ impl EncodedQuadsStore for RocksDbStore { iter.seek(&encode_term_pair(object, subject)?); Ok(FilteringEncodedQuadsIterator { iter: OSPGIndexIterator { iter }, - filter: EncodedQuadPattern::new( - Some(subject.clone()), - None, - Some(object.clone()), - None, - ), + filter: EncodedQuadPattern::new(Some(*subject), None, Some(*object), None), }) } @@ -197,7 +182,7 @@ impl EncodedQuadsStore for RocksDbStore { iter.seek(&encode_term(predicate)?); Ok(FilteringEncodedQuadsIterator { iter: POSGIndexIterator { iter }, - filter: EncodedQuadPattern::new(None, Some(predicate.clone()), None, None), + filter: EncodedQuadPattern::new(None, Some(*predicate), None, None), }) } @@ -210,12 +195,7 @@ impl EncodedQuadsStore for RocksDbStore { iter.seek(&encode_term_pair(predicate, object)?); Ok(FilteringEncodedQuadsIterator { iter: POSGIndexIterator { iter }, - filter: EncodedQuadPattern::new( - None, - Some(predicate.clone()), - Some(object.clone()), - None, - ), + filter: EncodedQuadPattern::new(None, Some(*predicate), Some(*object), None), }) } @@ -227,7 +207,7 @@ impl EncodedQuadsStore for RocksDbStore { iter.seek(&encode_term(&object)?); Ok(FilteringEncodedQuadsIterator { iter: OSPGIndexIterator { iter }, - filter: EncodedQuadPattern::new(None, None, Some(object.clone()), None), + filter: EncodedQuadPattern::new(None, None, Some(*object), None), }) } @@ -237,7 +217,7 @@ impl EncodedQuadsStore for RocksDbStore { ) -> Result> { Ok(InGraphQuadsIterator { iter: self.quads()?, - graph_name: graph_name.clone(), + graph_name: *graph_name, }) } @@ -248,7 +228,7 @@ impl EncodedQuadsStore for RocksDbStore { ) -> Result>> { Ok(InGraphQuadsIterator { iter: self.quads_for_subject(subject)?, - graph_name: graph_name.clone(), + graph_name: *graph_name, }) } @@ -260,7 +240,7 @@ impl EncodedQuadsStore for RocksDbStore { ) -> Result>> { Ok(InGraphQuadsIterator { iter: self.quads_for_subject_predicate(subject, predicate)?, - graph_name: graph_name.clone(), + graph_name: *graph_name, }) } @@ -272,7 +252,7 @@ impl EncodedQuadsStore for RocksDbStore { ) -> Result>> { Ok(InGraphQuadsIterator { iter: self.quads_for_subject_object(subject, object)?, - graph_name: graph_name.clone(), + graph_name: *graph_name, }) } @@ -283,7 +263,7 @@ impl EncodedQuadsStore for RocksDbStore { ) -> Result>> { Ok(InGraphQuadsIterator { iter: self.quads_for_predicate(predicate)?, - graph_name: graph_name.clone(), + graph_name: *graph_name, }) } @@ -295,7 +275,7 @@ impl EncodedQuadsStore for RocksDbStore { ) -> Result>> { Ok(InGraphQuadsIterator { iter: self.quads_for_predicate_object(predicate, object)?, - graph_name: graph_name.clone(), + graph_name: *graph_name, }) } @@ -306,7 +286,7 @@ impl EncodedQuadsStore for RocksDbStore { ) -> Result>> { Ok(InGraphQuadsIterator { iter: self.quads_for_object(object)?, - graph_name: graph_name.clone(), + graph_name: *graph_name, }) }