From c195fb5775fc15972bd2a908b4d8f62183ccdfd2 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Thu, 1 Oct 2015 14:12:05 +0100 Subject: [PATCH] Allow single line lambdas --- cpplint/cpplint.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index ccc25d4..23c7ed2 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -4459,6 +4459,9 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, 'Lines should be <= %i characters long' % _line_length) if (cleansed_line.count(';') > 1 and + # allow simple single line lambdas + not Match(r'^[^{};]*\[[^\[\]]*\][^{}]*\{[^{}\n\r]*\}', + line) and # for loops are allowed two ;'s (and may run over two lines). cleansed_line.find('for') == -1 and (GetPreviousNonBlankLine(clean_lines, linenum)[0].find('for') == -1 or