Skip to content

Commit 2527574

Browse files
committed
make lambda static
1 parent d27c419 commit 2527574

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/Smdn.Reflection.ReverseGenerating.ListApi/Smdn.Reflection.ReverseGenerating.ListApi.Build/ProjectBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public static IEnumerable<FileInfo> Build(
9898
// retrieve %(InnerOutput.Identity) / for in case of building with multiple target frameworks
9999
var innerOutputFullPaths = result.ProjectStateAfterBuild
100100
.Items
101-
.Where(item => item.ItemType == "InnerOutput")
102-
.Select(item => item.GetMetadataValue("Identity"));
101+
.Where(static item => item.ItemType == "InnerOutput")
102+
.Select(static item => item.GetMetadataValue("Identity"));
103103

104104
foreach (var innerOutputFullPath in innerOutputFullPaths) {
105105
logger?.LogDebug($"build output file: {innerOutputFullPath}");
@@ -113,7 +113,7 @@ public static IEnumerable<FileInfo> Build(
113113

114114
var buildOutputFullPaths = buildTargetResult
115115
.Items
116-
.Select(item => item.GetMetadata("Identity"));
116+
.Select(static item => item.GetMetadata("Identity"));
117117

118118
foreach (var buildOutputFullPath in buildOutputFullPaths) {
119119
logger?.LogDebug($"build output file: {buildOutputFullPath}");

src/Smdn.Reflection.ReverseGenerating.ListApi/Smdn.Reflection.ReverseGenerating.ListApi/ProjectFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static FileInfo FindSingleProjectOrSolution(
1919

2020
var solutionAndProjectFiles = directory
2121
.GetFiles("*.*", SearchOption.TopDirectoryOnly)
22-
.Where(file =>
22+
.Where(static file =>
2323
// *.sln, *.csproj, *.vbproj, etc
2424
Regex.IsMatch(file.Extension, @"\.(?i:sln|[a-z]+proj)$", RegexOptions.Singleline | RegexOptions.CultureInvariant)
2525
);

src/Smdn.Reflection.ReverseGenerating.ListApi/Smdn.Reflection.ReverseGenerating.ListApi/RootCommandImplementation.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class RootCommandImplementation {
3131
#else
3232
description: "Path to an assembly file to generate the API list.",
3333
#endif
34-
getDefaultValue: () => new DirectoryInfo(Environment.CurrentDirectory)
34+
getDefaultValue: static () => new DirectoryInfo(Environment.CurrentDirectory)
3535
) {
3636
// Arity = ArgumentArity.OneOrMore
3737
Arity = ArgumentArity.ExactlyOne,
@@ -40,32 +40,32 @@ public class RootCommandImplementation {
4040
private static readonly Option<string> optionConfiguration = new(
4141
aliases: new[] { "-c", "--configuration" },
4242
description: "The 'build configuration' option passed to `Build` target when the project will be built.",
43-
getDefaultValue: () => DefaultBuildConfiguration
43+
getDefaultValue: static () => DefaultBuildConfiguration
4444
);
4545
private static readonly Option<string> optionTargetFramework = new(
4646
aliases: new[] { "-f", "--framework" },
4747
description: "The 'target framework' option passed to `Build` target when the project will be built.",
48-
getDefaultValue: () => null
48+
getDefaultValue: static () => null
4949
);
5050
private static readonly Option<string> optionRuntimeIdentifier = new(
5151
aliases: new[] { "-r", "--runtime" },
5252
description: "The 'target runtime' option passed to `Build` target when the project will be built.",
53-
getDefaultValue: () => null
53+
getDefaultValue: static () => null
5454
);
5555
private static readonly Option<string> optionOS = new(
5656
aliases: new[] { "--os" },
5757
description: "The 'target operating system' option passed to `Build` target when the project will be built.",
58-
getDefaultValue: () => null
58+
getDefaultValue: static () => null
5959
);
6060
private static readonly Option<DirectoryInfo> optionOutputDirectory = new(
6161
aliases: new[] { "-o", "--output-directory" },
6262
description: "Path to output directory.",
63-
getDefaultValue: () => new DirectoryInfo(Environment.CurrentDirectory)
63+
getDefaultValue: static () => new DirectoryInfo(Environment.CurrentDirectory)
6464
);
6565
private static readonly Option<bool> optionLoadAssemblyIntoReflectionOnlyContext = new(
6666
aliases: new[] { "--load-reflection-only" },
6767
description: "Loads and processes input assemblies in the reflection-only context.",
68-
getDefaultValue: () =>
68+
getDefaultValue: static () =>
6969
#if NETFRAMEWORK
7070
true
7171
#else
@@ -75,17 +75,17 @@ public class RootCommandImplementation {
7575
private static readonly Option<bool> optionGenerateFullTypeName = new(
7676
aliases: new[] { "--generate-fulltypename" },
7777
description: "Generates declarations with full type name.",
78-
getDefaultValue: () => false
78+
getDefaultValue: static () => false
7979
);
8080
private static readonly Option<MethodBodyOption> optionGenerateMethodBody = new(
8181
aliases: new[] { "--generate-methodbody" },
8282
description: "Generates method body with specified type of implementation.",
83-
getDefaultValue: () => MethodBodyOption.EmptyImplementation
83+
getDefaultValue: static () => MethodBodyOption.EmptyImplementation
8484
);
8585
private static readonly Option<bool> optionGenerateStaticMembersFirst = new(
8686
aliases: new[] { "--generate-staticmembersfirst" },
8787
description: "Generates member declarations in the order of the static members first.",
88-
getDefaultValue: () => false
88+
getDefaultValue: static () => false
8989
);
9090

9191
private readonly IServiceProvider serviceProvider;

src/Smdn.Reflection.ReverseGenerating.ListApi/Smdn.Reflection.ReverseGenerating.ListApi/VerbosityOption.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static class VerbosityOption {
1414
internal static readonly Option<string> Option = new(
1515
aliases: new[] { "-v", "--verbosity" },
1616
description: "Verbosity of output. The value must be one of q[uiet], m[inimal], n[ormal], d[etailed], or diag[nostic].",
17-
getDefaultValue: () => "minimal"
17+
getDefaultValue: static () => "minimal"
1818
);
1919

2020
public static LogLevel ParseLogLevel(string[] args)

0 commit comments

Comments
 (0)