Skip to content

Commit fd81385

Browse files
committed
"using namespace std::placeholders;" should also be valid
1 parent 067fbd5 commit fd81385

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

wpiformat/test/test_usingnamespacestd.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ def test_usingnamespacestd():
5151
"using namespace std::chrono_literals;" + os.linesep))
5252
outputs.append(("", False, True))
5353

54+
# Ignore std::placeholders
55+
inputs.append(("./Main.cpp",
56+
"using namespace std::placeholders;" + os.linesep))
57+
outputs.append(("", False, True))
58+
5459
assert len(inputs) == len(outputs)
5560

5661
config_file = Config(os.path.abspath(os.getcwd()), ".styleguide")

wpiformat/wpiformat/usingnamespacestd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def run_pipeline(self, config_file, name, lines):
1616
# Find instances of "using namespace std;" or subnamespaces of "std",
1717
# but not std::literals or std::chrono_literals.
1818
regex = re.compile(
19-
"using\s+namespace\s+std(;|::(?!(chrono_)?literals))")
19+
"using\s+namespace\s+std(;|::(?!(chrono_)?literals|placeholders))")
2020

2121
for match in re.finditer(regex, lines):
2222
linenum = lines.count(linesep, 0, match.start()) + 1

0 commit comments

Comments
 (0)