perf: remove local method, exclude coverage for default arm

This commit is contained in:
Oliver Booth 2023-04-02 02:56:50 +01:00
parent 85f4e8c733
commit 08a4df0c64
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025
1 changed files with 5 additions and 14 deletions

View File

@ -1,6 +1,5 @@
#if NETCOREAPP3_0_OR_GREATER #if NETCOREAPP3_0_OR_GREATER
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts; using System.Diagnostics.Contracts;
using System.Globalization; using System.Globalization;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -101,23 +100,15 @@ public static class RuneExtensions
// dotcover disable // dotcover disable
//NOSONAR //NOSONAR
default: default:
return Default(); string exceptionFormat = ExceptionMessages.UnexpectedRuneUtf8SequenceLength;
//NOSONAR string message = string.Format(CultureInfo.CurrentCulture, exceptionFormat, length);
// dotcover enable
}
[ExcludeFromCodeCoverage, DoesNotReturn]
string Default()
{
string exceptionFormat = ExceptionMessages.UnexpectedRuneUtf8SequenceLength;
string message = string.Format(CultureInfo.CurrentCulture, exceptionFormat, length);
#if NET7_0_OR_GREATER #if NET7_0_OR_GREATER
throw new UnreachableException(message); throw new UnreachableException(message);
#else #else
throw new InvalidOperationException(message); throw new InvalidOperationException(message);
#endif #endif
//NOSONAR
return default; // dotcover enable
} }
} }
} }