Skip to content

Commit 5618b2d

Browse files
Clean up files a bit (#1790)
* Remove unnecessary using statements * Simplify to new(...) * Minor Fixes
1 parent a1958c0 commit 5618b2d

File tree

76 files changed

+101
-154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+101
-154
lines changed

src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.CommandLine.Hosting;
55
using System.CommandLine.NamingConventionBinder;
6-
using System.CommandLine.Parsing;
76
using ApprovalTests;
87
using ApprovalTests.Reporters;
98
using Xunit;

src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Directives_Suggest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System.CommandLine.Benchmarks.Helpers;
5-
using System.CommandLine.Invocation;
65
using System.CommandLine.Parsing;
76
using System.Threading.Tasks;
87
using BenchmarkDotNet.Attributes;

src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_NestedCommands.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System.CommandLine.Parsing;
5-
using System.Linq;
65
using BenchmarkDotNet.Attributes;
76

87
namespace System.CommandLine.Benchmarks.CommandLine
@@ -40,7 +39,7 @@ private void GenerateTestNestedCommands(Command parent, int depth, int countPerL
4039
for (int i = 0; i < countPerLevel; i++)
4140
{
4241
string cmdName = $"{parent.Name}_{depth}.{i}";
43-
Command cmd = new Command(cmdName);
42+
Command cmd = new(cmdName);
4443
parent.AddCommand(cmd);
4544
GenerateTestNestedCommands(cmd, depth - 1, countPerLevel);
4645
}
@@ -73,7 +72,7 @@ public void SetupParser()
7372
}
7473

7574
[Benchmark]
76-
public Parser ParserFromNestedCommands_Ctor() => new Parser(_rootCommand);
75+
public Parser ParserFromNestedCommands_Ctor() => new(_rootCommand);
7776

7877
[Benchmark]
7978
public ParseResult Parser_Parse() => _testParser.Parse(_testSymbolsAsString);

src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using BenchmarkDotNet.Attributes;
2-
using System.CommandLine.Invocation;
32
using System.CommandLine.Parsing;
43
using System.Threading.Tasks;
54

@@ -25,10 +24,10 @@ public class Perf_Parser_Simple
2524

2625
private static RootCommand BuildCommand()
2726
{
28-
Option<bool> boolOption = new Option<bool>(new[] { "--bool", "-b" }, "Bool option");
29-
Option<string> stringOption = new Option<string>(new[] { "--string", "-s" }, "String option");
27+
Option<bool> boolOption = new(new[] { "--bool", "-b" }, "Bool option");
28+
Option<string> stringOption = new(new[] { "--string", "-s" }, "String option");
3029

31-
RootCommand command = new RootCommand
30+
RootCommand command = new()
3231
{
3332
boolOption,
3433
stringOption

src/System.CommandLine.Benchmarks/CommandLine/Perf_Suggestions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System.Collections.Generic;
5-
using System.CommandLine.Parsing;
65
using System.Linq;
76
using BenchmarkDotNet.Attributes;
87
using BenchmarkDotNet.Engines;

src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_EntryPoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace System.CommandLine.Benchmarks.DragonFruit
2020
[InvocationCount(3000)]
2121
public class Perf_CommandLine_EntryPoint
2222
{
23-
private readonly NullConsole _nullConsole = new NullConsole();
23+
private readonly NullConsole _nullConsole = new();
2424
private Assembly _testAssembly;
2525
private string _testAssemblyFilePath;
2626
private string _testAssemblyXmlDocsFilePath;

src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace System.CommandLine.Benchmarks.DragonFruit
1717
[InvocationCount(3000)]
1818
public class Perf_CommandLine_Help
1919
{
20-
private readonly NullConsole _nullConsole = new NullConsole();
20+
private readonly NullConsole _nullConsole = new();
2121
private Assembly _testAssembly;
2222
private string _testAssemblyFilePath;
2323
private string _testAssemblyXmlDocsFilePath;

src/System.CommandLine.Benchmarks/Helpers/NullConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace System.CommandLine.Benchmarks.Helpers
77
{
88
class NullConsole : IConsole
99
{
10-
readonly NullStreamWriter _nullWriter = new NullStreamWriter();
10+
readonly NullStreamWriter _nullWriter = new();
1111

1212
public IStandardStreamWriter Out => _nullWriter;
1313
public IStandardStreamWriter Error => _nullWriter;

src/System.CommandLine.Benchmarks/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright (c) .NET Foundation and contributors. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
using System.Collections.Immutable;
5-
using System.IO;
64
using BenchmarkDotNet.Running;
75
using System.Linq;
86
using BenchmarkDotNet.Configs;
7+
using System.Collections.Immutable;
8+
using System.IO;
99

1010
namespace System.CommandLine.Benchmarks
1111
{

src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System.CommandLine.Rendering;
5-
using System.ComponentModel;
65
using System.Threading.Tasks;
76
using FluentAssertions;
87
using Xunit;

0 commit comments

Comments
 (0)