From 120b2fb6a02ca9411f9fc7a384a4a2cc15bdb112 Mon Sep 17 00:00:00 2001 From: Yat Ho Date: Tue, 13 Aug 2024 07:44:39 +0800 Subject: [PATCH] chore: misc formatting updates and fixes (#7049) * chore: remove redundant `.clang-format` entry for `TR_DEFINE_QUARK` Left-over from bf41e1487ad14fdd11f5717f75138abd219b71be. * chore: remove redundant `.clang-format` entry for `API_HEADER_*` Left-over from f7edcfcb2a608161dd8e6c8063a4bfb99a4df0e2. * chore: drop deprecated options in favour of `PackConstructorInitializers` * fix: invalid `SpacesInAngles` value * chore: add comment to forecast a change we need to make in the future * chore: add trailing comma to prettify lambda --- .clang-format | 12 +++--------- libtransmission/announcer-udp.cc | 9 ++++----- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.clang-format b/.clang-format index 0b171d76e..cf00c631a 100644 --- a/.clang-format +++ b/.clang-format @@ -35,7 +35,7 @@ ReflowComments: false SortIncludes: Never SpaceAfterCStyleCast: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: false +SpacesInAngles: Never SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false @@ -46,24 +46,18 @@ Language: Cpp Standard: c++17 AccessModifierOffset: -4 -AllowAllConstructorInitializersOnNextLine: false +PackConstructorInitializers: Never AlwaysBreakAfterReturnType: None AlwaysBreakTemplateDeclarations: Yes BreakConstructorInitializers: BeforeComma BreakInheritanceList: BeforeComma -ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 FixNamespaceComments: true IndentGotoLabels: false KeepEmptyLinesAtTheStartOfBlocks: false QualifierAlignment: Right -SortUsingDeclarations: true +SortUsingDeclarations: true # Since clang-format 16, the equivalent value is LexicographicNumeric SpaceAfterTemplateKeyword: false -StatementMacros: -- TR_DEFINE_QUARK -WhitespaceSensitiveMacros: -- API_HEADER -- API_HEADER_CRYPT --- Language: ObjC diff --git a/libtransmission/announcer-udp.cc b/libtransmission/announcer-udp.cc index bd224fa15..2e09b4a67 100644 --- a/libtransmission/announcer-udp.cc +++ b/libtransmission/announcer-udp.cc @@ -512,11 +512,10 @@ private: fmt::arg("error_code", static_cast(rc)))); return {}; } - auto const info_uniq = std::unique_ptr{ info, - [](addrinfo* p) // MSVC forced my hands - { - freeaddrinfo(p); - } }; + auto const info_uniq = std::unique_ptr{ + info, + [](addrinfo* p) { freeaddrinfo(p); }, // MSVC forced me to write this lambda wrapper + }; // N.B. getaddrinfo() will return IPv4-mapped addresses by default on macOS auto socket_address = tr_socket_address::from_sockaddr(info->ai_addr);