Skip to content

Commit d00c3ef

Browse files
committed
Update function signatures to use named lifetimes
Refactor `cast_options_from_proto` to accept a named lifetime `'a`, allowing both protobuf inputs to borrow with `&'a`. Update the local closure to accept `&'a protobuf::FormatOptions` so that the returned `FormatOptions` borrows are well-scoped, ensuring better memory safety and usability.
1 parent 3c6481a commit d00c3ef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

datafusion/proto/src/physical_plan/from_proto.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,12 @@ fn parse_duration_format(
551551
}
552552
}
553553

554-
fn cast_options_from_proto(
555-
cast_options: Option<&protobuf::PhysicalCastOptions>,
554+
fn cast_options_from_proto<'a>(
555+
cast_options: Option<&'a protobuf::PhysicalCastOptions>,
556556
safe: bool,
557-
format_options: Option<&protobuf::FormatOptions>,
558-
) -> Result<Option<CastOptions<'_>>> {
559-
let parse_format_options = |fo: &protobuf::FormatOptions| {
557+
format_options: Option<&'a protobuf::FormatOptions>,
558+
) -> Result<Option<CastOptions<'a>>> {
559+
let parse_format_options = |fo: &'a protobuf::FormatOptions| {
560560
FormatOptions::new()
561561
.with_null(fo.null.as_str())
562562
.with_date_format(fo.date_format.as_deref())

0 commit comments

Comments
 (0)