diff --git a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.cs b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.cs index 9f7aeda005..b413bf2120 100644 --- a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.cs +++ b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.cs @@ -3,7 +3,6 @@ using System.CommandLine.Hosting; using System.CommandLine.NamingConventionBinder; -using System.CommandLine.Parsing; using ApprovalTests; using ApprovalTests.Reporters; using Xunit; diff --git a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Directives_Suggest.cs b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Directives_Suggest.cs index f7cb9c8e45..0b0477754d 100644 --- a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Directives_Suggest.cs +++ b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Directives_Suggest.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.CommandLine.Benchmarks.Helpers; -using System.CommandLine.Invocation; using System.CommandLine.Parsing; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; diff --git a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_NestedCommands.cs b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_NestedCommands.cs index eb4adb8806..5f495c264d 100644 --- a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_NestedCommands.cs +++ b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_NestedCommands.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.CommandLine.Parsing; -using System.Linq; using BenchmarkDotNet.Attributes; namespace System.CommandLine.Benchmarks.CommandLine @@ -40,7 +39,7 @@ private void GenerateTestNestedCommands(Command parent, int depth, int countPerL for (int i = 0; i < countPerLevel; i++) { string cmdName = $"{parent.Name}_{depth}.{i}"; - Command cmd = new Command(cmdName); + Command cmd = new(cmdName); parent.AddCommand(cmd); GenerateTestNestedCommands(cmd, depth - 1, countPerLevel); } @@ -73,7 +72,7 @@ public void SetupParser() } [Benchmark] - public Parser ParserFromNestedCommands_Ctor() => new Parser(_rootCommand); + public Parser ParserFromNestedCommands_Ctor() => new(_rootCommand); [Benchmark] public ParseResult Parser_Parse() => _testParser.Parse(_testSymbolsAsString); diff --git a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs index 8fd8d8fdbc..38a51da411 100644 --- a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs +++ b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs @@ -1,5 +1,4 @@ using BenchmarkDotNet.Attributes; -using System.CommandLine.Invocation; using System.CommandLine.Parsing; using System.Threading.Tasks; @@ -25,10 +24,10 @@ public class Perf_Parser_Simple private static RootCommand BuildCommand() { - Option boolOption = new Option(new[] { "--bool", "-b" }, "Bool option"); - Option stringOption = new Option(new[] { "--string", "-s" }, "String option"); + Option boolOption = new(new[] { "--bool", "-b" }, "Bool option"); + Option stringOption = new(new[] { "--string", "-s" }, "String option"); - RootCommand command = new RootCommand + RootCommand command = new() { boolOption, stringOption diff --git a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Suggestions.cs b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Suggestions.cs index 191260da57..2ea50046c7 100644 --- a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Suggestions.cs +++ b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Suggestions.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.CommandLine.Parsing; using System.Linq; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Engines; diff --git a/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_EntryPoint.cs b/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_EntryPoint.cs index 9a0df89250..df53f13f54 100644 --- a/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_EntryPoint.cs +++ b/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_EntryPoint.cs @@ -20,7 +20,7 @@ namespace System.CommandLine.Benchmarks.DragonFruit [InvocationCount(3000)] public class Perf_CommandLine_EntryPoint { - private readonly NullConsole _nullConsole = new NullConsole(); + private readonly NullConsole _nullConsole = new(); private Assembly _testAssembly; private string _testAssemblyFilePath; private string _testAssemblyXmlDocsFilePath; diff --git a/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs b/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs index 6a516aebd7..0bf9d23e9e 100644 --- a/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs +++ b/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs @@ -17,7 +17,7 @@ namespace System.CommandLine.Benchmarks.DragonFruit [InvocationCount(3000)] public class Perf_CommandLine_Help { - private readonly NullConsole _nullConsole = new NullConsole(); + private readonly NullConsole _nullConsole = new(); private Assembly _testAssembly; private string _testAssemblyFilePath; private string _testAssemblyXmlDocsFilePath; diff --git a/src/System.CommandLine.Benchmarks/Helpers/NullConsole.cs b/src/System.CommandLine.Benchmarks/Helpers/NullConsole.cs index efae246c9d..40905974d7 100644 --- a/src/System.CommandLine.Benchmarks/Helpers/NullConsole.cs +++ b/src/System.CommandLine.Benchmarks/Helpers/NullConsole.cs @@ -7,7 +7,7 @@ namespace System.CommandLine.Benchmarks.Helpers { class NullConsole : IConsole { - readonly NullStreamWriter _nullWriter = new NullStreamWriter(); + readonly NullStreamWriter _nullWriter = new(); public IStandardStreamWriter Out => _nullWriter; public IStandardStreamWriter Error => _nullWriter; diff --git a/src/System.CommandLine.Benchmarks/Program.cs b/src/System.CommandLine.Benchmarks/Program.cs index 8a5f376bcd..9b0a5a61f8 100644 --- a/src/System.CommandLine.Benchmarks/Program.cs +++ b/src/System.CommandLine.Benchmarks/Program.cs @@ -1,11 +1,11 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.Collections.Immutable; -using System.IO; using BenchmarkDotNet.Running; using System.Linq; using BenchmarkDotNet.Configs; +using System.Collections.Immutable; +using System.IO; namespace System.CommandLine.Benchmarks { diff --git a/src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs b/src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs index 369dba0a70..7bc9dac397 100644 --- a/src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs +++ b/src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.CommandLine.Rendering; -using System.ComponentModel; using System.Threading.Tasks; using FluentAssertions; using Xunit; diff --git a/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs b/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs index 2fb4e28bf5..fd9544b876 100644 --- a/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs +++ b/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs @@ -20,7 +20,7 @@ namespace System.CommandLine.DragonFruit.Tests public class ConfigureFromMethodTests { private object[] _receivedValues; - private readonly TestConsole _testConsole = new TestConsole(); + private readonly TestConsole _testConsole = new(); [Fact] public async Task Generated_boolean_parameters_will_accept_zero_arguments() diff --git a/src/System.CommandLine.DragonFruit.Tests/XmlDocReaderTests.cs b/src/System.CommandLine.DragonFruit.Tests/XmlDocReaderTests.cs index 54369d864e..17a4680380 100644 --- a/src/System.CommandLine.DragonFruit.Tests/XmlDocReaderTests.cs +++ b/src/System.CommandLine.DragonFruit.Tests/XmlDocReaderTests.cs @@ -3,7 +3,6 @@ using System.IO; using FluentAssertions; -using System.Linq; using Xunit; namespace System.CommandLine.DragonFruit.Tests diff --git a/src/System.CommandLine.Generator.Tests/GeneratedCommandHandlerTests.cs b/src/System.CommandLine.Generator.Tests/GeneratedCommandHandlerTests.cs index bd23d102f2..187e605e79 100644 --- a/src/System.CommandLine.Generator.Tests/GeneratedCommandHandlerTests.cs +++ b/src/System.CommandLine.Generator.Tests/GeneratedCommandHandlerTests.cs @@ -5,7 +5,6 @@ using System.CommandLine.Help; using System.CommandLine.Invocation; using System.CommandLine.IO; -using System.CommandLine.Parsing; using System.Threading.Tasks; using FluentAssertions; using Xunit; diff --git a/src/System.CommandLine.Hosting.Tests/HostingHandlerTest.cs b/src/System.CommandLine.Hosting.Tests/HostingHandlerTest.cs index cef84ca985..a087097f3c 100644 --- a/src/System.CommandLine.Hosting.Tests/HostingHandlerTest.cs +++ b/src/System.CommandLine.Hosting.Tests/HostingHandlerTest.cs @@ -1,16 +1,10 @@ using System.CommandLine; -using System.CommandLine.Binding; using System.CommandLine.Invocation; -using System.CommandLine.IO; using System.CommandLine.Parsing; -using System.Linq; using System.Threading.Tasks; using FluentAssertions; - -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Options; using Xunit; diff --git a/src/System.CommandLine.Hosting/DirectiveConfigurationExtensions.cs b/src/System.CommandLine.Hosting/DirectiveConfigurationExtensions.cs index 1cddf42041..638bd6939e 100644 --- a/src/System.CommandLine.Hosting/DirectiveConfigurationExtensions.cs +++ b/src/System.CommandLine.Hosting/DirectiveConfigurationExtensions.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.CommandLine.Parsing; using System.Linq; using Microsoft.Extensions.Configuration; diff --git a/src/System.CommandLine.NamingConventionBinder.Tests/HandlerDescriptorTests.cs b/src/System.CommandLine.NamingConventionBinder.Tests/HandlerDescriptorTests.cs index 700a3ae53d..b004d16203 100644 --- a/src/System.CommandLine.NamingConventionBinder.Tests/HandlerDescriptorTests.cs +++ b/src/System.CommandLine.NamingConventionBinder.Tests/HandlerDescriptorTests.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.CommandLine.Binding; using System.CommandLine.Tests.Utility; using System.IO; using System.Linq; diff --git a/src/System.CommandLine.NamingConventionBinder.Tests/ModelDescriptorTests.cs b/src/System.CommandLine.NamingConventionBinder.Tests/ModelDescriptorTests.cs index 9e2a8bfa83..4b99776e6c 100644 --- a/src/System.CommandLine.NamingConventionBinder.Tests/ModelDescriptorTests.cs +++ b/src/System.CommandLine.NamingConventionBinder.Tests/ModelDescriptorTests.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.CommandLine.Binding; using System.CommandLine.Tests.Binding; using System.CommandLine.Tests.Utility; using System.Linq; diff --git a/src/System.CommandLine.NamingConventionBinder.Tests/ParameterDescriptorTests.cs b/src/System.CommandLine.NamingConventionBinder.Tests/ParameterDescriptorTests.cs index df40f2c431..ae58673528 100644 --- a/src/System.CommandLine.NamingConventionBinder.Tests/ParameterDescriptorTests.cs +++ b/src/System.CommandLine.NamingConventionBinder.Tests/ParameterDescriptorTests.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.CommandLine.Binding; using System.CommandLine.Tests.Binding; using System.Linq; using FluentAssertions; diff --git a/src/System.CommandLine.NamingConventionBinder.Tests/PropertyDescriptorTests.cs b/src/System.CommandLine.NamingConventionBinder.Tests/PropertyDescriptorTests.cs index 5f4152c3e3..7bbf04295a 100644 --- a/src/System.CommandLine.NamingConventionBinder.Tests/PropertyDescriptorTests.cs +++ b/src/System.CommandLine.NamingConventionBinder.Tests/PropertyDescriptorTests.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.CommandLine.Binding; using System.CommandLine.Tests.Binding; using System.Linq; using FluentAssertions; diff --git a/src/System.CommandLine.NamingConventionBinder/ConstructorDescriptor.cs b/src/System.CommandLine.NamingConventionBinder/ConstructorDescriptor.cs index 19e970e98f..859c60a9b1 100644 --- a/src/System.CommandLine.NamingConventionBinder/ConstructorDescriptor.cs +++ b/src/System.CommandLine.NamingConventionBinder/ConstructorDescriptor.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.CommandLine.Binding; using System.Linq; using System.Reflection; diff --git a/src/System.CommandLine.NamingConventionBinder/DelegateHandlerDescriptor.cs b/src/System.CommandLine.NamingConventionBinder/DelegateHandlerDescriptor.cs index cbb6eaac4a..03ce3d96e6 100644 --- a/src/System.CommandLine.NamingConventionBinder/DelegateHandlerDescriptor.cs +++ b/src/System.CommandLine.NamingConventionBinder/DelegateHandlerDescriptor.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.CommandLine.Binding; using System.Linq; namespace System.CommandLine.NamingConventionBinder; diff --git a/src/System.CommandLine.NamingConventionBinder/HandlerDescriptor.cs b/src/System.CommandLine.NamingConventionBinder/HandlerDescriptor.cs index 5b8b13e43f..5cb37c1adb 100644 --- a/src/System.CommandLine.NamingConventionBinder/HandlerDescriptor.cs +++ b/src/System.CommandLine.NamingConventionBinder/HandlerDescriptor.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.CommandLine.Binding; using System.Reflection; namespace System.CommandLine.NamingConventionBinder; diff --git a/src/System.CommandLine.NamingConventionBinder/IMethodDescriptor.cs b/src/System.CommandLine.NamingConventionBinder/IMethodDescriptor.cs index adc0e17377..248429f05a 100644 --- a/src/System.CommandLine.NamingConventionBinder/IMethodDescriptor.cs +++ b/src/System.CommandLine.NamingConventionBinder/IMethodDescriptor.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.CommandLine.Binding; namespace System.CommandLine.NamingConventionBinder; diff --git a/src/System.CommandLine.NamingConventionBinder/MethodInfoHandlerDescriptor.cs b/src/System.CommandLine.NamingConventionBinder/MethodInfoHandlerDescriptor.cs index 466c9adb93..c94b951149 100644 --- a/src/System.CommandLine.NamingConventionBinder/MethodInfoHandlerDescriptor.cs +++ b/src/System.CommandLine.NamingConventionBinder/MethodInfoHandlerDescriptor.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.CommandLine.Binding; using System.Linq; using System.Reflection; diff --git a/src/System.CommandLine.Rendering.Tests/ConsoleRendererTests.cs b/src/System.CommandLine.Rendering.Tests/ConsoleRendererTests.cs index 81585884df..5918b50a8a 100644 --- a/src/System.CommandLine.Rendering.Tests/ConsoleRendererTests.cs +++ b/src/System.CommandLine.Rendering.Tests/ConsoleRendererTests.cs @@ -17,7 +17,7 @@ namespace System.CommandLine.Rendering.Tests { public class ConsoleRendererTests { - private readonly TestTerminal _terminal = new TestTerminal(); + private readonly TestTerminal _terminal = new(); private readonly ITestOutputHelper _output; diff --git a/src/System.CommandLine.Rendering.Tests/ContainerSpanTests.cs b/src/System.CommandLine.Rendering.Tests/ContainerSpanTests.cs index 0adbb3171a..ce56eea9a9 100644 --- a/src/System.CommandLine.Rendering.Tests/ContainerSpanTests.cs +++ b/src/System.CommandLine.Rendering.Tests/ContainerSpanTests.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.IO; using FluentAssertions; using Xunit; diff --git a/src/System.CommandLine.Rendering.Tests/RenderingTestCase.cs b/src/System.CommandLine.Rendering.Tests/RenderingTestCase.cs index e4684d41ab..dc9d79b0e5 100644 --- a/src/System.CommandLine.Rendering.Tests/RenderingTestCase.cs +++ b/src/System.CommandLine.Rendering.Tests/RenderingTestCase.cs @@ -5,7 +5,7 @@ namespace System.CommandLine.Rendering.Tests { public class RenderingTestCase { - private static readonly TextSpanFormatter _formatter = new TextSpanFormatter(); + private static readonly TextSpanFormatter _formatter = new(); public RenderingTestCase( string name, diff --git a/src/System.CommandLine.Rendering.Tests/TableRenderingTests.cs b/src/System.CommandLine.Rendering.Tests/TableRenderingTests.cs index 91febb9353..69dd68eb03 100644 --- a/src/System.CommandLine.Rendering.Tests/TableRenderingTests.cs +++ b/src/System.CommandLine.Rendering.Tests/TableRenderingTests.cs @@ -118,7 +118,7 @@ public void Column_widths_are_aligned_to_the_longest_cell_in_file_mode() .Be(lines[2].IndexOf("an option")); } - private TextRendered Cell(string text, int left, int top) => new TextRendered(text, new Point(left, top)); + private TextRendered Cell(string text, int left, int top) => new(text, new Point(left, top)); } public class OptionsHelpView : TableView