Cleanup of clang-tidy findings: removing "else" after a return statement
to improve readability of the code.
This patch was created by applying the clang-tidy fixes automatically.
Paths
| Differential D113892
[NFC][clangd] cleanup llvm-else-after-return findings ClosedPublic Authored by kuhnel on Nov 15 2021, 7:01 AM.
Details Summary Cleanup of clang-tidy findings: removing "else" after a return statement This patch was created by applying the clang-tidy fixes automatically.
Diff Detail
Event TimelineHerald added subscribers: carlosgalvezp, usaxena95, kadircet and 2 others. · View Herald TranscriptNov 15 2021, 7:01 AM Comment Actions Mostly looks good. There's a bunch of ifs that are now trivial (condition and body each fit on one line, no else) and we'd usually drop braces there, but it's probably not worth the hassle. I have to say that this rule slightly improves "early exit after error condition" type code, but makes it less clear that "there are 3 cases" type code is exhaustive.
Comment Actions Discussed offline, I believe the plan is to NOLINT the locations where we're handling several cases exhaustively.
This revision is now accepted and ready to land.Nov 16 2021, 5:24 AM kuhnel marked 4 inline comments as done. Comment Actionsaddressed Sam's comments Sorry for the continued mess with automatic code formatting. Somehow VSCode forgot my settings :( Closed by commit rGec4a2c956591: [NFC][clangd] cleanup llvm-else-after-return findings (authored by kuhnel). · Explain WhyNov 17 2021, 6:37 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 387930 clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/FuzzyMatch.cpp
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/JSONTransport.cpp
clang-tools-extra/clangd/PathMapping.cpp
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/clangd/Selection.cpp
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/index/Serialization.cpp
clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
|
This seems inconsistent: we're elseing after continue.
If we've using this style, i'd invert the if here so the "continue" case just falls off the end of the loop body. (But keep the comment)