Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cargo-pgrx/src/command/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl CommandExecute for Info {
}
}

fn version(ver: &str) -> Cow<str> {
fn version(ver: &str) -> Cow<'_, str> {
if ver.starts_with("pg") {
Cow::Borrowed(ver)
} else {
Expand Down
2 changes: 1 addition & 1 deletion cargo-pgrx/src/command/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ fn compute_sql(package_name: &str, manifest: &Manifest) -> eyre::Result<()> {
Ok(())
}

fn parse_object(data: &[u8]) -> object::Result<object::File> {
fn parse_object(data: &[u8]) -> object::Result<object::File<'_>> {
let kind = object::FileKind::parse(data)?;

match kind {
Expand Down
4 changes: 2 additions & 2 deletions pgrx-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ fn impl_postgres_type(ast: DeriveInput) -> syn::Result<proc_macro2::TokenStream>
#[::pgrx::pgrx_macros::pg_extern(immutable,parallel_safe)]
pub fn #funcname_in #generics(input: Option<&::core::ffi::CStr>) -> Option<#name #generics> {
input.map_or_else(|| {
for m in <#name as ::pgrx::inoutfuncs::InOutFuncs>::NULL_ERROR_MESSAGE {
if let Some(m) = <#name as ::pgrx::inoutfuncs::InOutFuncs>::NULL_ERROR_MESSAGE {
::pgrx::pg_sys::error!("{m}");
}
None
Expand All @@ -990,7 +990,7 @@ fn impl_postgres_type(ast: DeriveInput) -> syn::Result<proc_macro2::TokenStream>
#[::pgrx::pgrx_macros::pg_extern(immutable,parallel_safe)]
pub fn #funcname_in #generics(input: Option<&::core::ffi::CStr>) -> Option<::pgrx::datum::PgVarlena<#name #generics>> {
input.map_or_else(|| {
for m in <#name as ::pgrx::inoutfuncs::PgVarlenaInOutFuncs>::NULL_ERROR_MESSAGE {
if let Some(m) = <#name as ::pgrx::inoutfuncs::PgVarlenaInOutFuncs>::NULL_ERROR_MESSAGE {
::pgrx::pg_sys::error!("{m}");
}
None
Expand Down
6 changes: 6 additions & 0 deletions pgrx-pg-sys/src/include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#[cfg(all(feature = "pg13", not(docsrs)))]
pub(crate) mod pg13 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg13.rs"));
}
#[cfg(all(feature = "pg13", docsrs))]
Expand All @@ -13,6 +14,7 @@ pub(crate) mod pg13;
#[cfg(all(feature = "pg14", not(docsrs)))]
pub(crate) mod pg14 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg14.rs"));
}
#[cfg(all(feature = "pg14", docsrs))]
Expand All @@ -21,6 +23,7 @@ pub(crate) mod pg14;
#[cfg(all(feature = "pg15", not(docsrs)))]
pub(crate) mod pg15 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg15.rs"));
}
#[cfg(all(feature = "pg15", docsrs))]
Expand All @@ -29,6 +32,7 @@ pub(crate) mod pg15;
#[cfg(all(feature = "pg16", not(docsrs)))]
pub(crate) mod pg16 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg16.rs"));
}
#[cfg(all(feature = "pg16", docsrs))]
Expand All @@ -37,6 +41,7 @@ pub(crate) mod pg16;
#[cfg(all(feature = "pg17", not(docsrs)))]
pub(crate) mod pg17 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg17.rs"));
}
#[cfg(all(feature = "pg17", docsrs))]
Expand All @@ -45,6 +50,7 @@ pub(crate) mod pg17;
#[cfg(all(feature = "pg18", not(docsrs)))]
pub(crate) mod pg18 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg18.rs"));
}
#[cfg(all(feature = "pg18", docsrs))]
Expand Down
2 changes: 2 additions & 0 deletions pgrx-tests/src/tests/hooks_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//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.
#![allow(deprecated, static_mut_refs)]

