diff --git a/Cargo.lock b/Cargo.lock index 16d594a..7e46b13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -392,18 +392,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstyle", "clap_lex", @@ -2398,9 +2398,9 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustix" -version = "0.38.35" +version = "0.38.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" dependencies = [ "bitflags 2.6.0", "errno", @@ -2575,9 +2575,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -3124,9 +3124,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -3135,9 +3135,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", diff --git a/Cargo.toml b/Cargo.toml index 7d31e9b..88dc100 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ reqwest-retry = "0.6.1" reqwest-tracing = "0.5.3" semver = "1.0.23" serde = "1.0.207" -serde_json = "1.0.124" +serde_json = "1.0.128" sha1 = "0.10.6" sha2 = "0.10.8" sqlx = { version = "0.8.2", default-features = false, features = ["postgres"] } diff --git a/examples/archive_async/src/main.rs b/examples/archive_async/src/main.rs index e5d52c3..50a66dd 100644 --- a/examples/archive_async/src/main.rs +++ b/examples/archive_async/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use postgresql_archive::configuration::theseus; diff --git a/examples/archive_sync/src/main.rs b/examples/archive_sync/src/main.rs index c0fd362..0262a6f 100644 --- a/examples/archive_sync/src/main.rs +++ b/examples/archive_sync/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use postgresql_archive::blocking::{extract, get_archive}; diff --git a/examples/axum_embedded/src/main.rs b/examples/axum_embedded/src/main.rs index f2e7243..2bd834c 100644 --- a/examples/axum_embedded/src/main.rs +++ b/examples/axum_embedded/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use anyhow::Result; diff --git a/examples/diesel_embedded/src/main.rs b/examples/diesel_embedded/src/main.rs index eb600a6..8472dae 100644 --- a/examples/diesel_embedded/src/main.rs +++ b/examples/diesel_embedded/src/main.rs @@ -1,16 +1,16 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] +use crate::models::{NewPost, Post}; use diesel::r2d2::{ConnectionManager, Pool}; -use diesel::PgConnection; +use diesel::{PgConnection, RunQueryDsl, SelectableHelper}; use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness}; use postgresql_embedded::{PostgreSQL, Result, Settings, VersionReq}; + mod models; pub mod schema; -use self::models::*; -use diesel::prelude::*; - const MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/"); #[tokio::main] async fn main() -> Result<()> { @@ -51,6 +51,10 @@ async fn main() -> Result<()> { postgresql.stop().await } +/// Create a new post +/// +/// # Panics +/// if the post cannot be saved pub fn create_post(conn: &mut PgConnection, title: &str, body: &str) -> Post { use crate::schema::posts; diff --git a/examples/download_progress_bar/src/main.rs b/examples/download_progress_bar/src/main.rs index b4dab24..ffa3376 100644 --- a/examples/download_progress_bar/src/main.rs +++ b/examples/download_progress_bar/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use anyhow::Result; diff --git a/examples/embedded_async/src/main.rs b/examples/embedded_async/src/main.rs index 0842b5f..bc675bb 100644 --- a/examples/embedded_async/src/main.rs +++ b/examples/embedded_async/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use postgresql_embedded::{PostgreSQL, Result, Settings, VersionReq}; diff --git a/examples/embedded_sync/src/main.rs b/examples/embedded_sync/src/main.rs index 82505f7..789201e 100644 --- a/examples/embedded_sync/src/main.rs +++ b/examples/embedded_sync/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use postgresql_embedded::blocking::PostgreSQL; diff --git a/examples/portal_corp_extension/src/main.rs b/examples/portal_corp_extension/src/main.rs index 10841d7..237bf4f 100644 --- a/examples/portal_corp_extension/src/main.rs +++ b/examples/portal_corp_extension/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use anyhow::Result; diff --git a/examples/postgres_embedded/src/main.rs b/examples/postgres_embedded/src/main.rs index 1f398df..d5a9ad5 100644 --- a/examples/postgres_embedded/src/main.rs +++ b/examples/postgres_embedded/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use anyhow::Result; diff --git a/examples/sqlx_embedded/src/main.rs b/examples/sqlx_embedded/src/main.rs index 06ef8f7..32e2334 100644 --- a/examples/sqlx_embedded/src/main.rs +++ b/examples/sqlx_embedded/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use anyhow::Result; diff --git a/examples/tensor_chord_extension/src/main.rs b/examples/tensor_chord_extension/src/main.rs index bc8d34b..a4054d9 100644 --- a/examples/tensor_chord_extension/src/main.rs +++ b/examples/tensor_chord_extension/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use anyhow::Result; diff --git a/examples/zonky/src/main.rs b/examples/zonky/src/main.rs index 0c07841..5a32ae2 100644 --- a/examples/zonky/src/main.rs +++ b/examples/zonky/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] use postgresql_archive::configuration::zonky; diff --git a/postgresql_archive/src/archive.rs b/postgresql_archive/src/archive.rs index 946dcb9..ac3f631 100644 --- a/postgresql_archive/src/archive.rs +++ b/postgresql_archive/src/archive.rs @@ -40,7 +40,6 @@ pub async fn get_archive(url: &str, version_req: &VersionReq) -> Result<(Version /// /// # Errors /// Returns an error if the extraction fails. -#[allow(clippy::cast_precision_loss)] #[instrument(skip(bytes))] pub async fn extract(url: &str, bytes: &Vec, out_dir: &Path) -> Result> { let extractor_fn = extractor::registry::get(url)?; diff --git a/postgresql_archive/src/blocking/archive.rs b/postgresql_archive/src/blocking/archive.rs index 53a5b2c..214a969 100644 --- a/postgresql_archive/src/blocking/archive.rs +++ b/postgresql_archive/src/blocking/archive.rs @@ -17,7 +17,9 @@ pub fn get_version(url: &str, version_req: &VersionReq) -> crate::Result, extract_directories: ExtractDirectories) -> Result> { let out_dir = extract_directories.get_path(".")?; diff --git a/postgresql_archive/src/configuration/theseus/matcher.rs b/postgresql_archive/src/configuration/theseus/matcher.rs index 6a5b89a..f4e7f73 100644 --- a/postgresql_archive/src/configuration/theseus/matcher.rs +++ b/postgresql_archive/src/configuration/theseus/matcher.rs @@ -4,7 +4,6 @@ use semver::Version; /// /// # Errors /// * If the asset matcher fails. -#[allow(clippy::unnecessary_wraps)] pub fn matcher(_url: &str, name: &str, version: &Version) -> crate::Result { let target = target_triple::TARGET; let expected_name = format!("postgresql-{version}-{target}.tar.gz"); diff --git a/postgresql_archive/src/configuration/zonky/extractor.rs b/postgresql_archive/src/configuration/zonky/extractor.rs index bd24fe0..c08cb27 100644 --- a/postgresql_archive/src/configuration/zonky/extractor.rs +++ b/postgresql_archive/src/configuration/zonky/extractor.rs @@ -14,8 +14,7 @@ use zip::ZipArchive; /// /// # Errors /// Returns an error if the extraction fails. -#[allow(clippy::case_sensitive_file_extension_comparisons)] -#[allow(clippy::cast_precision_loss)] +#[expect(clippy::case_sensitive_file_extension_comparisons)] #[instrument(skip(bytes))] pub fn extract(bytes: &Vec, extract_directories: ExtractDirectories) -> Result> { let out_dir = extract_directories.get_path(".")?; diff --git a/postgresql_archive/src/configuration/zonky/matcher.rs b/postgresql_archive/src/configuration/zonky/matcher.rs index 7e38c28..ba8c512 100644 --- a/postgresql_archive/src/configuration/zonky/matcher.rs +++ b/postgresql_archive/src/configuration/zonky/matcher.rs @@ -6,7 +6,6 @@ use std::env; /// /// # Errors /// * If the asset matcher fails. -#[allow(clippy::unnecessary_wraps)] pub fn matcher(_url: &str, name: &str, version: &Version) -> Result { let os = get_os(); let arch = get_arch(); diff --git a/postgresql_archive/src/configuration/zonky/repository.rs b/postgresql_archive/src/configuration/zonky/repository.rs index b7208f1..8a0bf7c 100644 --- a/postgresql_archive/src/configuration/zonky/repository.rs +++ b/postgresql_archive/src/configuration/zonky/repository.rs @@ -24,7 +24,7 @@ impl Zonky { /// /// # Errors /// * If the URL is invalid. - #[allow(clippy::new_ret_no_self)] + #[expect(clippy::new_ret_no_self)] pub fn new(_url: &str) -> Result> { let os = get_os(); let arch = get_arch(); @@ -48,7 +48,6 @@ impl Repository for Zonky { } #[instrument] - #[allow(clippy::cast_precision_loss)] async fn get_archive(&self, version_req: &VersionReq) -> Result { self.maven.get_archive(version_req).await } diff --git a/postgresql_archive/src/extractor/registry.rs b/postgresql_archive/src/extractor/registry.rs index 06ca8c8..46b2e16 100644 --- a/postgresql_archive/src/extractor/registry.rs +++ b/postgresql_archive/src/extractor/registry.rs @@ -15,7 +15,7 @@ type SupportsFn = fn(&str) -> Result; type ExtractFn = fn(&Vec, ExtractDirectories) -> Result>; /// Singleton struct to store extractors -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] struct RepositoryRegistry { extractors: Vec<(Arc>, Arc>)>, } @@ -63,7 +63,6 @@ impl RepositoryRegistry { impl Default for RepositoryRegistry { /// Creates a new repository registry with the default repositories registered. fn default() -> Self { - #[allow(unused_mut)] let mut registry = Self::new(); #[cfg(feature = "theseus")] registry.register(|url| Ok(url.starts_with(theseus::URL)), theseus::extract); @@ -77,7 +76,6 @@ impl Default for RepositoryRegistry { /// /// # Errors /// * If the registry is poisoned. -#[allow(dead_code)] pub fn register(supports_fn: SupportsFn, extractor_fn: ExtractFn) -> Result<()> { let mut registry = REGISTRY .lock() diff --git a/postgresql_archive/src/extractor/tar_gz_extractor.rs b/postgresql_archive/src/extractor/tar_gz_extractor.rs index bca6a92..be96e32 100644 --- a/postgresql_archive/src/extractor/tar_gz_extractor.rs +++ b/postgresql_archive/src/extractor/tar_gz_extractor.rs @@ -14,7 +14,7 @@ use tracing::{debug, instrument, warn}; /// /// # Errors /// Returns an error if the extraction fails. -#[allow(clippy::cast_precision_loss)] +#[expect(clippy::cast_precision_loss)] #[instrument(skip(bytes))] pub fn extract(bytes: &Vec, extract_directories: ExtractDirectories) -> Result> { let mut files = Vec::new(); diff --git a/postgresql_archive/src/extractor/tar_xz_extractor.rs b/postgresql_archive/src/extractor/tar_xz_extractor.rs index df2aae5..98caef4 100644 --- a/postgresql_archive/src/extractor/tar_xz_extractor.rs +++ b/postgresql_archive/src/extractor/tar_xz_extractor.rs @@ -14,7 +14,7 @@ use tracing::{debug, instrument, warn}; /// /// # Errors /// Returns an error if the extraction fails. -#[allow(clippy::cast_precision_loss)] +#[expect(clippy::cast_precision_loss)] #[instrument(skip(bytes))] pub fn extract(bytes: &Vec, extract_directories: ExtractDirectories) -> Result> { let mut files = Vec::new(); diff --git a/postgresql_archive/src/extractor/zip_extractor.rs b/postgresql_archive/src/extractor/zip_extractor.rs index a57285f..97a8946 100644 --- a/postgresql_archive/src/extractor/zip_extractor.rs +++ b/postgresql_archive/src/extractor/zip_extractor.rs @@ -13,7 +13,7 @@ use zip::ZipArchive; /// /// # Errors /// Returns an error if the extraction fails. -#[allow(clippy::cast_precision_loss)] +#[expect(clippy::cast_precision_loss)] #[instrument(skip(bytes))] pub fn extract(bytes: &Vec, extract_directories: ExtractDirectories) -> Result> { let mut files = Vec::new(); diff --git a/postgresql_archive/src/hasher/registry.rs b/postgresql_archive/src/hasher/registry.rs index ac7e2c9..9c74340 100644 --- a/postgresql_archive/src/hasher/registry.rs +++ b/postgresql_archive/src/hasher/registry.rs @@ -6,7 +6,6 @@ use crate::hasher::md5; use crate::hasher::sha1; #[cfg(feature = "sha2")] use crate::hasher::sha2_256; -#[allow(unused_imports)] #[cfg(feature = "sha2")] use crate::hasher::sha2_512; #[cfg(feature = "maven")] @@ -22,7 +21,7 @@ pub type SupportsFn = fn(&str, &str) -> Result; pub type HasherFn = fn(&Vec) -> Result; /// Singleton struct to store hashers -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] struct HasherRegistry { hashers: Vec<(Arc>, Arc>)>, } @@ -73,7 +72,6 @@ impl HasherRegistry { impl Default for HasherRegistry { /// Creates a new hasher registry with the default hashers registered. fn default() -> Self { - #[allow(unused_mut)] let mut registry = Self::new(); #[cfg(feature = "theseus")] registry.register( @@ -110,7 +108,6 @@ impl Default for HasherRegistry { /// /// # Errors /// * If the registry is poisoned. -#[allow(dead_code)] pub fn register(supports_fn: SupportsFn, hasher_fn: HasherFn) -> Result<()> { let mut registry = REGISTRY .lock() diff --git a/postgresql_archive/src/lib.rs b/postgresql_archive/src/lib.rs index 0a30386..835152d 100644 --- a/postgresql_archive/src/lib.rs +++ b/postgresql_archive/src/lib.rs @@ -110,6 +110,7 @@ //! PostgreSQL is covered under [The PostgreSQL License](https://opensource.org/licenses/postgresql). #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] #![allow(clippy::doc_markdown)] #![allow(clippy::module_name_repetitions)] diff --git a/postgresql_archive/src/matcher/registry.rs b/postgresql_archive/src/matcher/registry.rs index e695a94..e413a7a 100644 --- a/postgresql_archive/src/matcher/registry.rs +++ b/postgresql_archive/src/matcher/registry.rs @@ -14,7 +14,7 @@ pub type SupportsFn = fn(&str) -> Result; pub type MatcherFn = fn(&str, &str, &Version) -> Result; /// Singleton struct to store matchers -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] struct MatchersRegistry { matchers: Vec<(Arc>, Arc>)>, } @@ -64,7 +64,6 @@ impl MatchersRegistry { impl Default for MatchersRegistry { /// Creates a new matcher registry with the default matchers registered. fn default() -> Self { - #[allow(unused_mut)] let mut registry = Self::new(); #[cfg(feature = "theseus")] registry.register(|url| Ok(url == theseus::URL), theseus::matcher); @@ -79,7 +78,6 @@ impl Default for MatchersRegistry { /// /// # Errors /// * If the registry is poisoned. -#[allow(dead_code)] pub fn register(supports_fn: SupportsFn, matcher_fn: MatcherFn) -> Result<()> { let mut registry = REGISTRY .lock() diff --git a/postgresql_archive/src/repository/github/repository.rs b/postgresql_archive/src/repository/github/repository.rs index 96c7d0d..6c0ce75 100644 --- a/postgresql_archive/src/repository/github/repository.rs +++ b/postgresql_archive/src/repository/github/repository.rs @@ -62,7 +62,7 @@ impl GitHub { /// /// # Errors /// * If the URL is invalid. - #[allow(clippy::new_ret_no_self)] + #[expect(clippy::new_ret_no_self)] pub fn new(url: &str) -> Result> { let parsed_url = Url::parse(url)?; let path = parsed_url.path().trim_start_matches('/'); @@ -216,7 +216,7 @@ impl Repository for GitHub { } #[instrument] - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] async fn get_archive(&self, version_req: &VersionReq) -> Result { let release = self.get_release(version_req).await?; let version = Self::get_version_from_tag_name(release.tag_name.as_str())?; @@ -283,7 +283,7 @@ impl Repository for GitHub { struct GithubMiddleware; impl GithubMiddleware { - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] fn add_headers(request: &mut Request) -> Result<()> { let headers = request.headers_mut(); headers.append( diff --git a/postgresql_archive/src/repository/maven/repository.rs b/postgresql_archive/src/repository/maven/repository.rs index c2e43dd..810d27a 100644 --- a/postgresql_archive/src/repository/maven/repository.rs +++ b/postgresql_archive/src/repository/maven/repository.rs @@ -42,7 +42,7 @@ impl Maven { /// /// # Errors /// * If the URL is invalid. - #[allow(clippy::new_ret_no_self)] + #[expect(clippy::new_ret_no_self)] pub fn new(url: &str) -> Result> { Ok(Box::new(Self { url: url.to_string(), @@ -103,7 +103,7 @@ impl Repository for Maven { } #[instrument] - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] async fn get_archive(&self, version_req: &VersionReq) -> Result { let (artifact, version) = self.get_artifact(version_req).await?; let archive_name = format!("{artifact}-{version}.jar"); @@ -166,7 +166,7 @@ impl Repository for Maven { struct MavenMiddleware; impl MavenMiddleware { - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] fn add_headers(request: &mut Request) -> Result<()> { let headers = request.headers_mut(); headers.append(header::USER_AGENT, USER_AGENT.parse().unwrap()); diff --git a/postgresql_archive/src/repository/registry.rs b/postgresql_archive/src/repository/registry.rs index e679143..aab1473 100644 --- a/postgresql_archive/src/repository/registry.rs +++ b/postgresql_archive/src/repository/registry.rs @@ -16,7 +16,7 @@ type SupportsFn = fn(&str) -> Result; type NewFn = dyn Fn(&str) -> Result> + Send + Sync; /// Singleton struct to store repositories -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] struct RepositoryRegistry { repositories: Vec<(Arc>, Arc>)>, } @@ -64,7 +64,6 @@ impl RepositoryRegistry { impl Default for RepositoryRegistry { /// Creates a new repository registry with the default repositories registered. fn default() -> Self { - #[allow(unused_mut)] let mut registry = Self::new(); #[cfg(feature = "theseus")] registry.register( @@ -84,7 +83,6 @@ impl Default for RepositoryRegistry { /// /// # Errors /// * If the registry is poisoned. -#[allow(dead_code)] pub fn register(supports_fn: SupportsFn, new_fn: Box) -> Result<()> { let mut registry = REGISTRY .lock() @@ -116,8 +114,8 @@ mod tests { struct TestRepository; impl TestRepository { - #[allow(clippy::new_ret_no_self)] - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::new_ret_no_self)] + #[expect(clippy::unnecessary_wraps)] fn new(_url: &str) -> Result> { Ok(Box::new(Self)) } diff --git a/postgresql_archive/tests/blocking.rs b/postgresql_archive/tests/blocking.rs index 7946c7b..ed7a4f1 100644 --- a/postgresql_archive/tests/blocking.rs +++ b/postgresql_archive/tests/blocking.rs @@ -21,7 +21,6 @@ fn test_get_version() -> anyhow::Result<()> { #[cfg(feature = "blocking")] #[test] -#[allow(deprecated)] fn test_get_archive_and_extract() -> anyhow::Result<()> { let url = theseus::URL; let version_req = &VersionReq::parse("=16.4.0")?; diff --git a/postgresql_commands/src/initdb.rs b/postgresql_commands/src/initdb.rs index a1b2070..ea8835d 100644 --- a/postgresql_commands/src/initdb.rs +++ b/postgresql_commands/src/initdb.rs @@ -325,7 +325,7 @@ impl CommandBuilder for InitDbBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/lib.rs b/postgresql_commands/src/lib.rs index 16ee2a2..3405f6f 100644 --- a/postgresql_commands/src/lib.rs +++ b/postgresql_commands/src/lib.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] #![deny(clippy::unwrap_used)] #![allow(async_fn_in_trait)] diff --git a/postgresql_commands/src/pg_amcheck.rs b/postgresql_commands/src/pg_amcheck.rs index 5d73a34..997244f 100644 --- a/postgresql_commands/src/pg_amcheck.rs +++ b/postgresql_commands/src/pg_amcheck.rs @@ -336,7 +336,7 @@ impl CommandBuilder for PgAmCheckBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/pg_basebackup.rs b/postgresql_commands/src/pg_basebackup.rs index b33b759..cf50699 100644 --- a/postgresql_commands/src/pg_basebackup.rs +++ b/postgresql_commands/src/pg_basebackup.rs @@ -320,7 +320,7 @@ impl CommandBuilder for PgBaseBackupBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/pg_dump.rs b/postgresql_commands/src/pg_dump.rs index a8bfce5..3d403f1 100644 --- a/postgresql_commands/src/pg_dump.rs +++ b/postgresql_commands/src/pg_dump.rs @@ -540,7 +540,7 @@ impl CommandBuilder for PgDumpBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/pg_dumpall.rs b/postgresql_commands/src/pg_dumpall.rs index 40834cd..613d31a 100644 --- a/postgresql_commands/src/pg_dumpall.rs +++ b/postgresql_commands/src/pg_dumpall.rs @@ -424,7 +424,7 @@ impl CommandBuilder for PgDumpAllBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/pg_restore.rs b/postgresql_commands/src/pg_restore.rs index 6b40423..8170f5b 100644 --- a/postgresql_commands/src/pg_restore.rs +++ b/postgresql_commands/src/pg_restore.rs @@ -400,7 +400,7 @@ impl CommandBuilder for PgRestoreBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/pgbench.rs b/postgresql_commands/src/pgbench.rs index 2428536..6a639f6 100644 --- a/postgresql_commands/src/pgbench.rs +++ b/postgresql_commands/src/pgbench.rs @@ -415,7 +415,7 @@ impl CommandBuilder for PgBenchBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/postgres.rs b/postgresql_commands/src/postgres.rs index f82d478..e6476a3 100644 --- a/postgresql_commands/src/postgres.rs +++ b/postgresql_commands/src/postgres.rs @@ -293,7 +293,7 @@ impl CommandBuilder for PostgresBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/psql.rs b/postgresql_commands/src/psql.rs index 5ace0fa..6e3d0fb 100644 --- a/postgresql_commands/src/psql.rs +++ b/postgresql_commands/src/psql.rs @@ -338,7 +338,7 @@ impl CommandBuilder for PsqlBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_commands/src/vacuumdb.rs b/postgresql_commands/src/vacuumdb.rs index d4f2cba..523465e 100644 --- a/postgresql_commands/src/vacuumdb.rs +++ b/postgresql_commands/src/vacuumdb.rs @@ -321,7 +321,7 @@ impl CommandBuilder for VacuumDbBuilder { } /// Get the arguments for the command - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn get_args(&self) -> Vec { let mut args: Vec = Vec::new(); diff --git a/postgresql_embedded/src/lib.rs b/postgresql_embedded/src/lib.rs index e537eda..b0ba030 100644 --- a/postgresql_embedded/src/lib.rs +++ b/postgresql_embedded/src/lib.rs @@ -113,6 +113,7 @@ //! PostgreSQL is covered under [The PostgreSQL License](https://opensource.org/licenses/postgresql). #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] #![allow(dead_code)] #![allow(clippy::doc_markdown)] diff --git a/postgresql_embedded/src/settings.rs b/postgresql_embedded/src/settings.rs index 9272c0e..c1529b1 100644 --- a/postgresql_embedded/src/settings.rs +++ b/postgresql_embedded/src/settings.rs @@ -15,7 +15,7 @@ use std::time::Duration; use url::Url; #[cfg(feature = "bundled")] -#[allow(clippy::unwrap_used)] +#[expect(clippy::unwrap_used)] pub(crate) static ARCHIVE_VERSION: LazyLock = LazyLock::new(|| { let version_string = include_str!(concat!(std::env!("OUT_DIR"), "/postgresql.version")); let version_req = VersionReq::from_str(&format!("={version_string}")).unwrap(); @@ -135,7 +135,6 @@ impl Settings { /// # Errors /// /// Returns an error if the URL is invalid. - #[allow(irrefutable_let_patterns)] pub fn from_url>(url: S) -> Result { let parsed_url = match Url::parse(url.as_ref()) { Ok(parsed_url) => parsed_url, diff --git a/postgresql_extensions/src/extensions.rs b/postgresql_extensions/src/extensions.rs index aef13af..e911c78 100644 --- a/postgresql_extensions/src/extensions.rs +++ b/postgresql_extensions/src/extensions.rs @@ -143,7 +143,6 @@ async fn get_configuration_file(settings: &dyn Settings) -> Result { /// /// # Errors /// * If an error occurs while getting the library path. -#[allow(dead_code)] async fn get_library_path(settings: &dyn Settings) -> Result { let command = PgConfigBuilder::from(settings).libdir(); match execute_command(command).await { @@ -192,7 +191,6 @@ async fn get_shared_path(settings: &dyn Settings) -> Result { /// /// # Errors /// * If an error occurs while getting the extension path. -#[allow(dead_code)] async fn get_extension_path(settings: &dyn Settings) -> Result { let shared_path = get_shared_path(settings).await?; let extension_path = shared_path.join("extension"); @@ -203,7 +201,6 @@ async fn get_extension_path(settings: &dyn Settings) -> Result { /// /// # Errors /// * If an error occurs while getting the PostgreSQL version. -#[allow(dead_code)] async fn get_postgresql_version(settings: &dyn Settings) -> Result { let command = PostgresBuilder::new() .program_dir(settings.get_binary_dir()) diff --git a/postgresql_extensions/src/lib.rs b/postgresql_extensions/src/lib.rs index 4561a5f..e4a5576 100644 --- a/postgresql_extensions/src/lib.rs +++ b/postgresql_extensions/src/lib.rs @@ -83,6 +83,7 @@ //! additional terms or conditions. #![forbid(unsafe_code)] +#![forbid(clippy::allow_attributes)] #![deny(clippy::pedantic)] #![allow(clippy::doc_markdown)] #![allow(clippy::module_name_repetitions)] diff --git a/postgresql_extensions/src/matcher.rs b/postgresql_extensions/src/matcher.rs index 3762190..161f11c 100644 --- a/postgresql_extensions/src/matcher.rs +++ b/postgresql_extensions/src/matcher.rs @@ -10,7 +10,6 @@ use url::Url; /// /// # Errors /// * If the asset matcher fails. -#[allow(clippy::case_sensitive_file_extension_comparisons)] pub fn tar_gz_matcher(url: &str, name: &str, version: &Version) -> Result { if !matcher(url, name, version)? { return Ok(false); @@ -24,7 +23,7 @@ pub fn tar_gz_matcher(url: &str, name: &str, version: &Version) -> Result /// /// # Errors /// * If the asset matcher fails. -#[allow(clippy::case_sensitive_file_extension_comparisons)] +#[expect(clippy::case_sensitive_file_extension_comparisons)] pub fn zip_matcher(url: &str, name: &str, version: &Version) -> Result { if !matcher(url, name, version)? { return Ok(false); diff --git a/postgresql_extensions/src/repository/portal_corp/repository.rs b/postgresql_extensions/src/repository/portal_corp/repository.rs index 0cc402d..51fded0 100644 --- a/postgresql_extensions/src/repository/portal_corp/repository.rs +++ b/postgresql_extensions/src/repository/portal_corp/repository.rs @@ -21,7 +21,7 @@ impl PortalCorp { /// /// # Errors /// * If the repository cannot be created - #[allow(clippy::new_ret_no_self)] + #[expect(clippy::new_ret_no_self)] pub fn new() -> Result> { Ok(Box::new(Self)) } @@ -69,7 +69,6 @@ impl Repository for PortalCorp { Ok(archive) } - #[allow(clippy::case_sensitive_file_extension_comparisons)] async fn install( &self, _name: &str, diff --git a/postgresql_extensions/src/repository/registry.rs b/postgresql_extensions/src/repository/registry.rs index a8c6c14..bca471f 100644 --- a/postgresql_extensions/src/repository/registry.rs +++ b/postgresql_extensions/src/repository/registry.rs @@ -16,7 +16,6 @@ static REGISTRY: LazyLock>> = type NewFn = dyn Fn() -> Result> + Send + Sync; /// Singleton struct to store repositories -#[allow(clippy::type_complexity)] struct RepositoryRegistry { repositories: HashMap>>, } @@ -79,7 +78,6 @@ impl Default for RepositoryRegistry { /// /// # Errors /// * If the registry is poisoned. -#[allow(dead_code)] pub fn register(namespace: &str, new_fn: Box) -> Result<()> { let mut registry = REGISTRY .lock() @@ -135,8 +133,8 @@ mod tests { struct TestRepository; impl TestRepository { - #[allow(clippy::new_ret_no_self)] - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::new_ret_no_self)] + #[expect(clippy::unnecessary_wraps)] fn new() -> Result> { Ok(Box::new(Self)) } diff --git a/postgresql_extensions/src/repository/steampipe/extensions.rs b/postgresql_extensions/src/repository/steampipe/extensions.rs index 357da93..260278a 100644 --- a/postgresql_extensions/src/repository/steampipe/extensions.rs +++ b/postgresql_extensions/src/repository/steampipe/extensions.rs @@ -2,7 +2,7 @@ use std::sync::LazyLock; static EXTENSIONS: LazyLock> = LazyLock::new(init_extensions); -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] fn init_extensions() -> Vec { vec![ SteampipeExtension::new("abuseipdb", "Steampipe plugin to query IP address abuse data and more from AbuseIPDB.", "https://github.com/turbot/steampipe-plugin-abuseipdb"), @@ -152,7 +152,6 @@ fn init_extensions() -> Vec { } #[derive(Debug)] -#[allow(dead_code)] pub struct SteampipeExtension { pub name: String, pub description: String, diff --git a/postgresql_extensions/src/repository/steampipe/repository.rs b/postgresql_extensions/src/repository/steampipe/repository.rs index 5ab39eb..62c9894 100644 --- a/postgresql_extensions/src/repository/steampipe/repository.rs +++ b/postgresql_extensions/src/repository/steampipe/repository.rs @@ -22,7 +22,7 @@ impl Steampipe { /// /// # Errors /// * If the repository cannot be created - #[allow(clippy::new_ret_no_self)] + #[expect(clippy::new_ret_no_self)] pub fn new() -> Result> { Ok(Box::new(Self)) } @@ -82,7 +82,6 @@ impl Repository for Steampipe { Ok(archive) } - #[allow(clippy::case_sensitive_file_extension_comparisons)] async fn install( &self, _name: &str, diff --git a/postgresql_extensions/src/repository/tensor_chord/repository.rs b/postgresql_extensions/src/repository/tensor_chord/repository.rs index 2b7d2ab..9281727 100644 --- a/postgresql_extensions/src/repository/tensor_chord/repository.rs +++ b/postgresql_extensions/src/repository/tensor_chord/repository.rs @@ -21,7 +21,7 @@ impl TensorChord { /// /// # Errors /// * If the repository cannot be created - #[allow(clippy::new_ret_no_self)] + #[expect(clippy::new_ret_no_self)] pub fn new() -> Result> { Ok(Box::new(Self)) } @@ -69,7 +69,6 @@ impl Repository for TensorChord { Ok(archive) } - #[allow(clippy::case_sensitive_file_extension_comparisons)] async fn install( &self, _name: &str, diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..bbf217f --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.81.0" +profile = "default"