[clang] 231fc00 - [clang-format][docs][NFC] Fix invalid syntax in ShortLambdaStyle examples.
Emilia Dreamer via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 10 11:16:30 PDT 2022
Author: Emilia Dreamer
Date: 2022-10-10T21:13:07+03:00
New Revision: 231fc00cebc127badb6df6e8902727e893335a58
URL: https://github.com/llvm/llvm-project/commit/231fc00cebc127badb6df6e8902727e893335a58
DIFF: https://github.com/llvm/llvm-project/commit/231fc00cebc127badb6df6e8902727e893335a58.diff
LOG: [clang-format][docs][NFC] Fix invalid syntax in ShortLambdaStyle examples.
Added:
Modified:
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h
Removed:
################################################################################
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index ec53c3eef8540..cdbc23ae43eb8 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1111,7 +1111,7 @@ the configuration (without a prefix: ``Auto``).
.. code-block:: c++
- auto lambda = [](int a) {}
+ auto lambda = [](int a) {};
auto lambda2 = [](int a) {
return a;
};
@@ -1124,14 +1124,14 @@ the configuration (without a prefix: ``Auto``).
auto lambda = [](int a) {
return a;
};
- sort(a.begin(), a.end(), ()[] { return x < y; })
+ sort(a.begin(), a.end(), []() { return x < y; });
* ``SLS_All`` (in configuration: ``All``)
Merge all lambdas fitting on a single line.
.. code-block:: c++
- auto lambda = [](int a) {}
+ auto lambda = [](int a) {};
auto lambda2 = [](int a) { return a; };
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index ee1863a63bc9a..7c1721064727c 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -610,7 +610,7 @@ struct FormatStyle {
SLS_None,
/// Only merge empty lambdas.
/// \code
- /// auto lambda = [](int a) {}
+ /// auto lambda = [](int a) {};
/// auto lambda2 = [](int a) {
/// return a;
/// };
@@ -621,12 +621,12 @@ struct FormatStyle {
/// auto lambda = [](int a) {
/// return a;
/// };
- /// sort(a.begin(), a.end(), ()[] { return x < y; })
+ /// sort(a.begin(), a.end(), []() { return x < y; });
/// \endcode
SLS_Inline,
/// Merge all lambdas fitting on a single line.
/// \code
- /// auto lambda = [](int a) {}
+ /// auto lambda = [](int a) {};
/// auto lambda2 = [](int a) { return a; };
/// \endcode
SLS_All,
More information about the cfe-commits
mailing list