Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -3,7 +3,6 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text;
namespace System.Buffers
{
@ -16,7 +15,9 @@ namespace System.Buffers
[MethodImpl(MethodImplOptions.NoInlining)]
private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(int sourceLength, int offset) =>
(uint)offset > (uint)sourceLength ? new ArgumentOutOfRangeException(GetArgumentName(ExceptionArgument.offset)) : new ArgumentOutOfRangeException(GetArgumentName(ExceptionArgument.length));
(uint)offset > (uint)sourceLength
? new ArgumentOutOfRangeException(GetArgumentName(ExceptionArgument.offset))
: new ArgumentOutOfRangeException(GetArgumentName(ExceptionArgument.length));
public static void ThrowArgumentOutOfRangeException_BufferRequestTooLarge(int maxSize)
{
@ -29,17 +30,15 @@ namespace System.Buffers
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static ArgumentOutOfRangeException GetArgumentOutOfRangeException_BufferRequestTooLarge(int maxSize) => new ArgumentOutOfRangeException(GetArgumentName(ExceptionArgument.size), $"Cannot allocate more than {maxSize} bytes in a single buffer");
private static ArgumentOutOfRangeException GetArgumentOutOfRangeException_BufferRequestTooLarge(int maxSize) =>
new ArgumentOutOfRangeException(GetArgumentName(ExceptionArgument.size),
$"Cannot allocate more than {maxSize} bytes in a single buffer");
[MethodImpl(MethodImplOptions.NoInlining)]
private static ObjectDisposedException GetObjectDisposedException(ExceptionArgument argument) => new ObjectDisposedException(GetArgumentName(argument));
private static ObjectDisposedException GetObjectDisposedException(ExceptionArgument argument) =>
new ObjectDisposedException(GetArgumentName(argument));
private static string GetArgumentName(ExceptionArgument argument)
{
Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
return argument.ToString();
}
private static string GetArgumentName(ExceptionArgument argument) => argument.ToString();
public enum ExceptionArgument
{