#[cfg(any(test, feature = "pg_test"))]
#[pgrx::pg_schema]
mod tests {
Expand Down
4 changes: 3 additions & 1 deletion pgrx-tests/src/tests/trigger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ mod tests {
}

#[pg_trigger]
fn signature_aliased_both(_trigger: AliasedBorrowedPgTrigger) -> AliasedTriggerResult<'_> {
fn signature_aliased_both(
_trigger: AliasedBorrowedPgTrigger<'_>,
) -> AliasedTriggerResult<'_> {
unimplemented!("Only testing signature compiles")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use pgrx::prelude::*;
#[pg_extern]
fn returns_tuple_with_lifetime(
value: &'static str,
) -> TableIterator<(name!(a, &'static str), name!(b, Option<&'static str>))> {
) -> TableIterator<'static, (name!(a, &'static str), name!(b, Option<&'static str>))> {
TableIterator::once((value, Some(value)))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
warning: elided lifetime has a name
--> tests/compile-fail/table-iterators-arent-immortal.rs:6:19
|
6 | ) -> TableIterator<(name!(a, &'static str), name!(b, Option<&'static str>))> {
| ^ this elided lifetime gets resolved as `'static`
|
= note: `#[warn(elided_named_lifetimes)]` on by default
help: consider specifying it explicitly
|
6 | ) -> TableIterator<'static, (name!(a, &'static str), name!(b, Option<&'static str>))> {
| ++++++++

error[E0521]: borrowed data escapes outside of function
--> tests/compile-fail/table-iterators-arent-immortal.rs:6:78
--> tests/compile-fail/table-iterators-arent-immortal.rs:6:87
|
3 | #[pg_extern]
| ------------
| |
| lifetime `'fcx` defined here
| in this procedural macro expansion
...
6 | ) -> TableIterator<(name!(a, &'static str), name!(b, Option<&'static str>))> {
| ______________________________________________________________________________^
6 | ) -> TableIterator<'static, (name!(a, &'static str), name!(b, Option<&'static str>))> {
| _______________________________________________________________________________________^
7 | | TableIterator::once((value, Some(value)))
8 | | }
| | ^
Expand Down
2 changes: 1 addition & 1 deletion pgrx/src/datum/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl<'a> IntoDatum for &'a [u8] {
// and the `dest` was freshly allocated, thus non-overlapping
std::ptr::copy_nonoverlapping(
self.as_ptr(),
addr_of_mut!((*varattrib_4b).va_data).cast::<u8>(),
addr_of_mut!((&mut *varattrib_4b).va_data).cast::<u8>(),
self.len(),
);

Expand Down
2 changes: 1 addition & 1 deletion pgrx/src/fn_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ fn lookup_fn(fname: &str, args: &[&dyn FnCallArg]) -> Result<pg_sys::Oid> {

/// Parses an arbitrary string as if it is a SQL identifier. If it's not, [`FnCallError::InvalidIdentifier`]
/// is returned
fn parse_sql_ident(ident: &str) -> Result<Array<&str>> {
fn parse_sql_ident(ident: &str) -> Result<Array<'_, &str>> {
unsafe {
direct_function_call::<Array<&str>>(
pg_sys::parse_ident,
Expand Down
4 changes: 2 additions & 2 deletions pgrx/src/lwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<T> PgLwLock<T> {
}

/// Obtain a shared lock (which comes with `&T` access)
pub fn share(&self) -> PgLwLockShareGuard<T> {
pub fn share(&self) -> PgLwLockShareGuard<'_, T> {
unsafe {
let shared = self.inner.get().read().as_ref().expect("PgLwLock was not initialized");
pg_sys::LWLockAcquire((*shared).lock_ptr, pg_sys::LWLockMode::LW_SHARED);
Expand All @@ -60,7 +60,7 @@ impl<T> PgLwLock<T> {
}

/// Obtain an exclusive lock (which comes with `&mut T` access)
pub fn exclusive(&self) -> PgLwLockExclusiveGuard<T> {
pub fn exclusive(&self) -> PgLwLockExclusiveGuard<'_, T> {
unsafe {
let shared = self.inner.get().read().as_ref().expect("PgLwLock was not initialized");
pg_sys::LWLockAcquire((*shared).lock_ptr, pg_sys::LWLockMode::LW_EXCLUSIVE);
Expand Down
2 changes: 1 addition & 1 deletion pgrx/src/rel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl PgRelation {
/// // assert that the tuple descriptor has 12 attributes
/// assert_eq!(tupdesc.len(), 12);
/// ```
pub fn tuple_desc(&self) -> PgTupleDesc {
pub fn tuple_desc(&self) -> PgTupleDesc<'_> {
PgTupleDesc::from_relation(self)
}

Expand Down
2 changes: 1 addition & 1 deletion pgrx/src/spi/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl SpiCursor<'_> {
/// Fetch up to `count` rows from the cursor, moving forward
///
/// If `fetch` runs off the end of the available rows, an empty [`SpiTupleTable`] is returned.
pub fn fetch(&mut self, count: libc::c_long) -> SpiResult<SpiTupleTable> {
pub fn fetch(&mut self, count: libc::c_long) -> SpiResult<SpiTupleTable<'_>> {
// SAFETY: no concurrent access
unsafe {
pg_sys::SPI_tuptable = std::ptr::null_mut();
Expand Down
4 changes: 2 additions & 2 deletions pgrx/src/tupdesc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl<'a> PgTupleDesc<'a> {
}

/// wrap the `pg_sys::TupleDesc` contained by the specified `PgRelation`
pub fn from_relation(parent: &PgRelation) -> PgTupleDesc {
pub fn from_relation(parent: &PgRelation) -> PgTupleDesc<'_> {
PgTupleDesc {
// SAFETY: `parent` is a Rust reference, and as such its rd_att attribute will be property initialized
tupdesc: Some(unsafe { PgBox::from_pg(parent.rd_att) }),
Expand Down Expand Up @@ -232,7 +232,7 @@ impl<'a> PgTupleDesc<'a> {
}

/// Iterate over our attributes
pub fn iter(&self) -> TupleDescIterator {
pub fn iter(&self) -> TupleDescIterator<'_> {
TupleDescIterator { tupdesc: self, curr: 0 }
}

Expand Down
Loading