Skip to content

Commit 47b10cc

Browse files
committed
style: apply cargo fmt --all
1 parent c140b1a commit 47b10cc

7 files changed

Lines changed: 38 additions & 64 deletions

File tree

linux/crates/app/src/ui/app/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ use crate::services::database_service::ConnectionHealth;
3434
/// Used by both browse `SaveCompletedForTab` and structure
3535
/// `on_structure_save_completed` so a Table tab with both kinds of
3636
/// pending changes only closes after BOTH saves succeed.
37-
pub(super) fn dec_close_after_save(
38-
map: &mut std::collections::HashMap<Uuid, u32>,
39-
tab_id: &Uuid,
40-
) -> bool {
37+
pub(super) fn dec_close_after_save(map: &mut std::collections::HashMap<Uuid, u32>, tab_id: &Uuid) -> bool {
4138
if let Some(count) = map.get_mut(tab_id) {
4239
*count = count.saturating_sub(1);
4340
if *count == 0 {
@@ -1017,7 +1014,9 @@ impl SimpleComponent for App {
10171014
let sidebar_placeholder = adw::StatusPage::builder()
10181015
.icon_name("view-list-symbolic")
10191016
.title(crate::tr!("No tables"))
1020-
.description(crate::tr!("Nothing matches the current search, or this connection has no tables yet."))
1017+
.description(crate::tr!(
1018+
"Nothing matches the current search, or this connection has no tables yet."
1019+
))
10211020
.build();
10221021
sidebar_placeholder.add_css_class("compact");
10231022
sidebar_listbox.set_placeholder(Some(&sidebar_placeholder));

linux/crates/app/src/ui/app/structure.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ impl App {
194194
// (or _failed) drains `close_after_save` for `tab_id`, so the
195195
// close-with-pending flow still resolves through that path.
196196
if self.structure_saves_in_flight.borrow().contains(&tab_id) {
197-
tracing::debug!(?tab_id, "save_structure_tab_by_id: save already in flight; deferring to first dispatch");
197+
tracing::debug!(
198+
?tab_id,
199+
"save_structure_tab_by_id: save already in flight; deferring to first dispatch"
200+
);
198201
return;
199202
}
200203
let driver_id = self.driver_id().to_string();
@@ -645,5 +648,4 @@ impl App {
645648
page.set_needs_attention(combined_dirty && !is_selected);
646649
self.refresh_window_title();
647650
}
648-
649651
}

linux/crates/app/src/ui/browse_tab.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,10 @@ impl SimpleComponent for BrowseTab {
12511251
return glib::Propagation::Proceed;
12521252
};
12531253
grid_sender_for_null
1254-
.send(GridMsg::SetCellNull { row_position, col_index })
1254+
.send(GridMsg::SetCellNull {
1255+
row_position,
1256+
col_index,
1257+
})
12551258
.ok();
12561259
glib::Propagation::Stop
12571260
}))
@@ -1368,9 +1371,13 @@ impl SimpleComponent for BrowseTab {
13681371
},
13691372
GridMsg::CopyToClipboard(text) => BrowseTabInput::GridCopyToClipboard(text),
13701373
GridMsg::CopyRowAsInsert { row_position } => BrowseTabInput::GridCopyRowAsInsert { row_position },
1371-
GridMsg::SetCellNull { row_position, col_index } => {
1372-
BrowseTabInput::GridSetCellNull { row_position, col_index }
1373-
}
1374+
GridMsg::SetCellNull {
1375+
row_position,
1376+
col_index,
1377+
} => BrowseTabInput::GridSetCellNull {
1378+
row_position,
1379+
col_index,
1380+
},
13741381
GridMsg::DeleteRowAt { row_position } => BrowseTabInput::GridDeleteRowAt { row_position },
13751382
GridMsg::InsertRow => BrowseTabInput::InsertRow,
13761383
GridMsg::DuplicateRow { row_position } => BrowseTabInput::DuplicateRow { row_position },

linux/crates/app/src/ui/grid.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -890,15 +890,7 @@ fn setup_readonly_cell(
890890
.build();
891891
item.set_child(Some(&label));
892892
if let Some(menus) = menus {
893-
attach_cell_gesture(
894-
label.upcast_ref(),
895-
column_view,
896-
idx,
897-
column_name,
898-
false,
899-
false,
900-
menus,
901-
);
893+
attach_cell_gesture(label.upcast_ref(), column_view, idx, column_name, false, false, menus);
902894
}
903895
}
904896

@@ -1226,7 +1218,11 @@ fn install_popover_close_cleanup(label: &super::cell_editor::CellEditor, popover
12261218
/// the IME popover. The preedit-changed handler clears the gate
12271219
/// when composition completes; the next `editing-notify(false)`
12281220
/// after that fires the real commit.
1229-
fn install_edit_commit_handler(label: &super::cell_editor::CellEditor, col_index: usize, sender: relm4::Sender<GridMsg>) {
1221+
fn install_edit_commit_handler(
1222+
label: &super::cell_editor::CellEditor,
1223+
col_index: usize,
1224+
sender: relm4::Sender<GridMsg>,
1225+
) {
12301226
// The cell's edit-mode child is a `gtk::Text`; that child owns
12311227
// the IME context and emits preedit-changed.
12321228
{
@@ -1332,10 +1328,7 @@ pub(super) struct GridMenus {
13321328
/// menu, GNOME Files's row context menu, etc. — and replaces the
13331329
/// old "one popover + one action group per cell widget" approach
13341330
/// which carried ~70 popover instances on a typical 7-column grid.
1335-
fn install_grid_context_menus(
1336-
column_view: &gtk::ColumnView,
1337-
sender: relm4::Sender<GridMsg>,
1338-
) -> GridMenus {
1331+
fn install_grid_context_menus(column_view: &gtk::ColumnView, sender: relm4::Sender<GridMsg>) -> GridMenus {
13391332
let context: Rc<RefCell<Option<CellContext>>> = Rc::new(RefCell::new(None));
13401333

13411334
// Editable-cell menu model. The Edit-cell item is marked
@@ -1530,9 +1523,7 @@ fn install_grid_context_menus(
15301523
return;
15311524
}
15321525
g.set_state(gtk::EventSequenceState::Claimed);
1533-
empty_for_gesture.set_pointing_to(Some(&gtk::gdk::Rectangle::new(
1534-
x as i32, y as i32, 1, 1,
1535-
)));
1526+
empty_for_gesture.set_pointing_to(Some(&gtk::gdk::Rectangle::new(x as i32, y as i32, 1, 1)));
15361527
empty_for_gesture.popup();
15371528
});
15381529
column_view.add_controller(empty_gesture);

linux/crates/app/src/ui/structure_tab.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,7 @@ fn append_add_button(list: &gtk::ListBox, label: &str, on_activate: impl Fn() +
513513
/// indexes list to show UNIQUE / PRIMARY tags. `accent_class` is the
514514
/// CSS class controlling the colour (`dim-label`, `accent`, etc.).
515515
fn index_badge(label: &str, accent_class: &str) -> gtk::Label {
516-
let badge = gtk::Label::builder()
517-
.label(label)
518-
.valign(gtk::Align::Center)
519-
.build();
516+
let badge = gtk::Label::builder().label(label).valign(gtk::Align::Center).build();
520517
badge.add_css_class("caption");
521518
badge.add_css_class(accent_class);
522519
badge
@@ -633,8 +630,7 @@ fn build_column_expander_row(
633630
field: ColumnField::Type(e.text().to_string()),
634631
});
635632
});
636-
let (suggestions_button, suggestions_popover) =
637-
build_type_suggestions_button(driver_id, &type_row);
633+
let (suggestions_button, suggestions_popover) = build_type_suggestions_button(driver_id, &type_row);
638634
type_row.add_suffix(&suggestions_button);
639635
popover_registry.borrow_mut().push(suggestions_popover);
640636
row.add_row(&type_row);
@@ -830,7 +826,6 @@ fn build_fk_row(
830826
row
831827
}
832828

833-
834829
/// Validate the model against driver constraints before Save. Returns
835830
/// the first user-visible error string, or None if all checks pass.
836831
fn validate_save(table_name: &str, columns: &[DraftColumn], mode: StructureMode) -> Result<(), String> {
@@ -1443,17 +1438,11 @@ impl SimpleComponent for StructureTab {
14431438
/// can register it for popdown on rebuild — otherwise an open menu
14441439
/// would keep its captured target alive and dispatch a click into a
14451440
/// detached AdwEntryRow.
1446-
fn build_type_suggestions_button(
1447-
driver_id: &str,
1448-
target: &adw::EntryRow,
1449-
) -> (gtk::MenuButton, gtk::Popover) {
1441+
fn build_type_suggestions_button(driver_id: &str, target: &adw::EntryRow) -> (gtk::MenuButton, gtk::Popover) {
14501442
// Per-button action group: one action `apply` keyed by `String`
14511443
// parameter. Each menu item activates `types.apply::<typename>`.
14521444
let action_group = gio::SimpleActionGroup::new();
1453-
let apply_action = gio::SimpleAction::new(
1454-
"apply",
1455-
Some(&String::static_variant_type()),
1456-
);
1445+
let apply_action = gio::SimpleAction::new("apply", Some(&String::static_variant_type()));
14571446
let target_for_action = target.clone();
14581447
apply_action.connect_activate(move |_, param| {
14591448
if let Some(s) = param.and_then(|v| v.get::<String>()) {
@@ -1469,10 +1458,7 @@ fn build_type_suggestions_button(
14691458
let menu = gio::Menu::new();
14701459
for ty in driver_types(driver_id) {
14711460
let item = gio::MenuItem::new(Some(ty), None);
1472-
item.set_action_and_target_value(
1473-
Some("types.apply"),
1474-
Some(&ty.to_variant()),
1475-
);
1461+
item.set_action_and_target_value(Some("types.apply"), Some(&ty.to_variant()));
14761462
menu.append_item(&item);
14771463
}
14781464

linux/crates/app/src/ui/structure_tab_dialogs.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ fn build_form_dialog(title: &str, submit_label: &str) -> (adw::Dialog, gtk::Box,
8585
/// shared `Rc` of name/check pairs so the submit handler can extract
8686
/// which columns the user ticked.
8787
fn build_column_checklist(columns: &[DraftColumn]) -> (gtk::ListBox, ColumnChecks) {
88-
let list = gtk::ListBox::builder()
89-
.selection_mode(gtk::SelectionMode::None)
90-
.build();
88+
let list = gtk::ListBox::builder().selection_mode(gtk::SelectionMode::None).build();
9189
list.add_css_class("boxed-list");
9290
let checks: ColumnChecks = Rc::new(RefCell::new(Vec::new()));
9391
for col in columns {
@@ -141,9 +139,7 @@ pub(super) fn present_index_dialog(
141139
.filter_map(|(n, c)| if c.is_active() { Some(n.clone()) } else { None })
142140
.collect();
143141
if cols.is_empty() {
144-
let _ = sender_for_resp.output(StructureTabOutput::ShowToast(crate::tr!(
145-
"Select at least one column."
146-
)));
142+
let _ = sender_for_resp.output(StructureTabOutput::ShowToast(crate::tr!("Select at least one column.")));
147143
return;
148144
}
149145
sender_for_resp.input(StructureTabInput::AddIndex(IndexInfo {
@@ -158,11 +154,7 @@ pub(super) fn present_index_dialog(
158154
dialog.present(Some(parent));
159155
}
160156

161-
pub(super) fn present_fk_dialog(
162-
parent: &gtk::Widget,
163-
columns: &[DraftColumn],
164-
sender: ComponentSender<StructureTab>,
165-
) {
157+
pub(super) fn present_fk_dialog(parent: &gtk::Widget, columns: &[DraftColumn], sender: ComponentSender<StructureTab>) {
166158
let (dialog, body, submit_btn) = build_form_dialog(&crate::tr!("Add Foreign Key"), &crate::tr!("Add"));
167159

168160
let name_entry = gtk::Entry::builder().placeholder_text(crate::tr!("fk_name")).build();

linux/crates/core/src/sql_ddl.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -838,12 +838,9 @@ pub fn diff_to_ops(
838838
// Drop columns: original entries with no matching draft (matched
839839
// by original.name).
840840
for orig in original_columns {
841-
let still_present = current_columns.iter().any(|c| {
842-
c.original
843-
.as_ref()
844-
.map(|o| o.name == orig.name)
845-
.unwrap_or(false)
846-
});
841+
let still_present = current_columns
842+
.iter()
843+
.any(|c| c.original.as_ref().map(|o| o.name == orig.name).unwrap_or(false));
847844
if !still_present {
848845
ops.push(StructureOp::DropColumn {
849846
schema: schema_owned.clone(),

0 commit comments

Comments
 (0)