From c9d9b041f7caeb33bcef84833e94dcf8d35b355c Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 16 Jul 2022 23:18:24 +0100 Subject: [PATCH] Simplify v.into() value conversion statements --- lib/src/kvs/file/mod.rs | 4 ++-- lib/src/kvs/ixdb/mod.rs | 4 ++-- lib/src/kvs/mem/mod.rs | 4 ++-- lib/src/kvs/tikv/mod.rs | 4 ++-- lib/src/sql/value/get.rs | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/src/kvs/file/mod.rs b/lib/src/kvs/file/mod.rs index 1d46a2e2..16447836 100644 --- a/lib/src/kvs/file/mod.rs +++ b/lib/src/kvs/file/mod.rs @@ -154,7 +154,7 @@ impl Transaction { return Err(Error::TxReadonly); } // Set the key - self.tx.putc(key.into(), val.into(), chk.map(|v| v.into()))?; + self.tx.putc(key.into(), val.into(), chk.map(Into::into))?; // Return result Ok(()) } @@ -191,7 +191,7 @@ impl Transaction { return Err(Error::TxReadonly); } // Remove the key - self.tx.delc(key.into(), chk.map(|v| v.into()))?; + self.tx.delc(key.into(), chk.map(Into::into))?; // Return result Ok(()) } diff --git a/lib/src/kvs/ixdb/mod.rs b/lib/src/kvs/ixdb/mod.rs index ef55b8ea..2072ae3f 100644 --- a/lib/src/kvs/ixdb/mod.rs +++ b/lib/src/kvs/ixdb/mod.rs @@ -157,7 +157,7 @@ impl Transaction { return Err(Error::TxReadonly); } // Set the key - self.tx.putc(key.into(), val.into(), chk.map(|v| v.into())).await?; + self.tx.putc(key.into(), val.into(), chk.map(Into::into)).await?; // Return result Ok(()) } @@ -194,7 +194,7 @@ impl Transaction { return Err(Error::TxReadonly); } // Remove the key - let res = self.tx.delc(key.into(), chk.map(|v| v.into())).await?; + let res = self.tx.delc(key.into(), chk.map(Into::into)).await?; // Return result Ok(res) } diff --git a/lib/src/kvs/mem/mod.rs b/lib/src/kvs/mem/mod.rs index 994d85bc..5ce6b230 100644 --- a/lib/src/kvs/mem/mod.rs +++ b/lib/src/kvs/mem/mod.rs @@ -154,7 +154,7 @@ impl Transaction { return Err(Error::TxReadonly); } // Set the key - self.tx.putc(key.into(), val.into(), chk.map(|v| v.into()))?; + self.tx.putc(key.into(), val.into(), chk.map(Into::into))?; // Return result Ok(()) } @@ -191,7 +191,7 @@ impl Transaction { return Err(Error::TxReadonly); } // Remove the key - self.tx.delc(key.into(), chk.map(|v| v.into()))?; + self.tx.delc(key.into(), chk.map(Into::into))?; // Return result Ok(()) } diff --git a/lib/src/kvs/tikv/mod.rs b/lib/src/kvs/tikv/mod.rs index c887c0be..a856cf49 100644 --- a/lib/src/kvs/tikv/mod.rs +++ b/lib/src/kvs/tikv/mod.rs @@ -171,7 +171,7 @@ impl Transaction { // Get the val let val = val.into(); // Get the check - let chk = chk.map(|v| v.into()); + let chk = chk.map(Into::into); // Delete the key match (self.tx.get(key.clone()).await?, chk) { (Some(v), Some(w)) if v == w => self.tx.put(key, val).await?, @@ -216,7 +216,7 @@ impl Transaction { // Get the key let key = key.into(); // Get the check - let chk = chk.map(|v| v.into()); + let chk = chk.map(Into::into); // Delete the key match (self.tx.get(key.clone()).await?, chk) { (Some(v), Some(w)) if v == w => self.tx.delete(key).await?, diff --git a/lib/src/sql/value/get.rs b/lib/src/sql/value/get.rs index d9fd0544..b4b4fd3d 100644 --- a/lib/src/sql/value/get.rs +++ b/lib/src/sql/value/get.rs @@ -44,11 +44,11 @@ impl Value { Part::All => { let path = path.next(); let futs = v.iter().map(|v| v.get(ctx, opt, txn, path)); - try_join_all(futs).await.map(|v| v.into()) + try_join_all(futs).await.map(Into::into) } Part::Any => { let futs = v.iter().map(|v| v.get(ctx, opt, txn, path)); - try_join_all(futs).await.map(|v| v.into()) + try_join_all(futs).await.map(Into::into) } Part::First => match v.first() { Some(v) => v.get(ctx, opt, txn, path.next()).await, @@ -74,7 +74,7 @@ impl Value { } _ => { let futs = v.iter().map(|v| v.get(ctx, opt, txn, path)); - try_join_all(futs).await.map(|v| v.into()) + try_join_all(futs).await.map(Into::into) } }, // Current path part is a thing