Skip to content
Snippets Groups Projects

[uncrustify] Reduce indentation of lambda code

Open Oliver Sander requested to merge uncrustify-modify-lambda-formatting into master
  1. May 19, 2024
    • Oliver Sander's avatar
      [uncrustify] Reduce indentation of lambda code · 9fa13091
      Oliver Sander authored
      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.
      9fa13091
Loading