Skip to content

Commit c626308

Browse files
committed
Use static lambdas
1 parent f63df4c commit c626308

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

Source/Boxed.AspNetCore.Swagger/OperationFilters/ClaimsOperationFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void Apply(OpenApiOperation operation, OperationFilterContext context)
3333
var authorizationRequirements = filterDescriptors.GetPolicyRequirements();
3434
var claimTypes = authorizationRequirements
3535
.OfType<ClaimsAuthorizationRequirement>()
36-
.Select(x => x.ClaimType)
36+
.Select(static x => x.ClaimType)
3737
.ToList();
3838
if (claimTypes.Any())
3939
{

Source/Boxed.AspNetCore/ServiceCollectionExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static IServiceCollection ConfigureSingleton<TOptions>(
101101

102102
return services
103103
.Configure<TOptions>(configuration)
104-
.AddSingleton(x => x.GetRequiredService<IOptions<TOptions>>().Value);
104+
.AddSingleton(static x => x.GetRequiredService<IOptions<TOptions>>().Value);
105105
}
106106

107107
/// <summary>
@@ -123,7 +123,7 @@ public static IServiceCollection ConfigureSingleton<TOptions>(
123123

124124
return services
125125
.Configure<TOptions>(configuration, configureBinder)
126-
.AddSingleton(x => x.GetRequiredService<IOptions<TOptions>>().Value);
126+
.AddSingleton(static x => x.GetRequiredService<IOptions<TOptions>>().Value);
127127
}
128128

129129
/// <summary>
@@ -147,7 +147,7 @@ public static IServiceCollection ConfigureAndValidateSingleton<TOptions>(
147147
.Bind(configuration)
148148
.ValidateDataAnnotations()
149149
.ValidateOnStart();
150-
return services.AddSingleton(x => x.GetRequiredService<IOptions<TOptions>>().Value);
150+
return services.AddSingleton(static x => x.GetRequiredService<IOptions<TOptions>>().Value);
151151
}
152152

153153
/// <summary>
@@ -173,7 +173,7 @@ public static IServiceCollection ConfigureAndValidateSingleton<TOptions>(
173173
.Bind(configuration, configureBinder)
174174
.ValidateDataAnnotations()
175175
.ValidateOnStart();
176-
return services.AddSingleton(x => x.GetRequiredService<IOptions<TOptions>>().Value);
176+
return services.AddSingleton(static x => x.GetRequiredService<IOptions<TOptions>>().Value);
177177
}
178178

179179
/// <summary>
@@ -201,7 +201,7 @@ public static IServiceCollection ConfigureAndValidateSingleton<TOptions>(
201201
.ValidateDataAnnotations()
202202
.Validate(validation)
203203
.ValidateOnStart();
204-
return services.AddSingleton(x => x.GetRequiredService<IOptions<TOptions>>().Value);
204+
return services.AddSingleton(static x => x.GetRequiredService<IOptions<TOptions>>().Value);
205205
}
206206

207207
/// <summary>
@@ -231,7 +231,7 @@ public static IServiceCollection ConfigureAndValidateSingleton<TOptions>(
231231
.ValidateDataAnnotations()
232232
.Validate(validation)
233233
.ValidateOnStart();
234-
return services.AddSingleton(x => x.GetRequiredService<IOptions<TOptions>>().Value);
234+
return services.AddSingleton(static x => x.GetRequiredService<IOptions<TOptions>>().Value);
235235
}
236236

237237
/// <summary>
@@ -262,7 +262,7 @@ public static IServiceCollection ConfigureAndValidateSingleton<TOptions>(
262262
.ValidateDataAnnotations()
263263
.Validate(validation, failureMessage)
264264
.ValidateOnStart();
265-
return services.AddSingleton(x => x.GetRequiredService<IOptions<TOptions>>().Value);
265+
return services.AddSingleton(static x => x.GetRequiredService<IOptions<TOptions>>().Value);
266266
}
267267

268268
/// <summary>
@@ -295,6 +295,6 @@ public static IServiceCollection ConfigureAndValidateSingleton<TOptions>(
295295
.ValidateDataAnnotations()
296296
.Validate(validation, failureMessage)
297297
.ValidateOnStart();
298-
return services.AddSingleton(x => x.GetRequiredService<IOptions<TOptions>>().Value);
298+
return services.AddSingleton(static x => x.GetRequiredService<IOptions<TOptions>>().Value);
299299
}
300300
}

Source/Boxed.DotnetNewTest/AssemblyResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bool NamesMatch(RuntimeLibrary runtime) =>
6464
library.Name,
6565
library.Version,
6666
library.Hash,
67-
library.RuntimeAssemblyGroups.SelectMany(g => g.AssetPaths),
67+
library.RuntimeAssemblyGroups.SelectMany(static g => g.AssetPaths),
6868
library.Dependencies,
6969
library.Serviceable);
7070

Source/Boxed.DotnetNewTest/ConfigurationService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public static string GetTempDirectoryPath()
2323
// Don't want to overwork my SSD drive, so use the D drive where available.
2424
var drivePath = DriveInfo
2525
.GetDrives()
26-
.Where(x => x.DriveType == DriveType.Fixed)
27-
.OrderByDescending(x => string.Equals(x.Name, @"D:\", StringComparison.Ordinal))
26+
.Where(static x => x.DriveType == DriveType.Fixed)
27+
.OrderByDescending(static x => string.Equals(x.Name, @"D:\", StringComparison.Ordinal))
2828
.FirstOrDefault()
2929
?.Name;
3030
if (drivePath is null)

Source/Boxed.DotnetNewTest/DirectoryExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static string GetTempDirectoryPath() =>
7979
/// <returns>A short temporary directory path.</returns>
8080
public static string GetShortTempDirectoryPath() =>
8181
Path.Combine(
82-
DriveInfo.GetDrives().First(x => x.DriveType == DriveType.Fixed).RootDirectory.FullName,
82+
DriveInfo.GetDrives().First(static x => x.DriveType == DriveType.Fixed).RootDirectory.FullName,
8383
"Temp",
8484
Guid.NewGuid().ToString().Replace("-", string.Empty, StringComparison.Ordinal));
8585

Source/Boxed.DotnetNewTest/DotnetNew.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private static string GetProjectFilePath(Assembly assembly, string fileName)
146146
projectFilePath = directory
147147
.Parent
148148
.GetFiles(projectName, SearchOption.AllDirectories)
149-
.FirstOrDefault(x => !IsInObjDirectory(x.Directory))
149+
.FirstOrDefault(static x => !IsInObjDirectory(x.Directory))
150150
?.FullName;
151151
if (projectFilePath is not null)
152152
{

0 commit comments

Comments
 (0)