Skip to content

Commit

Permalink
Merge pull request #494 from marhkb/refactor/remove-unnecessary-closu…
Browse files Browse the repository at this point in the history
…re-move

refactor: Remove all unnecessary `move`in closures
  • Loading branch information
marhkb authored Dec 27, 2022
2 parents bcc7466 + f535c27 commit cfd889b
Show file tree
Hide file tree
Showing 24 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion src/view/action/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);
klass.install_action(ACTION_CANCEL, None, |widget, _, _| widget.cancel());
klass.install_action(ACTION_VIEW_ARTIFACT, None, move |widget, _, _| {
klass.install_action(ACTION_VIEW_ARTIFACT, None, |widget, _, _| {
widget.view_artifact();
});
klass.install_action(ACTION_RETRY, None, |widget, _, _| widget.retry());
Expand Down
4 changes: 2 additions & 2 deletions src/view/component/back_navigation_controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_GO_FIRST, None, move |widget, _, _| {
klass.install_action(ACTION_GO_FIRST, None, |widget, _, _| {
widget.navigate_to_first();
});
klass.install_action(ACTION_BACK, None, move |widget, _, _| {
klass.install_action(ACTION_BACK, None, |widget, _, _| {
widget.navigate_back();
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/view/connection/creation_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ mod imp {
widget.copy_socket_acivation_command();
},
);
klass.install_action(ACTION_SHOW_CUSTOM_INFO_DIALOG, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_CUSTOM_INFO_DIALOG, None, |widget, _, _| {
widget.show_custom_info_dialog();
});
klass.install_action(ACTION_TRY_CONNECT, None, move |widget, _, _| {
klass.install_action(ACTION_TRY_CONNECT, None, |widget, _, _| {
widget.try_connect();
});
klass.install_action(ACTION_ABORT, None, move |widget, _, _| {
klass.install_action(ACTION_ABORT, None, |widget, _, _| {
widget.abort();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/connection/custom_info_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mod imp {
widget.copy_root_socket_acivation_command();
},
);
klass.install_action(ACTION_COPY_ROOT_URL, None, move |widget, _, _| {
klass.install_action(ACTION_COPY_ROOT_URL, None, |widget, _, _| {
widget.copy_root_url();
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/view/container/creation_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_SEARCH_IMAGE, None, move |widget, _, _| {
klass.install_action(ACTION_SEARCH_IMAGE, None, |widget, _, _| {
widget.search_image();
});
klass.install_action(ACTION_REMOVE_REMOTE_IMAGE, None, move |widget, _, _| {
klass.install_action(ACTION_REMOVE_REMOTE_IMAGE, None, |widget, _, _| {
widget.remove_remote();
});
klass.install_action(ACTION_ADD_CMD_ARG, None, |widget, _, _| {
Expand Down
38 changes: 19 additions & 19 deletions src/view/container/details_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,65 +69,65 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_RENAME, None, move |widget, _, _| {
klass.install_action(ACTION_RENAME, None, |widget, _, _| {
widget.rename();
});
klass.install_action(ACTION_COMMIT, None, move |widget, _, _| {
klass.install_action(ACTION_COMMIT, None, |widget, _, _| {
widget.commit();
});
klass.install_action(ACTION_GET_FILES, None, move |widget, _, _| {
klass.install_action(ACTION_GET_FILES, None, |widget, _, _| {
widget.get_files();
});
klass.install_action(ACTION_PUT_FILES, None, move |widget, _, _| {
klass.install_action(ACTION_PUT_FILES, None, |widget, _, _| {
widget.put_files();
});
klass.install_action(ACTION_SHOW_HEALTH_DETAILS, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_HEALTH_DETAILS, None, |widget, _, _| {
widget.show_health_details();
});
klass.install_action(ACTION_SHOW_IMAGE_DETAILS, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_IMAGE_DETAILS, None, |widget, _, _| {
widget.show_image_details();
});
klass.install_action(ACTION_SHOW_POD_DETAILS, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_POD_DETAILS, None, |widget, _, _| {
widget.show_pod_details();
});
klass.install_action(ACTION_START_OR_RESUME, None, move |widget, _, _| {
klass.install_action(ACTION_START_OR_RESUME, None, |widget, _, _| {
if widget.container().map(|c| c.can_start()).unwrap_or(false) {
super::super::start(widget.upcast_ref());
} else {
super::super::resume(widget.upcast_ref());
}
});
klass.install_action(ACTION_STOP, None, move |widget, _, _| {
klass.install_action(ACTION_STOP, None, |widget, _, _| {
super::super::stop(widget.upcast_ref());
});
klass.install_action(ACTION_KILL, None, move |widget, _, _| {
klass.install_action(ACTION_KILL, None, |widget, _, _| {
super::super::kill(widget.upcast_ref());
});
klass.install_action(ACTION_RESTART, None, move |widget, _, _| {
klass.install_action(ACTION_RESTART, None, |widget, _, _| {
super::super::restart(widget.upcast_ref());
});
klass.install_action(ACTION_PAUSE, None, move |widget, _, _| {
klass.install_action(ACTION_PAUSE, None, |widget, _, _| {
super::super::pause(widget.upcast_ref());
});
klass.install_action(ACTION_RESUME, None, move |widget, _, _| {
klass.install_action(ACTION_RESUME, None, |widget, _, _| {
super::super::resume(widget.upcast_ref());
});
klass.install_action(ACTION_DELETE, None, move |widget, _, _| {
klass.install_action(ACTION_DELETE, None, |widget, _, _| {
super::super::delete(widget.upcast_ref());
});
klass.install_action(ACTION_INSPECT, None, move |widget, _, _| {
klass.install_action(ACTION_INSPECT, None, |widget, _, _| {
widget.show_inspection();
});
klass.install_action(ACTION_GENERATE_KUBE, None, move |widget, _, _| {
klass.install_action(ACTION_GENERATE_KUBE, None, |widget, _, _| {
widget.show_kube();
});
klass.install_action(ACTION_SHOW_TTY, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_TTY, None, |widget, _, _| {
widget.show_tty();
});
klass.install_action(ACTION_SHOW_LOG, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_LOG, None, |widget, _, _| {
widget.show_log();
});
klass.install_action(ACTION_SHOW_PROCESSES, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_PROCESSES, None, |widget, _, _| {
widget.show_processes();
});

Expand Down
4 changes: 2 additions & 2 deletions src/view/container/log_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ mod imp {
klass.install_action(ACTION_TOGGLE_SEARCH, None, |widget, _, _| {
widget.toggle_search();
});
klass.install_action(ACTION_SCROLL_DOWN, None, move |widget, _, _| {
klass.install_action(ACTION_SCROLL_DOWN, None, |widget, _, _| {
widget.scroll_down();
});
klass.install_action(ACTION_START_CONTAINER, None, move |widget, _, _| {
klass.install_action(ACTION_START_CONTAINER, None, |widget, _, _| {
widget.start_or_resume_container();
});

Expand Down
16 changes: 8 additions & 8 deletions src/view/container/menu_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,30 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_START, None, move |widget, _, _| {
klass.install_action(ACTION_START, None, |widget, _, _| {
super::super::start(widget.upcast_ref());
});
klass.install_action(ACTION_STOP, None, move |widget, _, _| {
klass.install_action(ACTION_STOP, None, |widget, _, _| {
super::super::stop(widget.upcast_ref());
});
klass.install_action(ACTION_KILL, None, move |widget, _, _| {
klass.install_action(ACTION_KILL, None, |widget, _, _| {
super::super::kill(widget.upcast_ref());
});
klass.install_action(ACTION_RESTART, None, move |widget, _, _| {
klass.install_action(ACTION_RESTART, None, |widget, _, _| {
super::super::restart(widget.upcast_ref());
});
klass.install_action(ACTION_PAUSE, None, move |widget, _, _| {
klass.install_action(ACTION_PAUSE, None, |widget, _, _| {
super::super::pause(widget.upcast_ref());
});
klass.install_action(ACTION_RESUME, None, move |widget, _, _| {
klass.install_action(ACTION_RESUME, None, |widget, _, _| {
super::super::resume(widget.upcast_ref());
});

klass.install_action(ACTION_RENAME, None, move |widget, _, _| {
klass.install_action(ACTION_RENAME, None, |widget, _, _| {
widget.rename();
});

klass.install_action(ACTION_DELETE, None, move |widget, _, _| {
klass.install_action(ACTION_DELETE, None, |widget, _, _| {
super::super::delete(widget.upcast_ref());
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/container/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action("container-row.activate", None, move |widget, _, _| {
klass.install_action("container-row.activate", None, |widget, _, _| {
widget.activate();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/container/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_START_OR_RESUME, None, move |widget, _, _| {
klass.install_action(ACTION_START_OR_RESUME, None, |widget, _, _| {
if let Some(container) = widget.container() {
if container.can_start() {
super::super::start(widget.upcast_ref());
Expand Down
8 changes: 4 additions & 4 deletions src/view/containers/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ mod imp {
widget.start_or_resume_selection();
},
);
klass.install_action(ACTION_STOP_SELECTION, None, move |widget, _, _| {
klass.install_action(ACTION_STOP_SELECTION, None, |widget, _, _| {
widget.stop_selection();
});
klass.install_action(ACTION_PAUSE_SELECTION, None, move |widget, _, _| {
klass.install_action(ACTION_PAUSE_SELECTION, None, |widget, _, _| {
widget.pause_selection();
});
klass.install_action(ACTION_RESTART_SELECTION, None, move |widget, _, _| {
klass.install_action(ACTION_RESTART_SELECTION, None, |widget, _, _| {
widget.restart_selection();
});
klass.install_action(ACTION_DELETE_SELECTION, None, move |widget, _, _| {
klass.install_action(ACTION_DELETE_SELECTION, None, |widget, _, _| {
widget.delete_selection();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/image/build_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_BUILD, None, move |widget, _, _| {
klass.install_action(ACTION_BUILD, None, |widget, _, _| {
widget.build();
});

Expand Down
8 changes: 4 additions & 4 deletions src/view/image/details_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_TAG, None, move |widget, _, _| {
klass.install_action(ACTION_TAG, None, |widget, _, _| {
widget.tag();
});

klass.install_action(ACTION_INSPECT_IMAGE, None, move |widget, _, _| {
klass.install_action(ACTION_INSPECT_IMAGE, None, |widget, _, _| {
widget.show_inspection();
});

klass.install_action(ACTION_SHOW_HISTORY, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_HISTORY, None, |widget, _, _| {
widget.show_history();
});

klass.install_action(ACTION_DELETE_IMAGE, None, move |widget, _, _| {
klass.install_action(ACTION_DELETE_IMAGE, None, |widget, _, _| {
widget.delete_image();
});

Expand Down
4 changes: 2 additions & 2 deletions src/view/image/menu_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_CREATE_CONTAINER, None, move |widget, _, _| {
klass.install_action(ACTION_CREATE_CONTAINER, None, |widget, _, _| {
widget.create_container();
});
klass.install_action(ACTION_DELETE_IMAGE, None, move |widget, _, _| {
klass.install_action(ACTION_DELETE_IMAGE, None, |widget, _, _| {
widget.delete_image();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/image/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action("image-row.activate", None, move |widget, _, _| {
klass.install_action("image-row.activate", None, |widget, _, _| {
widget.activate();
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/view/images/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,23 @@ mod imp {
ACTION_PULL_IMAGE,
None,
);
klass.install_action(ACTION_PULL_IMAGE, None, move |widget, _, _| {
klass.install_action(ACTION_PULL_IMAGE, None, |widget, _, _| {
widget.show_download_page();
});

klass.install_action(ACTION_BUILD_IMAGE, None, move |widget, _, _| {
klass.install_action(ACTION_BUILD_IMAGE, None, |widget, _, _| {
widget.show_build_page();
});

klass.install_action(ACTION_PRUNE_UNUSED_IMAGES, None, move |widget, _, _| {
klass.install_action(ACTION_PRUNE_UNUSED_IMAGES, None, |widget, _, _| {
widget.show_prune_page();
});

klass.install_action(ACTION_SHOW_ADD_IMAGE_MENU, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_ADD_IMAGE_MENU, None, |widget, _, _| {
widget.show_add_image_menu();
});

klass.install_action(ACTION_DELETE_SELECTION, None, move |widget, _, _| {
klass.install_action(ACTION_DELETE_SELECTION, None, |widget, _, _| {
widget.delete_selection();
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/view/pod/creation_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ mod imp {
klass.install_action(ACTION_TOGGLE_RESOLV, None, |widget, _, _| {
widget.toggle_resolv();
});
klass.install_action(ACTION_REMOVE_REMOTE_INFRA, None, move |widget, _, _| {
klass.install_action(ACTION_REMOVE_REMOTE_INFRA, None, |widget, _, _| {
widget.remove_remote();
});
klass.install_action(ACTION_SEARCH_INFRA, None, move |widget, _, _| {
klass.install_action(ACTION_SEARCH_INFRA, None, |widget, _, _| {
widget.search_image();
});
}
Expand Down
20 changes: 10 additions & 10 deletions src/view/pod/details_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,39 +68,39 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);

klass.install_action(ACTION_START_OR_RESUME, None, move |widget, _, _| {
klass.install_action(ACTION_START_OR_RESUME, None, |widget, _, _| {
if widget.pod().map(|pod| pod.can_start()).unwrap_or(false) {
super::super::start(widget.upcast_ref());
} else {
super::super::resume(widget.upcast_ref());
}
});
klass.install_action(ACTION_STOP, None, move |widget, _, _| {
klass.install_action(ACTION_STOP, None, |widget, _, _| {
super::super::stop(widget.upcast_ref());
});
klass.install_action(ACTION_KILL, None, move |widget, _, _| {
klass.install_action(ACTION_KILL, None, |widget, _, _| {
super::super::kill(widget.upcast_ref());
});
klass.install_action(ACTION_RESTART, None, move |widget, _, _| {
klass.install_action(ACTION_RESTART, None, |widget, _, _| {
super::super::restart(widget.upcast_ref());
});
klass.install_action(ACTION_PAUSE, None, move |widget, _, _| {
klass.install_action(ACTION_PAUSE, None, |widget, _, _| {
super::super::pause(widget.upcast_ref());
});
klass.install_action(ACTION_RESUME, None, move |widget, _, _| {
klass.install_action(ACTION_RESUME, None, |widget, _, _| {
super::super::resume(widget.upcast_ref());
});
klass.install_action(ACTION_DELETE, None, move |widget, _, _| {
klass.install_action(ACTION_DELETE, None, |widget, _, _| {
super::super::delete(widget.upcast_ref());
});

klass.install_action(ACTION_INSPECT_POD, None, move |widget, _, _| {
klass.install_action(ACTION_INSPECT_POD, None, |widget, _, _| {
widget.show_inspection();
});
klass.install_action(ACTION_GENERATE_KUBE, None, move |widget, _, _| {
klass.install_action(ACTION_GENERATE_KUBE, None, |widget, _, _| {
widget.show_kube();
});
klass.install_action(ACTION_SHOW_PROCESSES, None, move |widget, _, _| {
klass.install_action(ACTION_SHOW_PROCESSES, None, |widget, _, _| {
widget.show_processes();
});

Expand Down
Loading

0 comments on commit cfd889b

Please sign in to comment.