[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
1 changed files with 3 additions and 3 deletions

View File

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