diff --git a/cargo-pgrx/Cargo.toml b/cargo-pgrx/Cargo.toml index 92ddb68aa..9b8fceac7 100644 --- a/cargo-pgrx/Cargo.toml +++ b/cargo-pgrx/Cargo.toml @@ -70,3 +70,6 @@ rustls = [ "ureq/tls", "ureq/native-certs" # induces rustls to use the OS-level root of trust ] + +[lints.clippy] +or-fun-call = "allow" # kinda sus lint imo diff --git a/cargo-pgrx/src/main.rs b/cargo-pgrx/src/main.rs index 338f3df14..81b22542c 100644 --- a/cargo-pgrx/src/main.rs +++ b/cargo-pgrx/src/main.rs @@ -7,9 +7,6 @@ //LICENSE All rights reserved. //LICENSE //LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file. -#![deny(clippy::perf)] // our compile times are awful -#![allow(clippy::or_fun_call)] // often false positives - mod command; mod manifest; mod metadata; diff --git a/pgrx-macros/src/rewriter.rs b/pgrx-macros/src/rewriter.rs index 49561c883..a25b65b2e 100644 --- a/pgrx-macros/src/rewriter.rs +++ b/pgrx-macros/src/rewriter.rs @@ -36,7 +36,7 @@ pub fn item_fn_without_rewrite(mut func: ItemFn) -> syn::Result syn::Result quote! { - #[allow(unused_lifetimes, clippy::extra_unused_lifetimes)] - }, - None => quote! {}, - }; - let arg_list = build_arg_list(&sig, false)?; let func_name = func.sig.ident.clone(); @@ -103,7 +95,6 @@ pub fn item_fn_without_rewrite(mut func: ItemFn) -> syn::Result syn::Result { let original_name = &original.sig.ident; let wrapper_symbol = format_ident!("{}_wrapper", original_name); - let lifetimes = &original.sig.generics; - // the wrapper function declaration may contain lifetimes that are not used, since - // our input type is FunctionCallInfo and our return type is Datum - let unused_lifetimes = match lifetimes.lifetimes().next() { - Some(_) => quote! { - #[allow(unused_lifetimes, clippy::extra_unused_lifetimes)] - }, - None => quote! {}, - }; let tokens = quote_spanned! { original.sig.span() => #[no_mangle] #[doc(hidden)] - #unused_lifetimes - pub unsafe extern "C" fn #wrapper_symbol #lifetimes(#fcinfo: ::pgrx::pg_sys::FunctionCallInfo) -> ::pgrx::pg_sys::Datum { + pub unsafe extern "C" fn #wrapper_symbol(#fcinfo: ::pgrx::pg_sys::FunctionCallInfo) -> ::pgrx::pg_sys::Datum { #contents } }; diff --git a/pgrx-sql-entity-graph/src/lib.rs b/pgrx-sql-entity-graph/src/lib.rs index c18eec922..fcb1f1bb5 100644 --- a/pgrx-sql-entity-graph/src/lib.rs +++ b/pgrx-sql-entity-graph/src/lib.rs @@ -15,8 +15,6 @@ Rust to SQL mapping support. to the `pgrx` framework and very subject to change between versions. While you may use this, please do it with caution. */ -#![allow(clippy::too_many_arguments)] -#![allow(clippy::redundant_pattern_matching)] pub use aggregate::entity::{AggregateTypeEntity, PgAggregateEntity}; pub use aggregate::{ AggregateType, AggregateTypeList, FinalizeModify, ParallelOption, PgAggregate, diff --git a/pgrx-sql-entity-graph/src/pgrx_attribute.rs b/pgrx-sql-entity-graph/src/pgrx_attribute.rs index f838fa08e..5ffd2d6a7 100644 --- a/pgrx-sql-entity-graph/src/pgrx_attribute.rs +++ b/pgrx-sql-entity-graph/src/pgrx_attribute.rs @@ -65,7 +65,7 @@ impl Parse for PgrxArg { #[track_caller] fn parse(input: ParseStream<'_>) -> syn::Result { let path = input.parse::()?; - if let Ok(_) = input.parse::() { + if input.parse::().is_ok() { Ok(Self::NameValue(NameValueArg { path, value: input.parse()? })) } else { Err(input.error("unsupported argument to #[pgrx] in this context")) diff --git a/pgrx-tests/Cargo.toml b/pgrx-tests/Cargo.toml index c77fe3850..405723d68 100644 --- a/pgrx-tests/Cargo.toml +++ b/pgrx-tests/Cargo.toml @@ -76,3 +76,7 @@ version = "=0.12.0-alpha.1" [dev-dependencies] eyre.workspace = true # testing functions that return `eyre::Result` trybuild = "1" + +[lints] +rust.unused-lifetimes = "deny" +clippy.used-underscore-binding = "deny" diff --git a/pgrx-tests/src/tests/pg_guard_tests.rs b/pgrx-tests/src/tests/pg_guard_tests.rs index a1dfe20da..26cd97d10 100644 --- a/pgrx-tests/src/tests/pg_guard_tests.rs +++ b/pgrx-tests/src/tests/pg_guard_tests.rs @@ -34,6 +34,7 @@ extern "C" fn extern_func_impl_1() -> bool { // and [no_mangle] #[pg_guard] #[no_mangle] +#[allow(unused_lifetimes)] extern "C" fn extern_func_impl_2<'a>() -> bool { true } diff --git a/pgrx/Cargo.toml b/pgrx/Cargo.toml index f94420541..fb1ed6603 100644 --- a/pgrx/Cargo.toml +++ b/pgrx/Cargo.toml @@ -66,3 +66,11 @@ seahash = "4.1.0" # derive(PostgresHash) serde.workspace = true # impls on pub types serde_cbor = "0.11.2" # derive(PostgresType) serde_json.workspace = true # everything JSON + +[lints] +clippy.cast_ptr_alignment = "allow" +clippy.len_without_is_empty = "allow" +clippy.missing_safety_doc = "allow" +clippy.too_many_arguments = "allow" +clippy.type_complexity = "allow" +clippy.unnecessary_cast = "allow" diff --git a/pgrx/src/lib.rs b/pgrx/src/lib.rs index 2b0907083..d119697bb 100644 --- a/pgrx/src/lib.rs +++ b/pgrx/src/lib.rs @@ -21,14 +21,6 @@ //! } //! //! ``` -#![allow( - clippy::cast_ptr_alignment, - clippy::len_without_is_empty, - clippy::missing_safety_doc, - clippy::too_many_arguments, - clippy::type_complexity, - clippy::unnecessary_cast -)] #![cfg_attr(feature = "nightly", feature(allocator_api))] #[macro_use]