Skip to content

Commit

Permalink
perf: remove local method, exclude coverage for default arm
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Apr 2, 2023
1 parent 85f4e8c commit 08a4df0
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions X10D/src/Text/RuneExtensions.cs
@@ -1,6 +1,5 @@
#if NETCOREAPP3_0_OR_GREATER
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -101,23 +100,15 @@ public static string Repeat(this Rune value, int count)
// dotcover disable
//NOSONAR
default:
return Default();
//NOSONAR
// dotcover enable
}

[ExcludeFromCodeCoverage, DoesNotReturn]
string Default()
{
string exceptionFormat = ExceptionMessages.UnexpectedRuneUtf8SequenceLength;
string message = string.Format(CultureInfo.CurrentCulture, exceptionFormat, length);
string exceptionFormat = ExceptionMessages.UnexpectedRuneUtf8SequenceLength;
string message = string.Format(CultureInfo.CurrentCulture, exceptionFormat, length);
#if NET7_0_OR_GREATER
throw new UnreachableException(message);
throw new UnreachableException(message);
#else
throw new InvalidOperationException(message);
#endif

return default;
//NOSONAR
// dotcover enable
}
}
}
Expand Down

0 comments on commit 08a4df0

Please sign in to comment.