diff --git a/pgrx-macros/src/lib.rs b/pgrx-macros/src/lib.rs index 69d982eab..af14c2b2c 100644 --- a/pgrx-macros/src/lib.rs +++ b/pgrx-macros/src/lib.rs @@ -122,7 +122,7 @@ pub fn pg_test(attr: TokenStream, item: TokenStream) -> TokenStream { let res = pgrx_tests::run_test(#sql_funcname, #expected_error, crate::pg_test::postgresql_conf_options()); match res { Ok(()) => (), - Err(e) => panic!("{:?}", e) + Err(e) => panic!("{e:?}") } } }); @@ -184,12 +184,12 @@ pub fn pg_cast(attr: TokenStream, item: TokenStream) -> TokenStream { { "implicit" => cast = PgCast::Implicit, "assignment" => cast = PgCast::Assignment, - other => panic!("Unrecognized pg_cast option: {}. ", other), + other => panic!("Unrecognized pg_cast option: {other}. "), } } } Err(err) => { - panic!("Failed to parse attribute to pg_cast: {}", err) + panic!("Failed to parse attribute to pg_cast: {err}") } } // `pg_cast` does not support other `pg_extern` attributes for now, pass an empty attribute token stream. @@ -715,7 +715,7 @@ fn impl_postgres_enum(ast: DeriveInput) -> syn::Result let (name, _, _) = ::pgrx::enum_helper::lookup_enum_by_oid(unsafe { ::pgrx::pg_sys::Oid::from_datum(datum, is_null)? } ); match name.as_str() { #from_datum - _ => panic!("invalid enum value: {}", name) + _ => panic!("invalid enum value: {name}") } } } @@ -795,8 +795,8 @@ fn impl_postgres_type(ast: DeriveInput) -> syn::Result let name = &ast.ident; let generics = &ast.generics; let has_lifetimes = generics.lifetimes().next(); - let funcname_in = Ident::new(&format!("{}_in", name).to_lowercase(), name.span()); - let funcname_out = Ident::new(&format!("{}_out", name).to_lowercase(), name.span()); + let funcname_in = Ident::new(&format!("{name}_in").to_lowercase(), name.span()); + let funcname_out = Ident::new(&format!("{name}_out").to_lowercase(), name.span()); let mut args = parse_postgres_type_args(&ast.attrs); let mut stream = proc_macro2::TokenStream::new(); @@ -905,7 +905,7 @@ fn impl_postgres_type(ast: DeriveInput) -> syn::Result pub fn #funcname_in #generics(input: Option<&#lifetime ::core::ffi::CStr>) -> Option<#name #generics> { input.map_or_else(|| { for m in <#name as ::pgrx::inoutfuncs::JsonInOutFuncs>::NULL_ERROR_MESSAGE { - ::pgrx::pg_sys::error!("{}", m); + ::pgrx::pg_sys::error!("{m}"); } None }, |i| Some(<#name as ::pgrx::inoutfuncs::JsonInOutFuncs>::input(i))) @@ -929,7 +929,7 @@ fn impl_postgres_type(ast: DeriveInput) -> syn::Result pub fn #funcname_in #generics(input: Option<&#lifetime ::core::ffi::CStr>) -> Option<#name #generics> { input.map_or_else(|| { for m in <#name as ::pgrx::inoutfuncs::InOutFuncs>::NULL_ERROR_MESSAGE { - ::pgrx::pg_sys::error!("{}", m); + ::pgrx::pg_sys::error!("{m}"); } None }, |i| Some(<#name as ::pgrx::inoutfuncs::InOutFuncs>::input(i))) @@ -952,7 +952,7 @@ fn impl_postgres_type(ast: DeriveInput) -> syn::Result pub fn #funcname_in #generics(input: Option<&#lifetime ::core::ffi::CStr>) -> Option<::pgrx::datum::PgVarlena<#name #generics>> { input.map_or_else(|| { for m in <#name as ::pgrx::inoutfuncs::PgVarlenaInOutFuncs>::NULL_ERROR_MESSAGE { - ::pgrx::pg_sys::error!("{}", m); + ::pgrx::pg_sys::error!("{m}"); } None }, |i| Some(<#name as ::pgrx::inoutfuncs::PgVarlenaInOutFuncs>::input(i))) diff --git a/pgrx-macros/src/operators.rs b/pgrx-macros/src/operators.rs index 9448a10fe..9e128e46f 100644 --- a/pgrx-macros/src/operators.rs +++ b/pgrx-macros/src/operators.rs @@ -91,7 +91,7 @@ pub(crate) fn deriving_postgres_hash(ast: DeriveInput) -> syn::Result proc_macro2::TokenStream { - let pg_name = Ident::new(&format!("{}_eq", name).to_lowercase(), name.span()); + let pg_name = Ident::new(&format!("{name}_eq").to_lowercase(), name.span()); quote! { #[allow(non_snake_case)] #[::pgrx::pgrx_macros::pg_operator(immutable, parallel_safe)] @@ -120,7 +120,7 @@ pub fn derive_pg_eq(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro /// /// See `derive_pg_eq` for the implications of this assumption. pub fn derive_pg_ne(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { - let pg_name = Ident::new(&format!("{}_ne", name).to_lowercase(), name.span()); + let pg_name = Ident::new(&format!("{name}_ne").to_lowercase(), name.span()); quote! { #[allow(non_snake_case)] #[::pgrx::pgrx_macros::pg_operator(immutable, parallel_safe)] @@ -136,7 +136,7 @@ pub fn derive_pg_ne(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro } pub fn derive_pg_lt(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { - let pg_name = Ident::new(&format!("{}_lt", name).to_lowercase(), name.span()); + let pg_name = Ident::new(&format!("{name}_lt").to_lowercase(), name.span()); quote! { #[allow(non_snake_case)] #[::pgrx::pgrx_macros::pg_operator(immutable, parallel_safe)] @@ -153,7 +153,7 @@ pub fn derive_pg_lt(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro } pub fn derive_pg_gt(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { - let pg_name = Ident::new(&format!("{}_gt", name).to_lowercase(), name.span()); + let pg_name = Ident::new(&format!("{name}_gt").to_lowercase(), name.span()); quote! { #[allow(non_snake_case)] #[::pgrx::pgrx_macros::pg_operator(immutable, parallel_safe)] @@ -169,7 +169,7 @@ pub fn derive_pg_gt(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro } pub fn derive_pg_le(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { - let pg_name = Ident::new(&format!("{}_le", name).to_lowercase(), name.span()); + let pg_name = Ident::new(&format!("{name}_le").to_lowercase(), name.span()); quote! { #[allow(non_snake_case)] #[::pgrx::pgrx_macros::pg_operator(immutable, parallel_safe)] @@ -185,7 +185,7 @@ pub fn derive_pg_le(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro } pub fn derive_pg_ge(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { - let pg_name = Ident::new(&format!("{}_ge", name).to_lowercase(), name.span()); + let pg_name = Ident::new(&format!("{name}_ge").to_lowercase(), name.span()); quote! { #[allow(non_snake_case)] #[::pgrx::pgrx_macros::pg_operator(immutable, parallel_safe)] @@ -201,7 +201,7 @@ pub fn derive_pg_ge(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro } pub fn derive_pg_cmp(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { - let pg_name = Ident::new(&format!("{}_cmp", name).to_lowercase(), name.span()); + let pg_name = Ident::new(&format!("{name}_cmp").to_lowercase(), name.span()); quote! { #[allow(non_snake_case)] #[::pgrx::pgrx_macros::pg_extern(immutable, parallel_safe)] @@ -226,7 +226,7 @@ pub fn derive_pg_cmp(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macr /// Postgres is no different: this hashing is for the explicit purpose of equality checks, /// and it also needs to be able to reason from hash equality to actual equality. pub fn derive_pg_hash(name: &Ident, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { - let pg_name = Ident::new(&format!("{}_hash", name).to_lowercase(), name.span()); + let pg_name = Ident::new(&format!("{name}_hash").to_lowercase(), name.span()); quote! { #[allow(non_snake_case)] #[::pgrx::pgrx_macros::pg_extern(immutable, parallel_safe)]