remove useless into()

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
This commit is contained in:
Andy Lok 2020-12-15 18:36:35 +08:00
parent 8f20f0c09e
commit e0e918ce2c
2 changed files with 4 additions and 4 deletions

View File

@ -189,7 +189,7 @@ impl Transaction {
pub async fn get_for_update(&mut self, key: impl Into<Key>) -> Result<Option<Value>> { pub async fn get_for_update(&mut self, key: impl Into<Key>) -> Result<Option<Value>> {
self.check_allow_operation()?; self.check_allow_operation()?;
if !self.is_pessimistic() { if !self.is_pessimistic() {
Err(ClientError::InvalidTransactionType.into()) Err(ClientError::InvalidTransactionType)
} else { } else {
let key = key.into(); let key = key.into();
self.pessimistic_lock(iter::once(key.clone())).await?; self.pessimistic_lock(iter::once(key.clone())).await?;
@ -275,7 +275,7 @@ impl Transaction {
) -> Result<impl Iterator<Item = KvPair>> { ) -> Result<impl Iterator<Item = KvPair>> {
self.check_allow_operation()?; self.check_allow_operation()?;
if !self.is_pessimistic() { if !self.is_pessimistic() {
Err(ClientError::InvalidTransactionType.into()) Err(ClientError::InvalidTransactionType)
} else { } else {
let keys: Vec<Key> = keys.into_iter().map(|it| it.into()).collect(); let keys: Vec<Key> = keys.into_iter().map(|it| it.into()).collect();
self.pessimistic_lock(keys.clone()).await?; self.pessimistic_lock(keys.clone()).await?;
@ -683,7 +683,7 @@ impl TwoPhaseCommitter {
if self.style.try_one_pc && response.len() == 1 { if self.style.try_one_pc && response.len() == 1 {
if response[0].one_pc_commit_ts == 0 { if response[0].one_pc_commit_ts == 0 {
return Err(ClientError::OnePcFailure.into()); return Err(ClientError::OnePcFailure);
} }
return Ok(response[0].one_pc_commit_ts); return Ok(response[0].one_pc_commit_ts);

View File

@ -27,7 +27,7 @@ macro_rules! impl_request {
.$fun(self, options)? .$fun(self, options)?
.await .await
.map(|r| Box::new(r) as Box<dyn Any>) .map(|r| Box::new(r) as Box<dyn Any>)
.map_err(|e| ClientError::Grpc(e).into()) .map_err(|e| ClientError::Grpc(e))
} }
fn label(&self) -> &'static str { fn label(&self) -> &'static str {