From 9fd18b07412a1655e8740850bf5b4a5f67910a9a Mon Sep 17 00:00:00 2001 From: ad hoc Date: Wed, 15 Nov 2023 12:00:12 +0100 Subject: [PATCH] fmt and clippy --- libsql-server/src/lib.rs | 10 +++------- libsql/src/hrana/hyper.rs | 2 +- libsql/src/local/database.rs | 2 +- libsql/src/replication/client.rs | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libsql-server/src/lib.rs b/libsql-server/src/lib.rs index 1b3cf62ad8..aacc8d16d8 100644 --- a/libsql-server/src/lib.rs +++ b/libsql-server/src/lib.rs @@ -281,17 +281,13 @@ where if let Some(soft_limit_mb) = self.db_config.soft_heap_limit_mb { tracing::warn!("Setting soft heap limit to {soft_limit_mb}MiB"); unsafe { - sqld_libsql_bindings::ffi::sqlite3_soft_heap_limit64( - soft_limit_mb as i64 * 1024 * 1024, - ) + libsql_sys::ffi::sqlite3_soft_heap_limit64(soft_limit_mb as i64 * 1024 * 1024) }; } if let Some(hard_limit_mb) = self.db_config.hard_heap_limit_mb { tracing::warn!("Setting hard heap limit to {hard_limit_mb}MiB"); unsafe { - sqld_libsql_bindings::ffi::sqlite3_hard_heap_limit64( - hard_limit_mb as i64 * 1024 * 1024, - ) + libsql_sys::ffi::sqlite3_hard_heap_limit64(hard_limit_mb as i64 * 1024 * 1024) }; } } @@ -330,7 +326,7 @@ where let heartbeat_auth = config.heartbeat_auth.clone(); let heartbeat_period = config.heartbeat_period; let heartbeat_url = if let Some(url) = &config.heartbeat_url { - Some(Url::from_str(&url).context("invalid heartbeat URL")?) + Some(Url::from_str(url).context("invalid heartbeat URL")?) } else { None }; diff --git a/libsql/src/hrana/hyper.rs b/libsql/src/hrana/hyper.rs index 26b46f176e..ab6fd82823 100644 --- a/libsql/src/hrana/hyper.rs +++ b/libsql/src/hrana/hyper.rs @@ -18,7 +18,7 @@ pub struct HttpSender { impl HttpSender { pub fn new(connector: ConnectorService, version: Option<&str>) -> Self { - let ver = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION")); + let ver = version.unwrap_or(env!("CARGO_PKG_VERSION")); let version = HeaderValue::try_from(format!("libsql-remote-{ver}")).unwrap(); diff --git a/libsql/src/local/database.rs b/libsql/src/local/database.rs index 724917adcb..e2b86ff86d 100644 --- a/libsql/src/local/database.rs +++ b/libsql/src/local/database.rs @@ -104,7 +104,7 @@ impl Database { connector, endpoint.as_str().try_into().unwrap(), auth_token, - version.as_ref().map(String::as_str), + version.as_deref(), ) .unwrap(); let path = PathBuf::from(db_path); diff --git a/libsql/src/replication/client.rs b/libsql/src/replication/client.rs index 1664753886..8a0e76d9c0 100644 --- a/libsql/src/replication/client.rs +++ b/libsql/src/replication/client.rs @@ -48,7 +48,7 @@ impl Client { auth_token: impl AsRef, version: Option<&str>, ) -> anyhow::Result { - let ver = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION")); + let ver = version.unwrap_or(env!("CARGO_PKG_VERSION")); let version: AsciiMetadataValue = format!("libsql-rpc-{ver}") .try_into()