瀏覽代碼

LibGUI: Cast unused smart-pointer return values to void

Sam Atkins 3 年之前
父節點
當前提交
d95e50643e

+ 2 - 2
Userland/Libraries/LibGUI/SettingsWindow.cpp

@@ -26,7 +26,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(String title, Show
 
     auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
     main_widget->set_fill_with_background_color(true);
-    TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
+    (void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
     main_widget->layout()->set_margins(4);
     main_widget->layout()->set_spacing(6);
 
@@ -34,7 +34,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(String title, Show
 
     auto button_container = TRY(main_widget->try_add<GUI::Widget>());
     button_container->set_shrink_to_fit(true);
-    TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>());
+    (void)TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>());
     button_container->layout()->set_spacing(6);
 
     if (show_defaults_button == ShowDefaultsButton::Yes) {

+ 1 - 1
Userland/Libraries/LibGUI/TextDocument.cpp

@@ -85,7 +85,7 @@ bool TextDocument::set_text(StringView text, AllowCallback allow_callback)
 
     // Don't show the file's trailing newline as an actual new line.
     if (line_count() > 1 && line(line_count() - 1).is_empty())
-        m_lines.take_last();
+        (void)m_lines.take_last();
 
     m_client_notifications_enabled = true;
 

+ 1 - 1
Userland/Libraries/LibGUI/Toolbar.cpp

@@ -118,7 +118,7 @@ ErrorOr<void> Toolbar::try_add_separator()
 
     auto item = TRY(adopt_nonnull_own_or_enomem(new (nothrow) Item));
     item->type = Item::Type::Separator;
-    TRY(try_add<SeparatorWidget>(m_orientation == Gfx::Orientation::Horizontal ? Gfx::Orientation::Vertical : Gfx::Orientation::Horizontal));
+    (void)TRY(try_add<SeparatorWidget>(m_orientation == Gfx::Orientation::Horizontal ? Gfx::Orientation::Vertical : Gfx::Orientation::Horizontal));
     m_items.unchecked_append(move(item));
     return {};
 }

+ 1 - 1
Userland/Libraries/LibGUI/UndoStack.cpp

@@ -57,7 +57,7 @@ void UndoStack::push(NonnullOwnPtr<Command> command)
 {
     // If the stack cursor is behind the top of the stack, nuke everything from here to the top.
     while (m_stack.size() != m_stack_index)
-        m_stack.take_last();
+        (void)m_stack.take_last();
 
     if (m_clean_index.has_value() && m_clean_index.value() > m_stack.size())
         m_clean_index = {};