@@ -17,7 +17,7 @@ use arrow_ipc::reader::StreamReader;
1717use arrow_schema:: DataType ;
1818use comfy_table:: presets:: UTF8_FULL ;
1919use comfy_table:: { Attribute , Cell , Color , ContentArrangement , Table , TableComponent } ;
20- use protocol:: cli:: { function_stream_service_client:: FunctionStreamServiceClient , SqlRequest } ;
20+ use protocol:: cli:: { SqlRequest , function_stream_service_client:: FunctionStreamServiceClient } ;
2121use rustyline:: error:: ReadlineError ;
2222use rustyline:: { Config , DefaultEditor , EditMode } ;
2323use std:: fmt;
@@ -158,17 +158,17 @@ impl Repl {
158158 }
159159
160160 // 3. Strict Data Check: Only proceed if data is explicitly present and non-empty
161- if let Some ( bytes) = response. data {
162- if !bytes. is_empty ( ) {
163- // format_arrow_data returns Ok(Some(Table)) ONLY if row_count > 0
164- match self . format_arrow_data ( & bytes) {
165- Ok ( Some ( table) ) => println ! ( "{}" , table) ,
166- Ok ( None ) => {
167- // Data was present but contained 0 rows (e.g., empty result set)
168- // We print nothing here to keep output clean as requested
169- }
170- Err ( e) => eprintln ! ( "Failed to parse result data: {}" , e) ,
161+ if let Some ( bytes) = response. data
162+ && !bytes. is_empty ( )
163+ {
164+ // format_arrow_data returns Ok(Some(Table)) ONLY if row_count > 0
165+ match self . format_arrow_data ( & bytes) {
166+ Ok ( Some ( table) ) => println ! ( "{}" , table) ,
167+ Ok ( None ) => {
168+ // Data was present but contained 0 rows (e.g., empty result set)
169+ // We print nothing here to keep output clean as requested
171170 }
171+ Err ( e) => eprintln ! ( "Failed to parse result data: {}" , e) ,
172172 }
173173 }
174174
@@ -243,11 +243,7 @@ impl Repl {
243243 }
244244 }
245245
246- if has_rows {
247- Ok ( Some ( table) )
248- } else {
249- Ok ( None )
250- }
246+ if has_rows { Ok ( Some ( table) ) } else { Ok ( None ) }
251247 }
252248
253249 fn extract_value ( & self , column : & dyn Array , row : usize ) -> String {
@@ -317,7 +313,7 @@ impl Repl {
317313
318314 #[ cfg( unix) ]
319315 let mut sigterm = {
320- use tokio:: signal:: unix:: { signal , SignalKind } ;
316+ use tokio:: signal:: unix:: { SignalKind , signal } ;
321317 signal ( SignalKind :: terminate ( ) ) . expect ( "failed to register SIGTERM handler" )
322318 } ;
323319
@@ -403,10 +399,8 @@ impl Repl {
403399 println ! ( ) ;
404400 }
405401
406- if !skip_save_history {
407- if let Some ( ref mut ed) = repl. lock ( ) . await . editor {
408- let _ = ed. save_history ( ".function-stream-cli-history" ) ;
409- }
402+ if !skip_save_history && let Some ( ref mut ed) = repl. lock ( ) . await . editor {
403+ let _ = ed. save_history ( ".function-stream-cli-history" ) ;
410404 }
411405 Ok ( ( ) )
412406 }
@@ -448,10 +442,10 @@ impl Repl {
448442 }
449443
450444 fn add_history_entry ( & mut self , entry : & str ) {
451- if let Some ( ed) = self . editor . as_mut ( ) {
452- if !entry. trim ( ) . is_empty ( ) {
453- let _ = ed . add_history_entry ( entry . trim ( ) ) ;
454- }
445+ if let Some ( ed) = self . editor . as_mut ( )
446+ && !entry. trim ( ) . is_empty ( )
447+ {
448+ let _ = ed . add_history_entry ( entry . trim ( ) ) ;
455449 }
456450 }
457451
0 commit comments