Skip to content

Commit b1d3b85

Browse files
committed
ran rustfmt
1 parent cecb832 commit b1d3b85

File tree

1 file changed

+12
-12
lines changed
  • examples/listbox_sort_stringlist

1 file changed

+12
-12
lines changed

examples/listbox_sort_stringlist/main.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,21 @@ fn build_ui(application: &gtk::Application) {
2828

2929
let vbox = gtk::Box::new(gtk::Orientation::Vertical, 5);
3030

31-
// Create a StringSorter with a property expression to sort
31+
// Create a StringSorter with a property expression to sort
3232
// StringObjects in a StringList. StringObject has a "string" property.
3333
let expression = gtk::PropertyExpression::new(
3434
gtk::StringObject::static_type(),
3535
None::<gtk::Expression>,
36-
"string");
36+
"string",
37+
);
3738
let sorter = gtk::StringSorter::new(Some(expression));
3839
sorter.set_ignore_case(true);
3940

4041
// Create our list store as a StringList and populate with some strings.
4142
let model = gtk::StringList::new(&["zoo", "abba", "donkey", "sunrise", "river", "phoenix"]);
4243

4344
// Create a sort model and bind it to the ListStore and the sorter.
44-
let sort_model = gtk::SortListModel::new(
45-
Some(model.clone()),
46-
Some(sorter.clone()));
45+
let sort_model = gtk::SortListModel::new(Some(model.clone()), Some(sorter.clone()));
4746

4847
// And then create the UI part, the listbox and bind the sort
4948
// model to it. Whenever the UI needs to show a new row, e.g. because
@@ -107,17 +106,18 @@ fn build_ui(application: &gtk::Application) {
107106

108107
if let Some(selected) = selected {
109108
// Find the selected text.
110-
let selected = selected.child()
111-
.expect("Listrow child should be a widget");
112-
let selected = selected.downcast_ref::<gtk::Inscription>()
113-
.expect("The object should be of type `Inscription`.");
109+
let selected = selected.child().expect("Listrow child should be a widget");
110+
let selected = selected
111+
.downcast_ref::<gtk::Inscription>()
112+
.expect("The object should be of type `Inscription`.");
114113
if let Some(selected) = selected.text() {
115114
let mut selected_index = None;
116115
// Find the position in the StringList model of the selected string
117116
for ind in 0..model.n_items() {
118117
if let Some(item) = model.item(ind) {
119-
let item = item.downcast_ref::<gtk::StringObject>()
120-
.expect("Object should be a stringobject");
118+
let item = item
119+
.downcast_ref::<gtk::StringObject>()
120+
.expect("Object should be a stringobject");
121121
if item.string() == selected {
122122
selected_index = Some(ind);
123123
break;
@@ -130,7 +130,7 @@ fn build_ui(application: &gtk::Application) {
130130
}
131131
}
132132
}
133-
}
133+
}
134134
));
135135
hbox.append(&delete_button);
136136

0 commit comments

Comments
 (0)