Skip to content

Commit

Permalink
fix: formatting in .rs files
Browse files Browse the repository at this point in the history
  • Loading branch information
hamirmahal committed Dec 15, 2024
1 parent 82d5113 commit 064f167
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 23 deletions.
5 changes: 2 additions & 3 deletions cargo-pgrx/src/command/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,8 @@ fn compute_sql(package_name: &str, manifest: &Manifest) -> eyre::Result<()> {

let command_str = format!("{command:?}");
tracing::debug!(command = %command_str, "Running");
let embed_output = command
.output()
.wrap_err_with(|| format!("failed to spawn pgrx_embed: {command_str}"))?;
let embed_output =
command.output().wrap_err_with(|| format!("failed to spawn pgrx_embed: {command_str}"))?;
tracing::trace!(status_code = %embed_output.status, command = %command_str, "Finished");

if !embed_output.status.success() {
Expand Down
12 changes: 4 additions & 8 deletions pgrx-sql-entity-graph/src/aggregate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,8 @@ impl PgAggregate {

let fn_finalize = get_impl_func_by_name(&item_impl_snapshot, "finalize");
let fn_finalize_name = if let Some(found) = fn_finalize {
let fn_name = Ident::new(
&format!("{snake_case_target_ident}_finalize"),
found.sig.ident.span(),
);
let fn_name =
Ident::new(&format!("{snake_case_target_ident}_finalize"), found.sig.ident.span());
let pg_extern_attr = pg_extern_attr(found);

if !direct_args_with_names.is_empty() {
Expand Down Expand Up @@ -417,10 +415,8 @@ impl PgAggregate {

let fn_deserial = get_impl_func_by_name(&item_impl_snapshot, "deserial");
let fn_deserial_name = if let Some(found) = fn_deserial {
let fn_name = Ident::new(
&format!("{snake_case_target_ident}_deserial"),
found.sig.ident.span(),
);
let fn_name =
Ident::new(&format!("{snake_case_target_ident}_deserial"), found.sig.ident.span());
let pg_extern_attr = pg_extern_attr(found);
pg_externs.push(parse_quote! {
#[allow(non_snake_case, clippy::too_many_arguments)]
Expand Down
3 changes: 1 addition & 2 deletions pgrx-sql-entity-graph/src/extension_sql/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ impl ToSql for ExtensionSqlEntity {
fn to_sql(&self, _context: &PgrxSql) -> eyre::Result<String> {
let ExtensionSqlEntity { file, line, sql, creates, requires, .. } = self;
let creates = if !creates.is_empty() {
let joined =
creates.iter().map(|i| format!("-- {i}")).collect::<Vec<_>>().join("\n");
let joined = creates.iter().map(|i| format!("-- {i}")).collect::<Vec<_>>().join("\n");
format!(
"\
-- creates:\n\
Expand Down
50 changes: 40 additions & 10 deletions pgrx/src/datum/unbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ unsafe impl UnboxDatum for str {
}

unsafe impl UnboxDatum for &str {
type As<'src> = &'src str where Self: 'src;
type As<'src>
= &'src str
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(datum: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -144,7 +147,10 @@ unsafe impl UnboxDatum for CStr {
}

unsafe impl UnboxDatum for &CStr {
type As<'src> = &'src CStr where Self: 'src;
type As<'src>
= &'src CStr
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(datum: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -166,7 +172,10 @@ unsafe impl UnboxDatum for [u8] {
}

unsafe impl UnboxDatum for &[u8] {
type As<'src> = &'src [u8] where Self: 'src;
type As<'src>
= &'src [u8]
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(datum: Datum<'src>) -> Self::As<'src>
where
Expand Down Expand Up @@ -293,7 +302,10 @@ unbox_with_fromdatum! {
}

unsafe impl UnboxDatum for PgHeapTuple<'_, crate::AllocatedByRust> {
type As<'src> = PgHeapTuple<'src, AllocatedByRust> where Self: 'src;
type As<'src>
= PgHeapTuple<'src, AllocatedByRust>
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -304,7 +316,10 @@ unsafe impl UnboxDatum for PgHeapTuple<'_, crate::AllocatedByRust> {
}

unsafe impl<T: FromDatum + UnboxDatum> UnboxDatum for Array<'_, T> {
type As<'src> = Array<'src, T> where Self: 'src;
type As<'src>
= Array<'src, T>
where
Self: 'src;
unsafe fn unbox<'src>(d: Datum<'src>) -> Array<'src, T>
where
Self: 'src,
Expand All @@ -314,7 +329,10 @@ unsafe impl<T: FromDatum + UnboxDatum> UnboxDatum for Array<'_, T> {
}

unsafe impl<T: FromDatum + UnboxDatum> UnboxDatum for VariadicArray<'_, T> {
type As<'src> = VariadicArray<'src, T> where Self: 'src;
type As<'src>
= VariadicArray<'src, T>
where
Self: 'src;
unsafe fn unbox<'src>(d: Datum<'src>) -> VariadicArray<'src, T>
where
Self: 'src,
Expand All @@ -324,7 +342,10 @@ unsafe impl<T: FromDatum + UnboxDatum> UnboxDatum for VariadicArray<'_, T> {
}

unsafe impl<T: FromDatum + UnboxDatum + RangeSubType> UnboxDatum for Range<T> {
type As<'src> = Range<T> where Self: 'src;
type As<'src>
= Range<T>
where
Self: 'src;
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Self: 'src,
Expand All @@ -345,7 +366,10 @@ unsafe impl<const P: u32, const S: u32> UnboxDatum for Numeric<P, S> {
}

unsafe impl<T> UnboxDatum for PgBox<T, AllocatedByPostgres> {
type As<'src> = PgBox<T> where Self: 'src;
type As<'src>
= PgBox<T>
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -356,7 +380,10 @@ unsafe impl<T> UnboxDatum for PgBox<T, AllocatedByPostgres> {
}

unsafe impl UnboxDatum for Json {
type As<'src> = Json where Self: 'src;
type As<'src>
= Json
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -367,7 +394,10 @@ unsafe impl UnboxDatum for Json {
}

unsafe impl UnboxDatum for JsonB {
type As<'src> = JsonB where Self: 'src;
type As<'src>
= JsonB
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Expand Down

0 comments on commit 064f167

Please sign in to comment.