Skip to content

[uncrustify] Reduce indentation of lambda code

Oliver Sander requested to merge uncrustify-modify-lambda-formatting into master

With the current dune-uncrustify.cfg configuration file, the code of a lambda definition gets indented a lot. Here is an example from dune-fufem:

  auto splitIndex = [] (auto&& multiIndex) {
                      return std::make_tuple(multiIndex[_0], shiftedDynamicMultiIndex<1>(multiIndex)) ;
                    };

To me this looks strange. It is a matter of taste, of course, but more likely we simply didn't have any lambdas in the code back when Steffen wrote the uncrustify configuration file.

uncrustify has the option 'indent_cpp_lambda_only_once', and with this option set, the code looks like this:

  auto splitIndex = [] (auto&& multiIndex) {
    return std::make_tuple(multiIndex[_0], shiftedDynamicMultiIndex<1>(multiIndex)) ;
  };

This patch adds said option to the dune-uncrustify.cfg configuration file.

Merge request reports

Loading