Skip to content
Snippets Groups Projects

[uncrustify] Reduce indentation of lambda code

Open 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

Pipeline #70841 passed

Pipeline passed for 9fa13091 on uncrustify-modify-lambda-formatting

Approval is optional
Ready to merge by members who can write to the target branch.

Merge details

  • The source branch is 175 commits behind the target branch.
  • 3 commits and 1 merge commit will be added to master.
  • Source branch will be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading