@@ -288,7 +288,10 @@ fn load_legacy_ui_state_from_conn(conn: &Connection) -> Result<WorkbenchUiState,
288288 parse_json ( & payload)
289289}
290290
291- fn save_legacy_ui_state_to_conn ( conn : & Connection , ui_state : & WorkbenchUiState ) -> Result < ( ) , String > {
291+ fn save_legacy_ui_state_to_conn (
292+ conn : & Connection ,
293+ ui_state : & WorkbenchUiState ,
294+ ) -> Result < ( ) , String > {
292295 let payload = json_string ( ui_state) ?;
293296 conn. execute (
294297 "INSERT INTO app_ui_state (id, payload, updated_at)
@@ -332,7 +335,8 @@ fn load_device_ui_state_from_conn(
332335 match payload {
333336 Ok ( value) => parse_json ( & value) ,
334337 Err ( rusqlite:: Error :: QueryReturnedNoRows ) => {
335- let legacy = load_legacy_ui_state_from_conn ( conn) . unwrap_or_else ( |_| default_ui_state ( ) ) ;
338+ let legacy =
339+ load_legacy_ui_state_from_conn ( conn) . unwrap_or_else ( |_| default_ui_state ( ) ) ;
336340 Ok ( DeviceWorkbenchUiState {
337341 open_workspace_ids : legacy. open_workspace_ids ,
338342 layout : legacy. layout ,
@@ -391,7 +395,8 @@ fn load_client_ui_state_from_conn(
391395 match payload {
392396 Ok ( value) => parse_json ( & value) ,
393397 Err ( rusqlite:: Error :: QueryReturnedNoRows ) => {
394- let legacy = load_legacy_ui_state_from_conn ( conn) . unwrap_or_else ( |_| default_ui_state ( ) ) ;
398+ let legacy =
399+ load_legacy_ui_state_from_conn ( conn) . unwrap_or_else ( |_| default_ui_state ( ) ) ;
395400 Ok ( ClientWorkbenchUiState {
396401 active_workspace_id : legacy. active_workspace_id ,
397402 } )
@@ -436,15 +441,16 @@ fn compose_workbench_ui_state(
436441 mut device_state : DeviceWorkbenchUiState ,
437442 mut client_state : ClientWorkbenchUiState ,
438443) -> WorkbenchUiState {
439- device_state. open_workspace_ids = device_state
440- . open_workspace_ids
441- . into_iter ( )
442- . fold ( Vec :: new ( ) , |mut items, workspace_id| {
443- if !items. iter ( ) . any ( |item| item == & workspace_id) {
444- items. push ( workspace_id) ;
445- }
446- items
447- } ) ;
444+ device_state. open_workspace_ids =
445+ device_state
446+ . open_workspace_ids
447+ . into_iter ( )
448+ . fold ( Vec :: new ( ) , |mut items, workspace_id| {
449+ if !items. iter ( ) . any ( |item| item == & workspace_id) {
450+ items. push ( workspace_id) ;
451+ }
452+ items
453+ } ) ;
448454 if let Some ( active) = client_state. active_workspace_id . as_deref ( ) {
449455 if !device_state
450456 . open_workspace_ids
@@ -612,7 +618,12 @@ fn set_terminal_recoverable(
612618 "UPDATE workspace_terminals
613619 SET recoverable = ?3, updated_at = ?4
614620 WHERE workspace_id = ?1 AND terminal_id = ?2" ,
615- params ! [ workspace_id, terminal_id as i64 , if recoverable { 1 } else { 0 } , now_ts( ) ] ,
621+ params ! [
622+ workspace_id,
623+ terminal_id as i64 ,
624+ if recoverable { 1 } else { 0 } ,
625+ now_ts( )
626+ ] ,
616627 )
617628 . map_err ( |e| e. to_string ( ) ) ?;
618629 Ok ( ( ) )
@@ -774,7 +785,9 @@ fn load_workspace_controller_lease_from_conn(
774785
775786 match payload {
776787 Ok ( value) => parse_json ( & value) ,
777- Err ( rusqlite:: Error :: QueryReturnedNoRows ) => Ok ( default_workspace_controller_lease ( workspace_id) ) ,
788+ Err ( rusqlite:: Error :: QueryReturnedNoRows ) => {
789+ Ok ( default_workspace_controller_lease ( workspace_id) )
790+ }
778791 Err ( error) => Err ( error. to_string ( ) ) ,
779792 }
780793}
@@ -1043,7 +1056,9 @@ fn remove_workspace_from_all_ui_state_scopes(
10431056 let ( device_id_row, payload) = row. map_err ( |e| e. to_string ( ) ) ?;
10441057 let mut ui_state: DeviceWorkbenchUiState = parse_json ( & payload) ?;
10451058 let before = ui_state. open_workspace_ids . clone ( ) ;
1046- ui_state. open_workspace_ids . retain ( |item| item != workspace_id) ;
1059+ ui_state
1060+ . open_workspace_ids
1061+ . retain ( |item| item != workspace_id) ;
10471062 if ui_state. open_workspace_ids != before {
10481063 save_device_ui_state_to_conn ( conn, Some ( device_id_row. as_str ( ) ) , & ui_state) ?;
10491064 }
@@ -1225,7 +1240,9 @@ pub(crate) fn workbench_bootstrap(
12251240 device_id : Option < & str > ,
12261241 client_id : Option < & str > ,
12271242) -> Result < WorkbenchBootstrap , String > {
1228- with_db ( state, |conn| build_bootstrap_from_conn ( conn, device_id, client_id) )
1243+ with_db ( state, |conn| {
1244+ build_bootstrap_from_conn ( conn, device_id, client_id)
1245+ } )
12291246}
12301247
12311248pub ( crate ) fn workspace_snapshot (
@@ -1538,7 +1555,9 @@ pub(crate) fn patch_workspace_view_state(
15381555 let next = WorkspaceViewState {
15391556 active_session_id : patch. active_session_id . unwrap_or ( current. active_session_id ) ,
15401557 active_pane_id : patch. active_pane_id . unwrap_or ( current. active_pane_id ) ,
1541- active_terminal_id : patch. active_terminal_id . unwrap_or ( current. active_terminal_id ) ,
1558+ active_terminal_id : patch
1559+ . active_terminal_id
1560+ . unwrap_or ( current. active_terminal_id ) ,
15421561 pane_layout : patch. pane_layout . unwrap_or ( current. pane_layout ) ,
15431562 file_preview : patch. file_preview . unwrap_or ( current. file_preview ) ,
15441563 } ;
@@ -1551,14 +1570,18 @@ pub(crate) fn load_workspace_controller_lease(
15511570 state : State < ' _ , AppState > ,
15521571 workspace_id : & str ,
15531572) -> Result < WorkspaceControllerLease , String > {
1554- with_db ( state, |conn| load_workspace_controller_lease_from_conn ( conn, workspace_id) )
1573+ with_db ( state, |conn| {
1574+ load_workspace_controller_lease_from_conn ( conn, workspace_id)
1575+ } )
15551576}
15561577
15571578pub ( crate ) fn save_workspace_controller_lease (
15581579 state : State < ' _ , AppState > ,
15591580 lease : & WorkspaceControllerLease ,
15601581) -> Result < ( ) , String > {
1561- with_db ( state, |conn| save_workspace_controller_lease_to_conn ( conn, lease) )
1582+ with_db ( state, |conn| {
1583+ save_workspace_controller_lease_to_conn ( conn, lease)
1584+ } )
15621585}
15631586
15641587pub ( crate ) fn upsert_workspace_attachment (
@@ -1582,7 +1605,14 @@ pub(crate) fn append_agent_lifecycle_event(
15821605 data : & str ,
15831606) -> Result < AgentLifecycleHistoryEntry , String > {
15841607 with_db ( state, |conn| {
1585- append_agent_lifecycle_event_to_conn ( conn, workspace_id, session_id, kind, source_event, data)
1608+ append_agent_lifecycle_event_to_conn (
1609+ conn,
1610+ workspace_id,
1611+ session_id,
1612+ kind,
1613+ source_event,
1614+ data,
1615+ )
15861616 } )
15871617}
15881618
@@ -1591,7 +1621,9 @@ pub(crate) fn load_agent_lifecycle_events(
15911621 workspace_id : & str ,
15921622 limit : usize ,
15931623) -> Result < Vec < AgentLifecycleHistoryEntry > , String > {
1594- with_db ( state, |conn| load_agent_lifecycle_events_from_conn ( conn, workspace_id, limit) )
1624+ with_db ( state, |conn| {
1625+ load_agent_lifecycle_events_from_conn ( conn, workspace_id, limit)
1626+ } )
15951627}
15961628
15971629pub ( crate ) fn list_workspace_ids_for_workspace_client (
@@ -1609,7 +1641,9 @@ pub(crate) fn mark_workspace_client_detached(
16091641 device_id : & str ,
16101642 client_id : & str ,
16111643) -> Result < ( ) , String > {
1612- with_db ( state, |conn| mark_workspace_client_detached_from_conn ( conn, device_id, client_id) )
1644+ with_db ( state, |conn| {
1645+ mark_workspace_client_detached_from_conn ( conn, device_id, client_id)
1646+ } )
16131647}
16141648
16151649pub ( crate ) fn persist_workspace_terminal (
@@ -1619,7 +1653,9 @@ pub(crate) fn persist_workspace_terminal(
16191653 output : & str ,
16201654 recoverable : bool ,
16211655) -> Result < ( ) , String > {
1622- with_db ( state, |conn| persist_terminal_row ( conn, workspace_id, terminal_id, output, recoverable) )
1656+ with_db ( state, |conn| {
1657+ persist_terminal_row ( conn, workspace_id, terminal_id, output, recoverable)
1658+ } )
16231659}
16241660
16251661pub ( crate ) fn append_workspace_terminal_output (
@@ -1628,7 +1664,9 @@ pub(crate) fn append_workspace_terminal_output(
16281664 terminal_id : u64 ,
16291665 chunk : & str ,
16301666) -> Result < ( ) , String > {
1631- with_db ( state, |conn| append_terminal_output ( conn, workspace_id, terminal_id, chunk) )
1667+ with_db ( state, |conn| {
1668+ append_terminal_output ( conn, workspace_id, terminal_id, chunk)
1669+ } )
16321670}
16331671
16341672pub ( crate ) fn set_workspace_terminal_recoverable (
@@ -1637,15 +1675,19 @@ pub(crate) fn set_workspace_terminal_recoverable(
16371675 terminal_id : u64 ,
16381676 recoverable : bool ,
16391677) -> Result < ( ) , String > {
1640- with_db ( state, |conn| set_terminal_recoverable ( conn, workspace_id, terminal_id, recoverable) )
1678+ with_db ( state, |conn| {
1679+ set_terminal_recoverable ( conn, workspace_id, terminal_id, recoverable)
1680+ } )
16411681}
16421682
16431683pub ( crate ) fn delete_workspace_terminal (
16441684 state : State < ' _ , AppState > ,
16451685 workspace_id : & str ,
16461686 terminal_id : u64 ,
16471687) -> Result < ( ) , String > {
1648- with_db ( state, |conn| delete_persisted_terminal ( conn, workspace_id, terminal_id) )
1688+ with_db ( state, |conn| {
1689+ delete_persisted_terminal ( conn, workspace_id, terminal_id)
1690+ } )
16491691}
16501692
16511693pub ( crate ) fn append_session_stream (
0 commit comments