[Ryujinx.Horizon.Common] Address dotnet-format issues (#5382)

* dotnet format style --severity info

Some changes were manually reverted.

* Address most dotnet format whitespace warnings

* Address IDE0251 warnings

* dotnet format whitespace after rebase
This commit is contained in:
TSRBerry 2023-06-25 13:40:37 +02:00 committed by GitHub
parent ede5b3c324
commit 7c2f07d124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 44 deletions

View File

@ -4,36 +4,36 @@
{ {
private const int ModuleId = 1; private const int ModuleId = 1;
public static Result SessionCountExceeded => new Result(ModuleId, 7); public static Result SessionCountExceeded => new(ModuleId, 7);
public static Result InvalidCapability => new Result(ModuleId, 14); public static Result InvalidCapability => new(ModuleId, 14);
public static Result ThreadNotStarted => new Result(ModuleId, 57); public static Result ThreadNotStarted => new(ModuleId, 57);
public static Result ThreadTerminating => new Result(ModuleId, 59); public static Result ThreadTerminating => new(ModuleId, 59);
public static Result InvalidSize => new Result(ModuleId, 101); public static Result InvalidSize => new(ModuleId, 101);
public static Result InvalidAddress => new Result(ModuleId, 102); public static Result InvalidAddress => new(ModuleId, 102);
public static Result OutOfResource => new Result(ModuleId, 103); public static Result OutOfResource => new(ModuleId, 103);
public static Result OutOfMemory => new Result(ModuleId, 104); public static Result OutOfMemory => new(ModuleId, 104);
public static Result HandleTableFull => new Result(ModuleId, 105); public static Result HandleTableFull => new(ModuleId, 105);
public static Result InvalidMemState => new Result(ModuleId, 106); public static Result InvalidMemState => new(ModuleId, 106);
public static Result InvalidPermission => new Result(ModuleId, 108); public static Result InvalidPermission => new(ModuleId, 108);
public static Result InvalidMemRange => new Result(ModuleId, 110); public static Result InvalidMemRange => new(ModuleId, 110);
public static Result InvalidPriority => new Result(ModuleId, 112); public static Result InvalidPriority => new(ModuleId, 112);
public static Result InvalidCpuCore => new Result(ModuleId, 113); public static Result InvalidCpuCore => new(ModuleId, 113);
public static Result InvalidHandle => new Result(ModuleId, 114); public static Result InvalidHandle => new(ModuleId, 114);
public static Result UserCopyFailed => new Result(ModuleId, 115); public static Result UserCopyFailed => new(ModuleId, 115);
public static Result InvalidCombination => new Result(ModuleId, 116); public static Result InvalidCombination => new(ModuleId, 116);
public static Result TimedOut => new Result(ModuleId, 117); public static Result TimedOut => new(ModuleId, 117);
public static Result Cancelled => new Result(ModuleId, 118); public static Result Cancelled => new(ModuleId, 118);
public static Result MaximumExceeded => new Result(ModuleId, 119); public static Result MaximumExceeded => new(ModuleId, 119);
public static Result InvalidEnumValue => new Result(ModuleId, 120); public static Result InvalidEnumValue => new(ModuleId, 120);
public static Result NotFound => new Result(ModuleId, 121); public static Result NotFound => new(ModuleId, 121);
public static Result InvalidThread => new Result(ModuleId, 122); public static Result InvalidThread => new(ModuleId, 122);
public static Result PortRemoteClosed => new Result(ModuleId, 123); public static Result PortRemoteClosed => new(ModuleId, 123);
public static Result InvalidState => new Result(ModuleId, 125); public static Result InvalidState => new(ModuleId, 125);
public static Result ReservedValue => new Result(ModuleId, 126); public static Result ReservedValue => new(ModuleId, 126);
public static Result PortClosed => new Result(ModuleId, 131); public static Result PortClosed => new(ModuleId, 131);
public static Result ResLimitExceeded => new Result(ModuleId, 132); public static Result ResLimitExceeded => new(ModuleId, 132);
public static Result ReceiveListBroken => new Result(ModuleId, 258); public static Result ReceiveListBroken => new(ModuleId, 258);
public static Result OutOfVaSpace => new Result(ModuleId, 259); public static Result OutOfVaSpace => new(ModuleId, 259);
public static Result CmdBufferTooSmall => new Result(ModuleId, 260); public static Result CmdBufferTooSmall => new(ModuleId, 260);
} }
} }

View File

@ -2,7 +2,7 @@
namespace Ryujinx.Horizon.Common namespace Ryujinx.Horizon.Common
{ {
public struct OnScopeExit : IDisposable public readonly struct OnScopeExit : IDisposable
{ {
private readonly Action _action; private readonly Action _action;

View File

@ -13,13 +13,13 @@ namespace Ryujinx.Horizon.Common
public int ErrorCode { get; } public int ErrorCode { get; }
public bool IsSuccess => ErrorCode == 0; public readonly bool IsSuccess => ErrorCode == 0;
public bool IsFailure => ErrorCode != 0; public readonly bool IsFailure => ErrorCode != 0;
public int Module => ErrorCode & (ModuleMax - 1); public readonly int Module => ErrorCode & (ModuleMax - 1);
public int Description => (ErrorCode >> ModuleBits) & (DescriptionMax - 1); public readonly int Description => (ErrorCode >> ModuleBits) & (DescriptionMax - 1);
public string PrintableResult => $"{2000 + Module:D4}-{Description:D4}"; public readonly string PrintableResult => $"{2000 + Module:D4}-{Description:D4}";
public Result(int module, int description) public Result(int module, int description)
{ {
@ -36,17 +36,17 @@ namespace Ryujinx.Horizon.Common
ErrorCode = module | (description << ModuleBits); ErrorCode = module | (description << ModuleBits);
} }
public override bool Equals(object obj) public readonly override bool Equals(object obj)
{ {
return obj is Result result && result.Equals(this); return obj is Result result && result.Equals(this);
} }
public bool Equals(Result other) public readonly bool Equals(Result other)
{ {
return other.ErrorCode == ErrorCode; return other.ErrorCode == ErrorCode;
} }
public override int GetHashCode() public readonly override int GetHashCode()
{ {
return ErrorCode; return ErrorCode;
} }
@ -61,7 +61,7 @@ namespace Ryujinx.Horizon.Common
return !lhs.Equals(rhs); return !lhs.Equals(rhs);
} }
public bool InRange(int minInclusive, int maxInclusive) public readonly bool InRange(int minInclusive, int maxInclusive)
{ {
return (uint)(Description - minInclusive) <= (uint)(maxInclusive - minInclusive); return (uint)(Description - minInclusive) <= (uint)(maxInclusive - minInclusive);
} }
@ -105,7 +105,7 @@ namespace Ryujinx.Horizon.Common
throw new InvalidResultException(this); throw new InvalidResultException(this);
} }
public override string ToString() public readonly override string ToString()
{ {
if (ResultNames.TryGet(ErrorCode, out string name)) if (ResultNames.TryGet(ErrorCode, out string name))
{ {