From 6eba10e18b512d6a5a2358c313cb1ba661a75dcd Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 9 Dec 2023 15:09:25 +0100 Subject: [PATCH] Use collection expressions in more places --- .../Mappings/HlslKnownTypes.cs | 2 +- .../Helpers/DynamicCache{TKey,TValue}.cs | 2 +- .../Graphics/Commands/Interop/ID3D12CommandListPool.cs | 2 +- src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs index 6abf8faf..f3496cf5 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs @@ -365,7 +365,7 @@ internal static partial class HlslKnownTypes /// The same list as input, but in a valid HLSL declaration order. private static IEnumerable OrderByDependency(IEnumerable types, IReadOnlyCollection invalidTypes) { - Queue<(INamedTypeSymbol Type, HashSet Fields)> queue = new(); + Queue<(INamedTypeSymbol Type, HashSet Fields)> queue = []; // Build a mapping of type dependencies for all the captured types. A type depends on another // when the latter is a field in the first type. HLSL requires custom types to be declared in diff --git a/src/ComputeSharp.SourceGeneration/Helpers/DynamicCache{TKey,TValue}.cs b/src/ComputeSharp.SourceGeneration/Helpers/DynamicCache{TKey,TValue}.cs index f56ce3fe..9cb05fc2 100644 --- a/src/ComputeSharp.SourceGeneration/Helpers/DynamicCache{TKey,TValue}.cs +++ b/src/ComputeSharp.SourceGeneration/Helpers/DynamicCache{TKey,TValue}.cs @@ -20,7 +20,7 @@ internal sealed class DynamicCache /// /// The backing instance for the cache. /// - private readonly ConcurrentDictionary map = new(); + private readonly ConcurrentDictionary map = []; /// /// The tracking dead entries to remove. diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs index 09336922..ed8e609b 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs @@ -16,7 +16,7 @@ internal readonly unsafe struct ID3D12CommandListPool(D3D12_COMMAND_LIST_TYPE d3 /// /// The queue of items with the available command lists. /// - private readonly Queue d3D12CommandListBundleQueue = new(); + private readonly Queue d3D12CommandListBundleQueue = []; /// /// Rents a and pair. diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs b/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs index a92dfeea..a5beec31 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs @@ -228,7 +228,7 @@ unsafe partial class GraphicsDevice /// /// The shared holding the reusable instances. /// - private static readonly ConcurrentQueue ValueTaskSourceQueue = new(); + private static readonly ConcurrentQueue ValueTaskSourceQueue = []; /// /// The approximate count of currently enqueued instances in .