@@ -167,7 +167,7 @@ impl ConfigExtensionExt for SessionConfig {
167167 if key. starts_with ( & prefix) {
168168 found_some = true ;
169169 result. set (
170- & key. trim_start_matches ( & prefix) ,
170+ key. trim_start_matches ( & prefix) ,
171171 v. to_str ( ) . map_err ( |err| {
172172 internal_datafusion_err ! ( "Cannot parse header value: {err}" )
173173 } ) ?,
@@ -236,10 +236,11 @@ mod tests {
236236 fn test_propagation ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
237237 let mut config = SessionConfig :: new ( ) ;
238238
239- let mut opt = CustomExtension :: default ( ) ;
240- opt. foo = "foo" . to_string ( ) ;
241- opt. bar = 1 ;
242- opt. baz = true ;
239+ let opt = CustomExtension {
240+ foo : "" . to_string ( ) ,
241+ bar : 0 ,
242+ baz : false ,
243+ } ;
243244
244245 config. add_distributed_option_extension ( opt) ?;
245246 let metadata = config. get_extension :: < ContextGrpcMetadata > ( ) . unwrap ( ) ;
@@ -283,12 +284,16 @@ mod tests {
283284 fn test_new_extension_overwrites_previous ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
284285 let mut config = SessionConfig :: new ( ) ;
285286
286- let mut opt1 = CustomExtension :: default ( ) ;
287- opt1. foo = "first" . to_string ( ) ;
287+ let opt1 = CustomExtension {
288+ foo : "first" . to_string ( ) ,
289+ ..Default :: default ( )
290+ } ;
288291 config. add_distributed_option_extension ( opt1) ?;
289292
290- let mut opt2 = CustomExtension :: default ( ) ;
291- opt2. bar = 42 ;
293+ let opt2 = CustomExtension {
294+ bar : 42 ,
295+ ..Default :: default ( )
296+ } ;
292297 config. add_distributed_option_extension ( opt2) ?;
293298
294299 let flight_metadata = config. get_extension :: < ContextGrpcMetadata > ( ) . unwrap ( ) ;
@@ -335,13 +340,17 @@ mod tests {
335340 fn test_multiple_extensions_different_prefixes ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
336341 let mut config = SessionConfig :: new ( ) ;
337342
338- let mut custom_opt = CustomExtension :: default ( ) ;
339- custom_opt. foo = "custom_value" . to_string ( ) ;
340- custom_opt. bar = 123 ;
343+ let custom_opt = CustomExtension {
344+ foo : "custom_value" . to_string ( ) ,
345+ bar : 123 ,
346+ ..Default :: default ( )
347+ } ;
341348
342- let mut another_opt = AnotherExtension :: default ( ) ;
343- another_opt. setting1 = "other" . to_string ( ) ;
344- another_opt. setting2 = 456 ;
349+ let another_opt = AnotherExtension {
350+ setting1 : "other" . to_string ( ) ,
351+ setting2 : 456 ,
352+ ..Default :: default ( )
353+ } ;
345354
346355 config. add_distributed_option_extension ( custom_opt) ?;
347356 config. add_distributed_option_extension ( another_opt) ?;
@@ -371,8 +380,8 @@ mod tests {
371380 ) ;
372381
373382 let mut new_config = SessionConfig :: new ( ) ;
374- new_config. retrieve_distributed_option_extension :: < CustomExtension > ( & metadata) ?;
375- new_config. retrieve_distributed_option_extension :: < AnotherExtension > ( & metadata) ?;
383+ new_config. retrieve_distributed_option_extension :: < CustomExtension > ( metadata) ?;
384+ new_config. retrieve_distributed_option_extension :: < AnotherExtension > ( metadata) ?;
376385
377386 let propagated_custom = get_ext :: < CustomExtension > ( & new_config) ;
378387 let propagated_another = get_ext :: < AnotherExtension > ( & new_config) ;
0 commit comments