From 8c3cc2c1f4bfe28260e4affe6cf1c5886bd9e74c Mon Sep 17 00:00:00 2001 From: Michael Kazakov Date: Fri, 27 Dec 2024 12:21:03 +0000 Subject: [PATCH] clang-tidy --- .../Core/ActionsShortcutsManager.mm | 2 +- .../Tests/ActionsShortcutsManager_UT.cpp | 20 +++++++++---------- Source/Utility/source/ActionShortcut.mm | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Source/NimbleCommander/NimbleCommander/Core/ActionsShortcutsManager.mm b/Source/NimbleCommander/NimbleCommander/Core/ActionsShortcutsManager.mm index 24ff27fea..276da3096 100644 --- a/Source/NimbleCommander/NimbleCommander/Core/ActionsShortcutsManager.mm +++ b/Source/NimbleCommander/NimbleCommander/Core/ActionsShortcutsManager.mm @@ -764,7 +764,7 @@ static constexpr auto make_array_n(T &&value) { m_ShortcutsUsage.clear(); // build the map means starting from scratch - for( const auto [tag, default_shortcuts] : m_ShortcutsDefaults ) { + for( const auto &[tag, default_shortcuts] : m_ShortcutsDefaults ) { if( const auto it = m_ShortcutsOverrides.find(tag); it != m_ShortcutsOverrides.end() ) { for( const Shortcut &shortcut : it->second ) { if( shortcut ) diff --git a/Source/NimbleCommander/NimbleCommander/Tests/ActionsShortcutsManager_UT.cpp b/Source/NimbleCommander/NimbleCommander/Tests/ActionsShortcutsManager_UT.cpp index 3b2909bd5..d4fd6ce47 100644 --- a/Source/NimbleCommander/NimbleCommander/Tests/ActionsShortcutsManager_UT.cpp +++ b/Source/NimbleCommander/NimbleCommander/Tests/ActionsShortcutsManager_UT.cpp @@ -202,7 +202,7 @@ TEST_CASE(PREFIX "Configuration persistence") } })"; ConfigImpl config{json, std::make_shared("")}; - ASM manager{config}; + const ASM manager{config}; REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{}); } SECTION("Loading from config - single override") @@ -213,7 +213,7 @@ TEST_CASE(PREFIX "Configuration persistence") } })"; ConfigImpl config{json, std::make_shared("")}; - ASM manager{config}; + const ASM manager{config}; REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{AS("⌘j")}); } SECTION("Loading from config - single empty array") @@ -224,7 +224,7 @@ TEST_CASE(PREFIX "Configuration persistence") } })"; ConfigImpl config{json, std::make_shared("")}; - ASM manager{config}; + const ASM manager{config}; REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{}); } SECTION("Loading from config - single array with one shortcut") @@ -235,7 +235,7 @@ TEST_CASE(PREFIX "Configuration persistence") } })"; ConfigImpl config{json, std::make_shared("")}; - ASM manager{config}; + const ASM manager{config}; REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{AS("⌘j")}); } SECTION("Loading from config - single array with two shortcuts") @@ -246,7 +246,7 @@ TEST_CASE(PREFIX "Configuration persistence") } })"; ConfigImpl config{json, std::make_shared("")}; - ASM manager{config}; + const ASM manager{config}; REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{AS("⌘j"), AS("⌘k")}); } SECTION("Loading from config - mixed usage") @@ -258,7 +258,7 @@ TEST_CASE(PREFIX "Configuration persistence") } })"; ConfigImpl config{json, std::make_shared("")}; - ASM manager{config}; + const ASM manager{config}; REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{AS("⌘j"), AS("⌘k")}); REQUIRE(manager.ShortcutsFromAction("menu.window.zoom") == ASs{AS("⇧^⌘⌥j")}); } @@ -272,7 +272,7 @@ TEST_CASE(PREFIX "Configuration persistence") "menu.edit.copy": "" } })"; - ConfigImpl expected_config{expected_json, std::make_shared("")}; + const ConfigImpl expected_config{expected_json, std::make_shared("")}; REQUIRE(config.Get("hotkeyOverrides_v1") == expected_config.Get("hotkeyOverrides_v1")); } SECTION("Writing to config - single override") @@ -285,7 +285,7 @@ TEST_CASE(PREFIX "Configuration persistence") "menu.edit.copy": "⌘j" } })"; - ConfigImpl expected_config{expected_json, std::make_shared("")}; + const ConfigImpl expected_config{expected_json, std::make_shared("")}; REQUIRE(config.Get("hotkeyOverrides_v1") == expected_config.Get("hotkeyOverrides_v1")); } SECTION("Writing to config - single override with two hotkeys ") @@ -298,7 +298,7 @@ TEST_CASE(PREFIX "Configuration persistence") "menu.edit.copy": ["⌘j", "⌘k"] } })"; - ConfigImpl expected_config{expected_json, std::make_shared("")}; + const ConfigImpl expected_config{expected_json, std::make_shared("")}; REQUIRE(config.Get("hotkeyOverrides_v1") == expected_config.Get("hotkeyOverrides_v1")); } SECTION("Writing to config - mixed usage") @@ -313,7 +313,7 @@ TEST_CASE(PREFIX "Configuration persistence") "menu.window.zoom": "⇧^⌥⌘j" } })"; - ConfigImpl expected_config{expected_json, std::make_shared("")}; + const ConfigImpl expected_config{expected_json, std::make_shared("")}; REQUIRE(config.Get("hotkeyOverrides_v1") == expected_config.Get("hotkeyOverrides_v1")); } } diff --git a/Source/Utility/source/ActionShortcut.mm b/Source/Utility/source/ActionShortcut.mm index 908422f8b..77cb3683f 100644 --- a/Source/Utility/source/ActionShortcut.mm +++ b/Source/Utility/source/ActionShortcut.mm @@ -110,13 +110,13 @@ { std::string result; if( modifiers & NSEventModifierFlagShift ) - result += reinterpret_cast(u8"⇧"); + result += "⇧"; if( modifiers & NSEventModifierFlagControl ) - result += reinterpret_cast(u8"^"); + result += "^"; if( modifiers & NSEventModifierFlagOption ) - result += reinterpret_cast(u8"⌥"); + result += "⌥"; if( modifiers & NSEventModifierFlagCommand ) - result += reinterpret_cast(u8"⌘"); + result += "⌘"; if( unicode == '\r' ) result += "\\r";