Skip to content

Commit

Permalink
fix rust clippy
Browse files Browse the repository at this point in the history
Signed-off-by: zenghua <[email protected]>
  • Loading branch information
zenghua committed Nov 10, 2023
1 parent 35c63ce commit fde4ae4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
3 changes: 0 additions & 3 deletions rust/lakesoul-metadata/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

use std::{result, sync::Arc, error::Error, io, fmt::{Display, Formatter}, num};

use num_enum::{TryFromPrimitiveError, TryFromPrimitive};


/// Result type for operations that could result in an [LakeSoulMetaDataError]
pub type Result<T, E = LakeSoulMetaDataError> = result::Result<T, E>;

Expand Down
20 changes: 4 additions & 16 deletions rust/lakesoul-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,7 @@ pub async fn execute_query(
return Err(LakeSoulMetaDataError::from(ErrorKind::InvalidInput));
}
let query_type = DaoType::try_from(query_type).unwrap();
let statement = match get_prepared_statement(client, prepared, &query_type).await {
Ok(statement) => statement,
Err(err) => return Err(LakeSoulMetaDataError::from(err))
};
let statement = get_prepared_statement(client, prepared, &query_type).await?;

let params = joined_string
.split(PARAM_DELIM)
Expand Down Expand Up @@ -818,10 +815,7 @@ pub async fn execute_insert(
return Err(LakeSoulMetaDataError::from(ErrorKind::InvalidInput))
}
let insert_type = DaoType::try_from(insert_type).unwrap();
let statement = match get_prepared_statement(client, prepared, &insert_type).await {
Ok(statement) => statement,
Err(err) => return Err(LakeSoulMetaDataError::from(err))
};
let statement = get_prepared_statement(client, prepared, &insert_type).await?;

let result = match insert_type {
DaoType::InsertNamespace if wrapper.namespace.len() == 1 => {
Expand Down Expand Up @@ -1080,10 +1074,7 @@ pub async fn execute_update(
return Err(LakeSoulMetaDataError::from(std::io::ErrorKind::InvalidInput))
}
let update_type = DaoType::try_from(update_type).unwrap();
let statement = match get_prepared_statement( client, prepared, &update_type).await {
Ok(statement) => statement,
Err(err) => return Err(LakeSoulMetaDataError::from(err))
};
let statement = get_prepared_statement( client, prepared, &update_type).await?;

let params = joined_string
.split(PARAM_DELIM)
Expand Down Expand Up @@ -1194,10 +1185,7 @@ pub async fn execute_query_scalar(
return Err(LakeSoulMetaDataError::from(ErrorKind::InvalidInput))
}
let query_type = DaoType::try_from(query_type).unwrap();
let statement = match get_prepared_statement(client, prepared, &query_type).await {
Ok(statement) => statement,
Err(err) => return Err(LakeSoulMetaDataError::from(err))
};
let statement = get_prepared_statement(client, prepared, &query_type).await?;

let params = joined_string
.split(PARAM_DELIM)
Expand Down
3 changes: 1 addition & 2 deletions rust/lakesoul-metadata/src/metadata_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{collections::HashMap, vec, env, fs};

use proto::proto::entity::{TablePathId, TableNameId, TableInfo, PartitionInfo, JniWrapper, DataCommitInfo, MetaInfo, CommitOp, self};
use prost::Message;
use tokio::runtime::{Runtime, Builder};
use tokio_postgres::Client;

use url::Url;
Expand Down Expand Up @@ -183,7 +182,7 @@ impl MetaDataClient {
return Ok(());
}
None => {
let _ = self.insert_data_commit_info(&data_commit_info);
self.insert_data_commit_info(&data_commit_info).await?;
}
_ => {}
};
Expand Down

0 comments on commit fde4ae4

Please sign in to comment.