Skip to content

Commit 4980cbb

Browse files
committed
Replace foreach filter with LINQ Any in HasAmbientCommandPrefix
1 parent f077cac commit 4980cbb

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/Repl.Core/CoreReplApp.Interactive.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,15 +1621,8 @@ private bool HasAmbientCommandPrefix(string token, StringComparison comparison)
16211621
return true;
16221622
}
16231623

1624-
foreach (var name in _options.AmbientCommands.CustomCommands.Keys)
1625-
{
1626-
if (name.StartsWith(token, comparison))
1627-
{
1628-
return true;
1629-
}
1630-
}
1631-
1632-
return false;
1624+
return _options.AmbientCommands.CustomCommands.Keys
1625+
.Any(name => name.StartsWith(token, comparison));
16331626
}
16341627

16351628
private static bool TryClassifyTemplateSegment(

0 commit comments

Comments
 (0)