Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide: apply clippy #752

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libsql-replication/src/replicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl<C: ReplicatorClient> Replicator<C> {
/// Helper function to convert rpc frames results to replicator frames
pub fn map_frame_err(f: Result<RpcFrame, Status>) -> Result<Frame, Error> {
let frame = f?;
Ok(Frame::try_from(&*frame.data).map_err(|e| Error::Client(e.into()))?)
Frame::try_from(&*frame.data).map_err(|e| Error::Client(e.into()))
}

#[cfg(test)]
Expand Down
6 changes: 3 additions & 3 deletions libsql-server/src/replication/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async fn compact(
snapshot_dir_path: &Path,
to_compact_path: &Path,
) -> anyhow::Result<()> {
match perform_compaction(&db_path, to_compact_file, log_id).await {
match perform_compaction(db_path, to_compact_file, log_id).await {
Ok((snapshot_name, snapshot_frame_count, size_after)) => {
tracing::info!("snapshot `{snapshot_name}` successfully created");

Expand All @@ -133,7 +133,7 @@ async fn compact(
bail!("failed to register snapshot with snapshot merger: {e}");
}

if let Err(e) = std::fs::remove_file(&to_compact_path) {
if let Err(e) = std::fs::remove_file(to_compact_path) {
bail!("failed to remove old log file `{to_compact_path:?}`: {e}",);
}
}
Expand Down Expand Up @@ -192,7 +192,7 @@ impl LogCompactor {

let (sender, mut receiver) = mpsc::channel::<(LogFile, PathBuf)>(8);
let mut merger = SnapshotMerger::new(db_path, log_id)?;
let snapshot_dir_path = snapshot_dir_path(&db_path);
let snapshot_dir_path = snapshot_dir_path(db_path);

let db_path = db_path.to_path_buf();
// We gather pending snapshots here, so new snapshots don't interfere.
Expand Down
8 changes: 4 additions & 4 deletions libsql-server/tests/cluster/replication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ fn apply_partial_snapshot() {
.unwrap();
let stats = resp.json_value().await.unwrap();
let replication_index = &stats["replication_index"];
if !replication_index.is_null() {
if replication_index.as_i64().unwrap() == primary_replication_index {
break;
}
if !replication_index.is_null()
&& replication_index.as_i64().unwrap() == primary_replication_index
{
break;
}
tokio::time::sleep(Duration::from_millis(1000)).await;
}
Expand Down
5 changes: 1 addition & 4 deletions libsql/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ impl<'de> Deserializer<'de> for RowDeserializer<'de> {
match self.idx.next() {
None => Ok(None),
Some(i) => {
let value = self
.row
.get_value(i as i32)
.map_err(|e| DeError::custom(e))?;
let value = self.row.get_value(i as i32).map_err(DeError::custom)?;
self.value = Some(value);
self.row
.column_name(i as i32)
Expand Down
2 changes: 1 addition & 1 deletion libsql/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct Transaction {
pub(crate) inner: Box<dyn Tx + Send + Sync>,
pub(crate) conn: Connection,
/// An optional action executed whenever a transaction needs to be dropped.
pub(crate) close: Option<Box<dyn FnOnce() -> ()>>,
pub(crate) close: Option<Box<dyn FnOnce()>>,
}

impl Transaction {
Expand Down
Loading