Skip to content

Commit 65c6310

Browse files
author
bberger
committed
Inline .ToSet() method.
I initially added .ToSet() to EnumerableExtensions.cs, not realizing it was a paket file and thus not directly editable in this repo.
1 parent ddc6465 commit 65c6310

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/CommandLine/Core/TokenPartitioner.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,16 @@ namespace CommandLine.Core
1111
static class TokenPartitioner
1212
{
1313
public static
14-
Tuple<
15-
IEnumerable<KeyValuePair<string, IEnumerable<string>>>, // options
16-
IEnumerable<string>, // values
17-
IEnumerable<Token> // errors
18-
> Partition(
14+
Tuple<IEnumerable<KeyValuePair<string, IEnumerable<string>>>, IEnumerable<string>, IEnumerable<Token>> Partition(
1915
IEnumerable<Token> tokens,
2016
Func<string, Maybe<TypeDescriptor>> typeLookup)
2117
{
2218
IEqualityComparer<Token> tokenComparer = ReferenceEqualityComparer.Default;
2319

2420
var tokenList = tokens.Memorize();
25-
var switches = Switch.Partition(tokenList, typeLookup).ToSet(tokenComparer);
26-
var scalars = Scalar.Partition(tokenList, typeLookup).ToSet(tokenComparer);
27-
var sequences = Sequence.Partition(tokenList, typeLookup).ToSet(tokenComparer);
21+
var switches = new HashSet<Token>(Switch.Partition(tokenList, typeLookup), tokenComparer);
22+
var scalars = new HashSet<Token>(Scalar.Partition(tokenList, typeLookup), tokenComparer);
23+
var sequences = new HashSet<Token>(Sequence.Partition(tokenList, typeLookup), tokenComparer);
2824
var nonOptions = tokenList
2925
.Where(t => !switches.Contains(t))
3026
.Where(t => !scalars.Contains(t))

0 commit comments

Comments
 (0)