Applications: Cast unused smart-pointer TRY return values to void

This commit is contained in:
Sam Atkins 2021-12-03 09:53:24 +00:00 committed by Andreas Kling
parent 7e05ccaa70
commit 3ca2aee054
Notes: sideshowbarker 2024-07-17 23:08:38 +09:00
10 changed files with 40 additions and 40 deletions

View file

@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(GUI::SettingsWindow::create("Browser Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes));
window->set_icon(app_icon.bitmap_for_size(16));
TRY(window->add_tab<BrowserSettingsWidget>("Browser"));
(void)TRY(window->add_tab<BrowserSettingsWidget>("Browser"));
window->show();
return app->exec();

View file

@ -276,7 +276,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
auto backtrace_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Backtrace"));
TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>());
backtrace_tab->layout()->set_margins(4);
auto backtrace_label = TRY(backtrace_tab->try_add<GUI::Label>("A backtrace for each thread alive during the crash is listed below:"));
@ -287,7 +287,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
backtrace_tab_widget->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
for (auto& backtrace : thread_backtraces) {
auto container = TRY(backtrace_tab_widget->try_add_tab<GUI::Widget>(backtrace.title));
TRY(container->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(container->try_set_layout<GUI::VerticalBoxLayout>());
container->layout()->set_margins(4);
auto backtrace_text_editor = TRY(container->try_add<GUI::TextEditor>());
backtrace_text_editor->set_text(backtrace.text);
@ -307,7 +307,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
cpu_registers_tab_widget->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
for (auto& cpu_registers : thread_cpu_registers) {
auto container = TRY(cpu_registers_tab_widget->try_add_tab<GUI::Widget>(cpu_registers.title));
TRY(container->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(container->try_set_layout<GUI::VerticalBoxLayout>());
container->layout()->set_margins(4);
auto cpu_registers_text_editor = TRY(container->try_add<GUI::TextEditor>());
cpu_registers_text_editor->set_text(cpu_registers.text);
@ -316,7 +316,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto environment_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Environment"));
TRY(environment_tab->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(environment_tab->try_set_layout<GUI::VerticalBoxLayout>());
environment_tab->layout()->set_margins(4);
auto environment_text_editor = TRY(environment_tab->try_add<GUI::TextEditor>());
@ -325,7 +325,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
environment_text_editor->set_should_hide_unnecessary_scrollbars(true);
auto memory_regions_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Memory Regions"));
TRY(memory_regions_tab->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(memory_regions_tab->try_set_layout<GUI::VerticalBoxLayout>());
memory_regions_tab->layout()->set_margins(4);
auto memory_regions_text_editor = TRY(memory_regions_tab->try_add<GUI::TextEditor>());

View file

@ -27,10 +27,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = GUI::Icon::default_icon("app-display-settings");
auto window = TRY(GUI::SettingsWindow::create("Display Settings"));
TRY(window->add_tab<DisplaySettings::BackgroundSettingsWidget>("Background"));
TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts"));
TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor"));
TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces"));
(void)TRY(window->add_tab<DisplaySettings::BackgroundSettingsWidget>("Background"));
(void)TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts"));
(void)TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor"));
(void)TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces"));
window->set_icon(app_icon.bitmap_for_size(16));

View file

@ -278,7 +278,7 @@ ErrorOr<int> run_in_desktop_mode()
window->set_has_alpha_channel(true);
auto desktop_widget = TRY(window->try_set_main_widget<FileManager::DesktopWidget>());
TRY(desktop_widget->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(desktop_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto directory_view = TRY(desktop_widget->try_add<DirectoryView>(DirectoryView::Mode::Desktop));
directory_view->set_name("directory_view");
@ -904,31 +904,31 @@ ErrorOr<int> run_in_windowed_mode(String initial_location, String entry_focused_
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("File Manager", GUI::Icon::default_icon("app-file-manager"), window)));
TRY(main_toolbar.try_add_action(go_back_action));
TRY(main_toolbar.try_add_action(go_forward_action));
TRY(main_toolbar.try_add_action(open_parent_directory_action));
TRY(main_toolbar.try_add_action(go_home_action));
(void)TRY(main_toolbar.try_add_action(go_back_action));
(void)TRY(main_toolbar.try_add_action(go_forward_action));
(void)TRY(main_toolbar.try_add_action(open_parent_directory_action));
(void)TRY(main_toolbar.try_add_action(go_home_action));
TRY(main_toolbar.try_add_separator());
TRY(main_toolbar.try_add_action(directory_view->open_terminal_action()));
(void)TRY(main_toolbar.try_add_action(directory_view->open_terminal_action()));
TRY(main_toolbar.try_add_separator());
TRY(main_toolbar.try_add_action(mkdir_action));
TRY(main_toolbar.try_add_action(touch_action));
(void)TRY(main_toolbar.try_add_action(mkdir_action));
(void)TRY(main_toolbar.try_add_action(touch_action));
TRY(main_toolbar.try_add_separator());
TRY(main_toolbar.try_add_action(focus_dependent_delete_action));
TRY(main_toolbar.try_add_action(directory_view->rename_action()));
(void)TRY(main_toolbar.try_add_action(focus_dependent_delete_action));
(void)TRY(main_toolbar.try_add_action(directory_view->rename_action()));
TRY(main_toolbar.try_add_separator());
TRY(main_toolbar.try_add_action(cut_action));
TRY(main_toolbar.try_add_action(copy_action));
TRY(main_toolbar.try_add_action(paste_action));
(void)TRY(main_toolbar.try_add_action(cut_action));
(void)TRY(main_toolbar.try_add_action(copy_action));
(void)TRY(main_toolbar.try_add_action(paste_action));
TRY(main_toolbar.try_add_separator());
TRY(main_toolbar.try_add_action(directory_view->view_as_icons_action()));
TRY(main_toolbar.try_add_action(directory_view->view_as_table_action()));
TRY(main_toolbar.try_add_action(directory_view->view_as_columns_action()));
(void)TRY(main_toolbar.try_add_action(directory_view->view_as_icons_action()));
(void)TRY(main_toolbar.try_add_action(directory_view->view_as_table_action()));
(void)TRY(main_toolbar.try_add_action(directory_view->view_as_columns_action()));
directory_view->on_path_change = [&](String const& new_path, bool can_read_in_path, bool can_write_in_path) {
auto icon = GUI::FileIconProvider::icon_for_path(new_path);

View file

@ -58,7 +58,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(570, 500);
auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
TRY(widget->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(widget->try_set_layout<GUI::VerticalBoxLayout>());
widget->set_fill_with_background_color(true);
widget->layout()->set_spacing(2);
@ -72,11 +72,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto left_tab_bar = TRY(splitter->try_add<GUI::TabWidget>());
auto tree_view_container = TRY(left_tab_bar->try_add_tab<GUI::Widget>("Browse"));
TRY(tree_view_container->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(tree_view_container->try_set_layout<GUI::VerticalBoxLayout>());
tree_view_container->layout()->set_margins(4);
auto tree_view = TRY(tree_view_container->try_add<GUI::TreeView>());
auto search_view = TRY(left_tab_bar->try_add_tab<GUI::Widget>("Search"));
TRY(search_view->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(search_view->try_set_layout<GUI::VerticalBoxLayout>());
search_view->layout()->set_margins(4);
auto search_box = TRY(search_view->try_add<GUI::TextBox>());
auto search_list_view = TRY(search_view->try_add<GUI::ListView>());
@ -234,9 +234,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
open_page(path);
});
TRY(toolbar->try_add_action(*go_back_action));
TRY(toolbar->try_add_action(*go_forward_action));
TRY(toolbar->try_add_action(*go_home_action));
(void)TRY(toolbar->try_add_action(*go_back_action));
(void)TRY(toolbar->try_add_action(*go_forward_action));
(void)TRY(toolbar->try_add_action(*go_home_action));
auto file_menu = TRY(window->try_add_menu("&File"));
TRY(file_menu->try_add_action(GUI::CommonActions::make_quit_action([](auto&) {

View file

@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(GUI::SettingsWindow::create("Keyboard Settings"));
window->set_icon(app_icon.bitmap_for_size(16));
TRY(window->add_tab<KeyboardSettingsWidget>("Keyboard"));
(void)TRY(window->add_tab<KeyboardSettingsWidget>("Keyboard"));
window->show();
return app->exec();

View file

@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = GUI::Icon::default_icon("app-mail");
auto window = TRY(GUI::SettingsWindow::create("Mail Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes));
TRY(window->add_tab<MailSettingsWidget>("Mail"));
(void)TRY(window->add_tab<MailSettingsWidget>("Mail"));
window->set_icon(app_icon.bitmap_for_size(16));
window->show();

View file

@ -26,8 +26,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = GUI::Icon::default_icon("app-mouse");
auto window = TRY(GUI::SettingsWindow::create("Mouse Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes));
TRY(window->add_tab<MouseWidget>("Mouse"));
TRY(window->add_tab<ThemeWidget>("Cursor Theme"));
(void)TRY(window->add_tab<MouseWidget>("Mouse"));
(void)TRY(window->add_tab<ThemeWidget>("Cursor Theme"));
window->set_icon(app_icon.bitmap_for_size(16));
window->show();

View file

@ -160,11 +160,11 @@ static ErrorOr<NonnullRefPtr<GUI::Window>> create_find_window(VT::TerminalWidget
auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
main_widget->set_fill_with_background_color(true);
main_widget->set_background_role(ColorRole::Button);
TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
main_widget->layout()->set_margins(4);
auto find = TRY(main_widget->try_add<GUI::Widget>());
TRY(find->try_set_layout<GUI::HorizontalBoxLayout>());
(void)TRY(find->try_set_layout<GUI::HorizontalBoxLayout>());
find->layout()->set_margins(4);
find->set_fixed_height(30);

View file

@ -28,8 +28,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(GUI::SettingsWindow::create("Terminal Settings"));
window->set_icon(app_icon.bitmap_for_size(16));
TRY(window->add_tab<TerminalSettingsMainWidget>("Terminal"));
TRY(window->add_tab<TerminalSettingsViewWidget>("View"));
(void)TRY(window->add_tab<TerminalSettingsMainWidget>("Terminal"));
(void)TRY(window->add_tab<TerminalSettingsViewWidget>("View"));
window->show();
return app->exec();