1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 03:45:41 +00:00

[ci skip] style: restrict scope of pragma suppression

This commit is contained in:
Oliver Booth 2023-03-31 20:16:57 +01:00
parent 708207305c
commit 4152c289e3
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025

View File

@ -1,4 +1,4 @@
using System.Diagnostics.Contracts; using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -90,8 +90,9 @@ public static class SpanExtensions
// more prone to inlining... // more prone to inlining...
unsafe unsafe
{ {
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type #pragma warning disable CS8500
switch (sizeof(T)) switch (sizeof(T))
#pragma warning restore CS8500
{ {
case 1: case 1:
{ {
@ -124,7 +125,6 @@ public static class SpanExtensions
throw new ArgumentException($"Enum with the size of {Unsafe.SizeOf<T>()} bytes is unexpected."); throw new ArgumentException($"Enum with the size of {Unsafe.SizeOf<T>()} bytes is unexpected.");
#endif #endif
} }
#pragma warning restore CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type
} }
#else #else
foreach (var it in span) foreach (var it in span)