From fe9ab69921e04b32a3d1619dff662e0f38549a06 Mon Sep 17 00:00:00 2001 From: Jubilee <46493976+workingjubilee@users.noreply.github.com> Date: Tue, 26 Mar 2024 01:25:15 -0700 Subject: [PATCH] Clean up even more redundant code (#1623) I don't know if I just missed these the first time or the algorithm for finding unused stuff got stronger in the past few nights, but even more repetition whines if you use nightly. --- pgrx-sql-entity-graph/src/pgrx_attribute.rs | 9 ++------- pgrx-tests/src/tests/aggregate_tests.rs | 2 +- pgrx-tests/src/tests/anyarray_tests.rs | 2 +- pgrx-tests/src/tests/array_tests.rs | 2 +- pgrx-tests/src/tests/bgworker_tests.rs | 1 - pgrx-tests/src/tests/fcinfo_tests.rs | 2 +- pgrx-tests/src/tests/postgres_type_tests.rs | 2 +- pgrx-tests/src/tests/struct_type_tests.rs | 1 - 8 files changed, 7 insertions(+), 14 deletions(-) diff --git a/pgrx-sql-entity-graph/src/pgrx_attribute.rs b/pgrx-sql-entity-graph/src/pgrx_attribute.rs index d96767b8a..f838fa08e 100644 --- a/pgrx-sql-entity-graph/src/pgrx_attribute.rs +++ b/pgrx-sql-entity-graph/src/pgrx_attribute.rs @@ -65,12 +65,8 @@ impl Parse for PgrxArg { #[track_caller] fn parse(input: ParseStream<'_>) -> syn::Result { let path = input.parse::()?; - if input.peek(Token![=]) { - Ok(Self::NameValue(NameValueArg { - path, - eq_token: input.parse()?, - value: input.parse()?, - })) + if let Ok(_) = input.parse::() { + Ok(Self::NameValue(NameValueArg { path, value: input.parse()? })) } else { Err(input.error("unsupported argument to #[pgrx] in this context")) } @@ -81,7 +77,6 @@ impl Parse for PgrxArg { #[derive(Debug)] pub struct NameValueArg { pub path: syn::Path, - pub eq_token: syn::token::Eq, pub value: ArgValue, } diff --git a/pgrx-tests/src/tests/aggregate_tests.rs b/pgrx-tests/src/tests/aggregate_tests.rs index 680442969..edd96030e 100644 --- a/pgrx-tests/src/tests/aggregate_tests.rs +++ b/pgrx-tests/src/tests/aggregate_tests.rs @@ -8,7 +8,7 @@ //LICENSE //LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file. use pgrx::prelude::*; -use pgrx::{Aggregate, Internal, ParallelOption}; +use pgrx::Internal; use serde::{Deserialize, Serialize}; use std::collections::HashSet; diff --git a/pgrx-tests/src/tests/anyarray_tests.rs b/pgrx-tests/src/tests/anyarray_tests.rs index a049a84e1..d220fb092 100644 --- a/pgrx-tests/src/tests/anyarray_tests.rs +++ b/pgrx-tests/src/tests/anyarray_tests.rs @@ -8,7 +8,7 @@ //LICENSE //LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file. use pgrx::prelude::*; -use pgrx::{direct_function_call, AnyArray, IntoDatum, Json}; +use pgrx::{direct_function_call, AnyArray, Json}; #[pg_extern] fn anyarray_arg(array: AnyArray) -> Json { diff --git a/pgrx-tests/src/tests/array_tests.rs b/pgrx-tests/src/tests/array_tests.rs index e313a10c2..0d43f754d 100644 --- a/pgrx-tests/src/tests/array_tests.rs +++ b/pgrx-tests/src/tests/array_tests.rs @@ -9,8 +9,8 @@ //LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file. use pgrx::array::RawArray; use pgrx::prelude::*; +use pgrx::Json; use pgrx::PostgresEnum; -use pgrx::{Array, Json}; use serde::Serialize; use serde_json::*; diff --git a/pgrx-tests/src/tests/bgworker_tests.rs b/pgrx-tests/src/tests/bgworker_tests.rs index 4566dc49e..1846bd366 100644 --- a/pgrx-tests/src/tests/bgworker_tests.rs +++ b/pgrx-tests/src/tests/bgworker_tests.rs @@ -8,7 +8,6 @@ //LICENSE //LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file. use pgrx::prelude::*; -use pgrx::{FromDatum, IntoDatum, PgOid}; #[pg_guard] #[no_mangle] diff --git a/pgrx-tests/src/tests/fcinfo_tests.rs b/pgrx-tests/src/tests/fcinfo_tests.rs index 4a8642481..eb07adc31 100644 --- a/pgrx-tests/src/tests/fcinfo_tests.rs +++ b/pgrx-tests/src/tests/fcinfo_tests.rs @@ -8,7 +8,7 @@ //LICENSE //LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file. use pgrx::prelude::*; -use pgrx::{InOutFuncs, StringInfo}; +use pgrx::StringInfo; use serde::{Deserialize, Serialize}; #[pg_extern] diff --git a/pgrx-tests/src/tests/postgres_type_tests.rs b/pgrx-tests/src/tests/postgres_type_tests.rs index 46d25e4c7..9287d1cfb 100644 --- a/pgrx-tests/src/tests/postgres_type_tests.rs +++ b/pgrx-tests/src/tests/postgres_type_tests.rs @@ -9,7 +9,7 @@ //LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file. use core::ffi::CStr; use pgrx::prelude::*; -use pgrx::{InOutFuncs, PgVarlena, PgVarlenaInOutFuncs, StringInfo}; +use pgrx::StringInfo; use serde::{Deserialize, Serialize}; use std::str::FromStr; diff --git a/pgrx-tests/src/tests/struct_type_tests.rs b/pgrx-tests/src/tests/struct_type_tests.rs index cdb5dd106..c54e349c9 100644 --- a/pgrx-tests/src/tests/struct_type_tests.rs +++ b/pgrx-tests/src/tests/struct_type_tests.rs @@ -13,7 +13,6 @@ use pgrx::pgrx_sql_entity_graph::metadata::{ }; use pgrx::prelude::*; use pgrx::stringinfo::StringInfo; -use pgrx::AllocatedByRust; use crate::get_named_capture;