Makes Clippy happy

pull/93/head
Tpt 3 years ago
parent 35ecc12557
commit f898dd09cc
  1. 1
      lib/src/lib.rs
  2. 18
      lib/src/model/xsd/date_time.rs
  3. 6
      lib/src/model/xsd/decimal.rs
  4. 6
      lib/src/model/xsd/duration.rs
  5. 2
      lib/src/store/binary_encoder.rs
  6. 12
      lib/src/store/rocksdb.rs
  7. 10
      lib/src/store/sled.rs

@ -76,7 +76,6 @@
clippy::explicit_iter_loop,
clippy::expl_impl_clone_on_copy,
clippy::fallible_impl_from,
clippy::filter_map,
clippy::filter_map_next,
clippy::manual_find_map,
clippy::get_unwrap,

@ -104,7 +104,7 @@ impl DateTime {
}
}
pub fn to_be_bytes(&self) -> [u8; 18] {
pub fn to_be_bytes(self) -> [u8; 18] {
self.timestamp.to_be_bytes()
}
@ -283,7 +283,7 @@ impl Time {
self.timestamp.timezone_offset()
}
pub fn to_be_bytes(&self) -> [u8; 18] {
pub fn to_be_bytes(self) -> [u8; 18] {
self.timestamp.to_be_bytes()
}
@ -435,7 +435,7 @@ impl Date {
self.timestamp.timezone_offset()
}
pub fn to_be_bytes(&self) -> [u8; 18] {
pub fn to_be_bytes(self) -> [u8; 18] {
self.timestamp.to_be_bytes()
}
@ -576,7 +576,7 @@ impl GYearMonth {
self.timestamp.timezone_offset()
}
pub fn to_be_bytes(&self) -> [u8; 18] {
pub fn to_be_bytes(self) -> [u8; 18] {
self.timestamp.to_be_bytes()
}
@ -671,7 +671,7 @@ impl GYear {
self.timestamp.timezone_offset()
}
pub fn to_be_bytes(&self) -> [u8; 18] {
pub fn to_be_bytes(self) -> [u8; 18] {
self.timestamp.to_be_bytes()
}
@ -775,7 +775,7 @@ impl GMonthDay {
self.timestamp.timezone_offset()
}
pub fn to_be_bytes(&self) -> [u8; 18] {
pub fn to_be_bytes(self) -> [u8; 18] {
self.timestamp.to_be_bytes()
}
@ -866,7 +866,7 @@ impl GMonth {
self.timestamp.timezone_offset()
}
pub fn to_be_bytes(&self) -> [u8; 18] {
pub fn to_be_bytes(self) -> [u8; 18] {
self.timestamp.to_be_bytes()
}
@ -969,7 +969,7 @@ impl GDay {
self.timestamp.timezone_offset()
}
pub fn to_be_bytes(&self) -> [u8; 18] {
pub fn to_be_bytes(self) -> [u8; 18] {
self.timestamp.to_be_bytes()
}
@ -1326,7 +1326,7 @@ impl Timestamp {
})
}
fn to_be_bytes(&self) -> [u8; 18] {
fn to_be_bytes(self) -> [u8; 18] {
let mut bytes = [0; 18];
bytes[0..16].copy_from_slice(&self.value.to_be_bytes());
bytes[16..18].copy_from_slice(&match &self.timezone_offset {

@ -39,7 +39,7 @@ impl Decimal {
}
#[inline]
pub fn to_be_bytes(&self) -> [u8; 16] {
pub fn to_be_bytes(self) -> [u8; 16] {
self.value.to_be_bytes()
}
@ -159,7 +159,7 @@ impl Decimal {
/// Creates a `f32` from a `Decimal` without taking care of precision
#[inline]
#[allow(clippy::cast_possible_truncation)]
pub fn to_f32(&self) -> f32 {
pub fn to_f32(self) -> f32 {
self.to_f64() as f32
}
@ -175,7 +175,7 @@ impl Decimal {
/// Creates a `f64` from a `Decimal` without taking care of precision
#[inline]
#[allow(clippy::cast_possible_truncation, clippy::cast_precision_loss)]
pub fn to_f64(&self) -> f64 {
pub fn to_f64(self) -> f64 {
(self.value as f64) / (DECIMAL_PART_POW as f64)
}

@ -74,7 +74,7 @@ impl Duration {
self.day_time.all_seconds()
}
pub fn to_be_bytes(&self) -> [u8; 24] {
pub fn to_be_bytes(self) -> [u8; 24] {
let mut bytes = [0; 24];
bytes[0..8].copy_from_slice(&self.year_month.to_be_bytes());
bytes[8..24].copy_from_slice(&self.day_time.to_be_bytes());
@ -273,7 +273,7 @@ impl YearMonthDuration {
self.months
}
pub fn to_be_bytes(&self) -> [u8; 8] {
pub fn to_be_bytes(self) -> [u8; 8] {
self.months.to_be_bytes()
}
@ -425,7 +425,7 @@ impl DayTimeDuration {
self.seconds
}
pub fn to_be_bytes(&self) -> [u8; 16] {
pub fn to_be_bytes(self) -> [u8; 16] {
self.seconds.to_be_bytes()
}

@ -74,7 +74,7 @@ impl StrHash {
}
#[inline]
pub fn to_be_bytes(&self) -> [u8; 16] {
pub fn to_be_bytes(self) -> [u8; 16] {
self.hash.to_be_bytes()
}
}

@ -957,7 +957,6 @@ impl WritableEncodedStore for AutoBatchWriter<'_> {
write_osp_quad(&mut self.buffer, quad);
self.batch.put_cf(self.store.dosp_cf(), &self.buffer, &[]);
self.buffer.clear();
} else {
write_spog_quad(&mut self.buffer, quad);
self.batch.put_cf(self.store.spog_cf(), &self.buffer, &[]);
@ -985,8 +984,8 @@ impl WritableEncodedStore for AutoBatchWriter<'_> {
write_term(&mut self.buffer, quad.graph_name);
self.batch.put_cf(self.store.graphs_cf(), &self.buffer, &[]);
self.buffer.clear();
}
self.buffer.clear();
self.apply_if_big()
}
@ -1003,7 +1002,6 @@ impl WritableEncodedStore for AutoBatchWriter<'_> {
write_osp_quad(&mut self.buffer, quad);
self.batch.delete_cf(self.store.dosp_cf(), &self.buffer);
self.buffer.clear();
} else {
write_spog_quad(&mut self.buffer, quad);
self.batch.delete_cf(self.store.spog_cf(), &self.buffer);
@ -1027,8 +1025,8 @@ impl WritableEncodedStore for AutoBatchWriter<'_> {
write_gosp_quad(&mut self.buffer, quad);
self.batch.delete_cf(self.store.gosp_cf(), &self.buffer);
self.buffer.clear();
}
self.buffer.clear();
self.apply_if_big()
}
@ -1212,7 +1210,6 @@ impl WritableEncodedStore for RocksDbTransaction<'_> {
write_osp_quad(&mut self.buffer, quad);
self.batch.put_cf(self.store.dosp_cf(), &self.buffer, &[]);
self.buffer.clear();
} else {
write_spog_quad(&mut self.buffer, quad);
self.batch.put_cf(self.store.spog_cf(), &self.buffer, &[]);
@ -1240,8 +1237,8 @@ impl WritableEncodedStore for RocksDbTransaction<'_> {
write_term(&mut self.buffer, quad.graph_name);
self.batch.put_cf(self.store.graphs_cf(), &self.buffer, &[]);
self.buffer.clear();
}
self.buffer.clear();
Ok(())
}
@ -1258,7 +1255,6 @@ impl WritableEncodedStore for RocksDbTransaction<'_> {
write_osp_quad(&mut self.buffer, quad);
self.batch.delete_cf(self.store.dosp_cf(), &self.buffer);
self.buffer.clear();
} else {
write_spog_quad(&mut self.buffer, quad);
self.batch.delete_cf(self.store.spog_cf(), &self.buffer);
@ -1282,8 +1278,8 @@ impl WritableEncodedStore for RocksDbTransaction<'_> {
write_gosp_quad(&mut self.buffer, quad);
self.batch.delete_cf(self.store.gosp_cf(), &self.buffer);
self.buffer.clear();
}
self.buffer.clear();
Ok(())
}

@ -1049,7 +1049,6 @@ impl<'a> WritableEncodedStore for &'a SledStore {
write_osp_quad(&mut buffer, quad);
self.dosp.insert(buffer.as_slice(), &[])?;
buffer.clear();
} else {
write_spog_quad(&mut buffer, quad);
self.spog.insert(buffer.as_slice(), &[])?;
@ -1077,7 +1076,6 @@ impl<'a> WritableEncodedStore for &'a SledStore {
write_term(&mut buffer, quad.graph_name);
self.graphs.insert(&buffer, &[])?;
buffer.clear();
}
Ok(())
@ -1097,7 +1095,6 @@ impl<'a> WritableEncodedStore for &'a SledStore {
write_osp_quad(&mut buffer, quad);
self.dosp.remove(buffer.as_slice())?;
buffer.clear();
} else {
write_spog_quad(&mut buffer, quad);
self.spog.remove(buffer.as_slice())?;
@ -1121,7 +1118,6 @@ impl<'a> WritableEncodedStore for &'a SledStore {
write_gosp_quad(&mut buffer, quad);
self.gosp.remove(buffer.as_slice())?;
buffer.clear();
}
Ok(())
@ -1352,7 +1348,6 @@ impl<'a> WritableEncodedStore for &'a SledTransaction<'a> {
write_osp_quad(&mut buffer, quad);
self.dosp.insert(buffer.as_slice(), &[])?;
buffer.clear();
} else {
write_spog_quad(&mut buffer, quad);
self.spog.insert(buffer.as_slice(), &[])?;
@ -1380,8 +1375,8 @@ impl<'a> WritableEncodedStore for &'a SledTransaction<'a> {
write_term(&mut buffer, quad.graph_name);
self.graphs.insert(buffer.as_slice(), &[])?;
buffer.clear();
}
buffer.clear();
Ok(())
}
@ -1403,7 +1398,6 @@ impl<'a> WritableEncodedStore for &'a SledTransaction<'a> {
write_osp_quad(&mut buffer, quad);
self.dosp.remove(buffer.as_slice())?;
buffer.clear();
} else {
write_spog_quad(&mut buffer, quad);
self.spog.remove(buffer.as_slice())?;
@ -1427,8 +1421,8 @@ impl<'a> WritableEncodedStore for &'a SledTransaction<'a> {
write_gosp_quad(&mut buffer, quad);
self.gosp.remove(buffer.as_slice())?;
buffer.clear();
}
buffer.clear();
Ok(())
}

Loading…
Cancel
Save