Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit 60b211b

Browse files
committed
Use sets instead of rewriting the logic
1 parent 24276e6 commit 60b211b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

highfive/newpr.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def get_to_mention(self, diff):
317317
dirs = self.repo_config.get('dirs', {})
318318
mentions = self.repo_config.get('mentions', {})
319319

320-
to_mention = []
320+
to_mention = set()
321321
# If there's directories with specially assigned groups/users
322322
# inspect the diff to find the directory with the most additions
323323
if dirs:
@@ -339,11 +339,10 @@ def get_to_mention(self, diff):
339339
cur_dir = None
340340
if len(full_dir) > 0:
341341
for entry in mentions:
342-
if full_dir.startswith(entry) and entry not in to_mention:
343-
to_mention.append(entry)
344-
elif (entry.endswith('.rs') and full_dir.endswith(entry)
345-
and entry not in to_mention):
346-
to_mention.append(entry)
342+
if full_dir.startswith(entry):
343+
to_mention.add(entry)
344+
elif entry.endswith('.rs') and full_dir.endswith(entry):
345+
to_mention.add(entry)
347346

348347
mention_list = []
349348
for mention in to_mention:

0 commit comments

Comments
 (0)