From 4152c289e3e49e2e540e62d270eeff834eedaf3e Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 31 Mar 2023 20:16:57 +0100 Subject: [PATCH] [ci skip] style: restrict scope of pragma suppression --- X10D/src/Core/SpanExtensions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/X10D/src/Core/SpanExtensions.cs b/X10D/src/Core/SpanExtensions.cs index 2c7fcf1..e5e0af1 100644 --- a/X10D/src/Core/SpanExtensions.cs +++ b/X10D/src/Core/SpanExtensions.cs @@ -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()} 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)