From 7c118096720f10bba0eefe570a58111eaa91b3b1 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 17 Feb 2024 13:31:49 -0600 Subject: [PATCH] fix: more clang-tidy warnings (#6608) * fix: readability-redundant-casting warnings in gtk * fix: bugprone-move-forwarding-reference warnings in gtk * fix: readability-redundant-casting warnings in qt * fix: bugprone-switch-missing-default-case warnings in qt * fix: readability-use-std-min-max warning in qt client * fix: readability-static-accessed-through-instance warning in qt client * fix: cppcoreguidelines-avoid-const-or-ref-data-members warning in qt client * fix: readability-avoid-nested-conditional-operator warning in qt client * fixup! fix: readability-use-std-min-max warning in qt client * fix: readability-redundant-member-init warnings in gtk client * fix: performance-avoid-endl warnings in gtk client * chore: disable readability-qualified-auto too many false warnings * chore: disable cppcoreguidelines-avoid-const-or-ref-data-members * chore: fix readability-duplicate-include warning in gtk client * chore: fix modernize-use-nodiscard warning in gtk client * chore: fix readability-convert-member-functions-to-static warning in gtk client * fixup! fix: bugprone-move-forwarding-reference warnings in gtk * chore: fix performance-enum-size warning in gtk client * fix: cppcoreguidelines-prefer-member-initializer warning in gtk client * fix: readability-identifier-naming warning in qt client * Revert "chore: fix performance-enum-size warning in gtk client" This reverts commit 5ce6b562f849c2499fa34f4d903234f1945f9c3e. * fix: readability-redundant-member-init warning in move tests * fix: readability-redundant-casting warnings in tests * fixup! fix: readability-identifier-naming warning in qt client * fixup! fix: readability-avoid-nested-conditional-operator warning in qt client * fix: readability-static-accessed-through-instance warning in qt client * fix: readability-redundant-casting warning in watchdir tests --- gtk/.clang-tidy | 2 ++ gtk/DetailsDialog.cc | 2 +- gtk/DynamicPropertyStore.h | 2 +- gtk/FilterBar.cc | 4 +-- gtk/FilterListModel.hh | 15 +++++------ gtk/HigWorkarea.h | 8 +++--- gtk/MessageLogWindow.cc | 5 ++-- gtk/PrefsDialog.h | 4 +-- gtk/Session.cc | 3 +-- gtk/StatsDialog.cc | 2 +- gtk/Torrent.cc | 28 ++++++++++---------- gtk/Utils.h | 2 +- qt/Application.cc | 8 +++--- qt/DetailsDialog.cc | 9 ++----- qt/FileTreeItem.cc | 10 +++++-- qt/FileTreeView.cc | 6 +++++ qt/FilterBar.cc | 3 +++ qt/InteropObject.cc | 2 +- qt/MakeDialog.cc | 2 +- qt/Prefs.cc | 4 +-- qt/PrefsDialog.cc | 17 ++++++++++-- qt/Session.cc | 3 +++ qt/Torrent.cc | 3 +++ qt/TorrentFilter.cc | 3 +++ qt/TrackerDelegate.cc | 11 +++++--- qt/VariantHelpers.cc | 4 +-- tests/libtransmission/handshake-test.cc | 2 +- tests/libtransmission/move-test.cc | 4 +-- tests/libtransmission/torrent-magnet-test.cc | 2 +- tests/libtransmission/variant-test.cc | 6 ++--- tests/libtransmission/watchdir-test.cc | 2 +- 31 files changed, 106 insertions(+), 72 deletions(-) diff --git a/gtk/.clang-tidy b/gtk/.clang-tidy index 6ba3829d7..992b9fc14 100644 --- a/gtk/.clang-tidy +++ b/gtk/.clang-tidy @@ -7,6 +7,7 @@ Checks: > -bugprone-narrowing-conversions, cert-*, cppcoreguidelines-*, + -cppcoreguidelines-avoid-const-or-ref-data-members, -cppcoreguidelines-avoid-magic-numbers, -cppcoreguidelines-avoid-non-const-global-variables, -cppcoreguidelines-narrowing-conversions, @@ -20,6 +21,7 @@ Checks: > -readability-function-cognitive-complexity, -readability-identifier-length, -readability-magic-numbers, + -readability-qualified-auto, -readability-redundant-access-specifiers CheckOptions: diff --git a/gtk/DetailsDialog.cc b/gtk/DetailsDialog.cc index 7a08803db..684f0d054 100644 --- a/gtk/DetailsDialog.cc +++ b/gtk/DetailsDialog.cc @@ -1389,7 +1389,7 @@ void DetailsDialog::Impl::refreshPeerList(std::vector const& torren void DetailsDialog::Impl::refreshWebseedList(std::vector const& torrents) { - auto has_any_webseeds = bool{ false }; + auto has_any_webseeds = false; auto& hash = webseed_hash_; auto const& store = webseed_store_; diff --git a/gtk/DynamicPropertyStore.h b/gtk/DynamicPropertyStore.h index 26bd69b59..1c1fb02d0 100644 --- a/gtk/DynamicPropertyStore.h +++ b/gtk/DynamicPropertyStore.h @@ -80,7 +80,7 @@ public: } private: - PropertyInfo const& get_property(PropertyType index) const noexcept + [[nodiscard]] PropertyInfo const& get_property(PropertyType index) const noexcept { auto const id = static_cast(index); g_assert(id > 0); diff --git a/gtk/FilterBar.cc b/gtk/FilterBar.cc index b5a3ac6d9..ab11e5eed 100644 --- a/gtk/FilterBar.cc +++ b/gtk/FilterBar.cc @@ -32,8 +32,6 @@ #if GTKMM_CHECK_VERSION(4, 0, 0) #include -#else -#include #endif #include @@ -203,7 +201,7 @@ bool FilterBar::Impl::tracker_filter_model_update() /* Walk through all the torrents, tallying how many matches there are * for the various categories. Also make a sorted list of all tracker * hosts s.t. we can merge it with the existing list */ - auto n_torrents = int{ 0 }; + auto n_torrents = 0; auto site_infos = std::unordered_map{}; for (auto i = 0U, count = torrents_model->get_n_items(); i < count; ++i) { diff --git a/gtk/FilterListModel.hh b/gtk/FilterListModel.hh index 4c57aa285..751d1be81 100644 --- a/gtk/FilterListModel.hh +++ b/gtk/FilterListModel.hh @@ -30,6 +30,13 @@ FilterListModel::FilterListModel(Glib::RefPtr const& mode : Gtk::TreeModelFilter(model) , matches_all_(filter->matches_all()) , matches_none_(filter->matches_none()) + , signal_changed_tag_{ filter->signal_changed().connect( + [this, filter](auto /*changes*/) + { + matches_all_ = filter->matches_all(); + matches_none_ = filter->matches_none(); + refilter(); + }) } { static auto const& self_col = ItemT::get_columns().self; @@ -53,14 +60,6 @@ FilterListModel::FilterListModel(Glib::RefPtr const& mode set_visible_func(filter_func); - signal_changed_tag_ = filter->signal_changed().connect( - [this, filter](auto /*changes*/) - { - matches_all_ = filter->matches_all(); - matches_none_ = filter->matches_none(); - refilter(); - }); - signal_row_inserted().connect([this](auto const& path, auto const& /*iter*/) { signal_items_changed_.emit(path.front(), 0, 1); }); signal_row_deleted().connect([this](auto const& path) { signal_items_changed_.emit(path.front(), 1, 0); }); diff --git a/gtk/HigWorkarea.h b/gtk/HigWorkarea.h index 0ed34f5d5..bc287ecb5 100644 --- a/gtk/HigWorkarea.h +++ b/gtk/HigWorkarea.h @@ -5,7 +5,7 @@ #pragma once -auto inline constexpr GUI_PAD_SMALL = int{ 3 }; -auto inline constexpr GUI_PAD = int{ 6 }; -auto inline constexpr GUI_PAD_BIG = int{ 12 }; -auto inline constexpr GUI_PAD_LARGE = int{ 12 }; +auto inline constexpr GUI_PAD_SMALL = 3; +auto inline constexpr GUI_PAD = 6; +auto inline constexpr GUI_PAD_BIG = 12; +auto inline constexpr GUI_PAD_LARGE = 12; diff --git a/gtk/MessageLogWindow.cc b/gtk/MessageLogWindow.cc index 179dfc1a1..744a08b4e 100644 --- a/gtk/MessageLogWindow.cc +++ b/gtk/MessageLogWindow.cc @@ -80,7 +80,7 @@ private: void scroll_to_bottom(); void level_combo_changed_cb(Gtk::ComboBox* combo_box); - void level_combo_init(Gtk::ComboBox* level_combo) const; + static void level_combo_init(Gtk::ComboBox* level_combo); [[nodiscard]] bool is_pinned_to_new() const; [[nodiscard]] bool isRowVisible(Gtk::TreeModel::const_iterator const& iter) const; @@ -164,7 +164,8 @@ void MessageLogWindow::Impl::scroll_to_bottom() ***** ****/ -void MessageLogWindow::Impl::level_combo_init(Gtk::ComboBox* level_combo) const +// static +void MessageLogWindow::Impl::level_combo_init(Gtk::ComboBox* level_combo) { auto const pref_level = static_cast(gtr_pref_int_get(TR_KEY_message_level)); auto const default_level = TR_LOG_INFO; diff --git a/gtk/PrefsDialog.h b/gtk/PrefsDialog.h index c77f4a37c..d72d7796d 100644 --- a/gtk/PrefsDialog.h +++ b/gtk/PrefsDialog.h @@ -35,5 +35,5 @@ private: std::unique_ptr const impl_; }; -auto inline constexpr MAIN_WINDOW_REFRESH_INTERVAL_SECONDS = int{ 2 }; -auto inline constexpr SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS = int{ 2 }; +auto inline constexpr MAIN_WINDOW_REFRESH_INTERVAL_SECONDS = 2; +auto inline constexpr SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS = 2; diff --git a/gtk/Session.cc b/gtk/Session.cc index 809f6b842..60cee431d 100644 --- a/gtk/Session.cc +++ b/gtk/Session.cc @@ -846,8 +846,7 @@ bool Session::Impl::add_file(Glib::RefPtr const& file, bool do_start, else { tr_ctorFree(ctor); - std::cerr << fmt::format(_("Couldn't add torrent file '{path}'"), fmt::arg("path", file->get_parse_name())) - << std::endl; + std::cerr << fmt::format(_("Couldn't add torrent file '{path}'"), fmt::arg("path", file->get_parse_name())) << '\n'; } return handled; diff --git a/gtk/StatsDialog.cc b/gtk/StatsDialog.cc index 89d2bc688..83d7dd7ae 100644 --- a/gtk/StatsDialog.cc +++ b/gtk/StatsDialog.cc @@ -20,7 +20,7 @@ #include -static auto constexpr TR_RESPONSE_RESET = int{ 1 }; +static auto constexpr TR_RESPONSE_RESET = 1; class StatsDialog::Impl { diff --git a/gtk/Torrent.cc b/gtk/Torrent.cc index 5f1f92b9a..0994a8d42 100644 --- a/gtk/Torrent.cc +++ b/gtk/Torrent.cc @@ -140,15 +140,15 @@ public: std::string_view mime_type; - Storage have_unchecked = {}; - Storage have_valid = {}; - Storage left_until_done = {}; - Storage size_when_done = {}; - Storage total_size = {}; - Storage uploaded_ever = {}; + Storage have_unchecked; + Storage have_valid; + Storage left_until_done; + Storage size_when_done; + Storage total_size; + Storage uploaded_ever; - Speed speed_down = {}; - Speed speed_up = {}; + Speed speed_down; + Speed speed_up; size_t queue_position = {}; @@ -163,12 +163,12 @@ public: int active_peers_up = {}; int error_code = {}; - Percents activity_percent_done = {}; - Percents metadata_percent_complete = {}; - Percents percent_complete = {}; - Percents percent_done = {}; - Percents recheck_progress = {}; - Percents seed_ratio_percent_done = {}; + Percents activity_percent_done; + Percents metadata_percent_complete; + Percents percent_complete; + Percents percent_done; + Percents recheck_progress; + Percents seed_ratio_percent_done; uint16_t peers_connected = {}; uint16_t peers_getting_from_us = {}; diff --git a/gtk/Utils.h b/gtk/Utils.h index ec35ed256..dceae2dea 100644 --- a/gtk/Utils.h +++ b/gtk/Utils.h @@ -261,7 +261,7 @@ T* gtr_get_widget_derived(Glib::RefPtr const& builder, Glib::ustri template void gtr_window_on_close(Gtk::Window& widget, F&& callback) { - auto bool_callback = [callback = std::move(callback)]() mutable -> bool + auto bool_callback = [callback = std::forward(callback)]() mutable -> bool { if constexpr (std::is_same_v>) { diff --git a/qt/Application.cc b/qt/Application.cc index 657e75e4a..8f0dceb13 100644 --- a/qt/Application.cc +++ b/qt/Application.cc @@ -66,9 +66,9 @@ char const* getUsage() " transmission [OPTIONS...] [torrent files]"; } -auto constexpr StatsRefreshIntervalMsec = int{ 3000 }; -auto constexpr SessionRefreshIntervalMsec = int{ 3000 }; -auto constexpr ModelRefreshIntervalMsec = int{ 3000 }; +auto constexpr StatsRefreshIntervalMsec = 3000; +auto constexpr SessionRefreshIntervalMsec = 3000; +auto constexpr ModelRefreshIntervalMsec = 3000; bool loadTranslation(QTranslator& translator, QString const& name, QLocale const& locale, QStringList const& search_directories) { @@ -626,7 +626,7 @@ void Application::addWatchdirTorrent(QString const& filename) const void Application::addTorrent(AddData addme) const { - if (addme.type == addme.NONE) + if (addme.type == AddData::NONE) { return; } diff --git a/qt/DetailsDialog.cc b/qt/DetailsDialog.cc index 922f33218..6790dd72b 100644 --- a/qt/DetailsDialog.cc +++ b/qt/DetailsDialog.cc @@ -759,14 +759,9 @@ void DetailsDialog::refreshUI() { auto latest = torrents[0]->lastActivity(); - for (Torrent const* const t : torrents) + for (Torrent const* const tor : torrents) { - auto const dt = t->lastActivity(); - - if (latest < dt) - { - latest = dt; - } + latest = std::max(latest, tor->lastActivity()); } auto const seconds = static_cast(std::difftime(now, latest)); diff --git a/qt/FileTreeItem.cc b/qt/FileTreeItem.cc index 5cc874cbd..dee46b1b7 100644 --- a/qt/FileTreeItem.cc +++ b/qt/FileTreeItem.cc @@ -165,6 +165,9 @@ QVariant FileTreeItem::data(int column, int role) const } break; + + default: + break; } break; @@ -184,6 +187,9 @@ QVariant FileTreeItem::data(int column, int role) const } break; + + default: + break; } return value; @@ -191,8 +197,8 @@ QVariant FileTreeItem::data(int column, int role) const std::pair FileTreeItem::get_subtree_wanted_size() const { - auto have = uint64_t{ is_wanted_ ? have_size_ : 0U }; - auto total = uint64_t{ is_wanted_ ? total_size_ : 0U }; + auto have = is_wanted_ ? have_size_ : 0U; + auto total = is_wanted_ ? total_size_ : 0U; for (auto const* const child : children_) { diff --git a/qt/FileTreeView.cc b/qt/FileTreeView.cc index 5cb2af288..24881d501 100644 --- a/qt/FileTreeView.cc +++ b/qt/FileTreeView.cc @@ -110,6 +110,9 @@ void FileTreeView::resizeEvent(QResizeEvent* event) item_texts << FileTreeItem::tr("Low") << FileTreeItem::tr("Normal") << FileTreeItem::tr("High") << FileTreeItem::tr("Mixed"); break; + + default: + break; } int item_width = 0; @@ -407,6 +410,9 @@ Qt::CheckState FileTreeView::getCumulativeCheckState(QModelIndexList const& indi case Qt::PartiallyChecked: return Qt::PartiallyChecked; + + default: + break; } if (have_checked && have_unchecked) diff --git a/qt/FilterBar.cc b/qt/FilterBar.cc index f1952c215..9ae57a00f 100644 --- a/qt/FilterBar.cc +++ b/qt/FilterBar.cc @@ -309,6 +309,9 @@ void FilterBar::refreshPref(int key) break; } + + default: + break; } } diff --git a/qt/InteropObject.cc b/qt/InteropObject.cc index 3e9f43fb7..da4912dd6 100644 --- a/qt/InteropObject.cc +++ b/qt/InteropObject.cc @@ -22,7 +22,7 @@ bool InteropObject::PresentWindow() const // NOLINTNEXTLINE(readability-identifier-naming) bool InteropObject::AddMetainfo(QString const& metainfo) const { - if (auto addme = AddData(metainfo); addme.type != addme.NONE) + if (auto addme = AddData(metainfo); addme.type != AddData::NONE) { trApp->addTorrent(addme); } diff --git a/qt/MakeDialog.cc b/qt/MakeDialog.cc index 08a4ab9f2..ea398987e 100644 --- a/qt/MakeDialog.cc +++ b/qt/MakeDialog.cc @@ -111,7 +111,7 @@ void MakeProgressDialog::onProgress() } // progress bar - auto progress = int{ 100 }; // [0..100] + auto progress = 100; // [0..100] if (!is_done) { auto const [current, total] = builder_.checksum_status(); diff --git a/qt/Prefs.cc b/qt/Prefs.cc index 5a8436003..b8982dc34 100644 --- a/qt/Prefs.cc +++ b/qt/Prefs.cc @@ -201,7 +201,7 @@ bool isValidUtf8(QByteArray const& byteArray) #endif } -[[nodiscard]] constexpr auto pref_is_savable(int pref) +[[nodiscard]] constexpr auto prefIsSavable(int pref) { switch (pref) { @@ -332,7 +332,7 @@ Prefs::~Prefs() for (int i = 0; i < PREFS_COUNT; ++i) { - if (!pref_is_savable(i)) + if (!prefIsSavable(i)) { continue; } diff --git a/qt/PrefsDialog.cc b/qt/PrefsDialog.cc index e1b718771..e280d3e4b 100644 --- a/qt/PrefsDialog.cc +++ b/qt/PrefsDialog.cc @@ -83,7 +83,7 @@ public: } private: - QObject* const object_; + QObject* object_; }; char const* const PreferenceWidget::PrefKey = "pref-key"; @@ -470,12 +470,25 @@ void PrefsDialog::portTestSetEnabled() void PrefsDialog::onPortTested(std::optional result, Session::PortTestIpProtocol ip_protocol) { + constexpr auto StatusFromResult = [](const std::optional result) + { + if (!result) + { + return PORT_TEST_ERROR; + } + if (!*result) + { + return PORT_TEST_CLOSED; + } + return PORT_TEST_OPEN; + }; + // Only update the UI if the current status is "checking", so that // we won't show the port test results for the old peer port if it // changed while we have port-test RPC call(s) in-flight. if (port_test_status_[ip_protocol] == PORT_TEST_CHECKING) { - port_test_status_[ip_protocol] = result ? (*result ? PORT_TEST_OPEN : PORT_TEST_CLOSED) : PORT_TEST_ERROR; + port_test_status_[ip_protocol] = StatusFromResult(result); updatePortStatusLabel(); } portTestSetEnabled(); diff --git a/qt/Session.cc b/qt/Session.cc index b1c0bbffb..34398e62c 100644 --- a/qt/Session.cc +++ b/qt/Session.cc @@ -233,6 +233,9 @@ void Session::updatePref(int key) case 2: sessionSet(prefs_.getKey(key), QStringLiteral("required")); break; + + default: + break; } break; diff --git a/qt/Torrent.cc b/qt/Torrent.cc index 2ee887542..275aac380 100644 --- a/qt/Torrent.cc +++ b/qt/Torrent.cc @@ -283,6 +283,9 @@ Torrent::fields_t Torrent::update(tr_quark const* keys, tr_variant const* const* sitenames_ = std::vector{ std::begin(tmp), std::end(tmp) }; break; } + + default: + break; } } } diff --git a/qt/TorrentFilter.cc b/qt/TorrentFilter.cc index 06733528f..39966c2f5 100644 --- a/qt/TorrentFilter.cc +++ b/qt/TorrentFilter.cc @@ -52,6 +52,9 @@ void TorrentFilter::onPrefChanged(int key) case Prefs::SORT_REVERSED: msec = FastMSec; break; + + default: + break; } // if this pref change affects filtering, ensure that a refilter is queued diff --git a/qt/TrackerDelegate.cc b/qt/TrackerDelegate.cc index dda13bcbb..c2e771f12 100644 --- a/qt/TrackerDelegate.cc +++ b/qt/TrackerDelegate.cc @@ -24,7 +24,7 @@ namespace { -auto constexpr Spacing = int{ 6 }; +auto constexpr Spacing = 6; auto constexpr Margin = QSize{ 10, 10 }; @@ -257,6 +257,9 @@ QString TrackerDelegate::getText(TrackerInfo const& inf) const //: %1 is duration str += tr("Asking for more peers now… %1").arg(time_since(inf.st.last_announce_start_time)); break; + + default: + break; } if (!show_more_) @@ -305,9 +308,6 @@ QString TrackerDelegate::getText(TrackerInfo const& inf) const switch (inf.st.scrape_state) { - case TR_TRACKER_INACTIVE: - break; - case TR_TRACKER_WAITING: str += QStringLiteral("
\n"); //: %1 is duration @@ -324,6 +324,9 @@ QString TrackerDelegate::getText(TrackerInfo const& inf) const //: %1 is duration str += tr("Asking for peer counts now… %1").arg(time_since(inf.st.last_scrape_start_time)); break; + + default: // TR_TRACKER_INACTIVE + break; } } diff --git a/qt/VariantHelpers.cc b/qt/VariantHelpers.cc index aabf28a43..240ff6f6c 100644 --- a/qt/VariantHelpers.cc +++ b/qt/VariantHelpers.cc @@ -45,7 +45,7 @@ bool change(TorrentHash& setme, tr_variant const* value) bool change(Peer& setme, tr_variant const* value) { - auto changed = bool{ false }; + auto changed = false; auto pos = size_t{ 0 }; auto key = tr_quark{}; @@ -85,7 +85,7 @@ bool change(Peer& setme, tr_variant const* value) bool change(TorrentFile& setme, tr_variant const* value) { - auto changed = bool{ false }; + auto changed = false; auto pos = size_t{ 0 }; auto key = tr_quark{}; diff --git a/tests/libtransmission/handshake-test.cc b/tests/libtransmission/handshake-test.cc index f72c66b7a..cffcafa5b 100644 --- a/tests/libtransmission/handshake-test.cc +++ b/tests/libtransmission/handshake-test.cc @@ -52,7 +52,7 @@ using namespace std::literals; namespace libtransmission::test { -auto constexpr MaxWaitMsec = int{ 5000 }; +auto constexpr MaxWaitMsec = 5000; class HandshakeTest : public SessionTest { diff --git a/tests/libtransmission/move-test.cc b/tests/libtransmission/move-test.cc index a48e382ba..3a34f7eb2 100644 --- a/tests/libtransmission/move-test.cc +++ b/tests/libtransmission/move-test.cc @@ -81,7 +81,7 @@ TEST_P(IncompleteDirTest, incompleteDir) tr_torrent* tor = {}; tr_block_index_t block = {}; tr_piece_index_t pieceIndex = {}; - std::unique_ptr buf = {}; + std::unique_ptr buf; bool done = {}; }; @@ -165,7 +165,7 @@ TEST_F(MoveTest, setLocation) EXPECT_EQ(0, tr_torrentStat(tor)->leftUntilDone); // now move it - auto state = int{ -1 }; + auto state = -1; tr_torrentSetLocation(tor, target_dir, true, &state); auto test = [&state]() { diff --git a/tests/libtransmission/torrent-magnet-test.cc b/tests/libtransmission/torrent-magnet-test.cc index 100ffa19b..3a284f2d8 100644 --- a/tests/libtransmission/torrent-magnet-test.cc +++ b/tests/libtransmission/torrent-magnet-test.cc @@ -27,7 +27,7 @@ TEST_F(TorrentMagnetTest, getMetadataPiece) auto benc = std::string{ "d8:announce31:http://www.example.com/announce10:created by25:Transmission/2.61 (13407)13:creation datei1358704075e8:encoding5:UTF-84:info" }; - auto piece = int{ 0 }; + auto piece = 0; auto info_dict_size = size_t{ 0U }; for (;;) { diff --git a/tests/libtransmission/variant-test.cc b/tests/libtransmission/variant-test.cc index ff06d50ed..4021b961a 100644 --- a/tests/libtransmission/variant-test.cc +++ b/tests/libtransmission/variant-test.cc @@ -463,9 +463,9 @@ TEST_F(VariantTest, boolAndIntRecast) TEST_F(VariantTest, dictFindType) { auto constexpr ExpectedStr = "this-is-a-string"sv; - auto constexpr ExpectedBool = bool{ true }; - auto constexpr ExpectedInt = int{ 1234 }; - auto constexpr ExpectedReal = double{ 0.3 }; + auto constexpr ExpectedBool = true; + auto constexpr ExpectedInt = 1234; + auto constexpr ExpectedReal = 0.3; auto const key_bool = tr_quark_new("this-is-a-bool"sv); auto const key_real = tr_quark_new("this-is-a-real"sv); diff --git a/tests/libtransmission/watchdir-test.cc b/tests/libtransmission/watchdir-test.cc index a6b9775e6..269190e80 100644 --- a/tests/libtransmission/watchdir-test.cc +++ b/tests/libtransmission/watchdir-test.cc @@ -152,7 +152,7 @@ TEST_P(WatchDirTest, initialScan) // setup: start with an empty directory. // this block confirms that it's empty { - auto called = bool{ false }; + auto called = false; auto callback = [&called](std::string_view /*dirname*/, std::string_view /*basename*/) { called = true;