Use 'new' expression in places where the type is evident for content (#2590)

* Content.Client

* Content.Benchmarks

* Content.IntegrationTests

* Content.Server

* Content.Server.Database

* Content.Shared

* Content.Tests

* Merge fixes

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2020-11-27 11:00:49 +01:00
committed by GitHub
parent 4a56df749b
commit 5c0cf1b1a0
235 changed files with 431 additions and 433 deletions

View File

@@ -11,9 +11,9 @@ namespace Content.Shared.Chemistry
private int _value;
private static readonly int Shift = 2;
public static ReagentUnit MaxValue { get; } = new ReagentUnit(int.MaxValue);
public static ReagentUnit Epsilon { get; } = new ReagentUnit(1);
public static ReagentUnit Zero { get; } = new ReagentUnit(0);
public static ReagentUnit MaxValue { get; } = new(int.MaxValue);
public static ReagentUnit Epsilon { get; } = new(1);
public static ReagentUnit Zero { get; } = new(0);
private double ShiftDown()
{
@@ -27,12 +27,12 @@ namespace Content.Shared.Chemistry
public static ReagentUnit New(int value)
{
return new ReagentUnit(value * (int) Math.Pow(10, Shift));
return new(value * (int) Math.Pow(10, Shift));
}
public static ReagentUnit New(float value)
{
return new ReagentUnit(FromFloat(value));
return new(FromFloat(value));
}
private static int FromFloat(float value)
@@ -42,7 +42,7 @@ namespace Content.Shared.Chemistry
public static ReagentUnit New(double value)
{
return new ReagentUnit((int) Math.Round(value * Math.Pow(10, Shift), MidpointRounding.AwayFromZero));
return new((int) Math.Round(value * Math.Pow(10, Shift), MidpointRounding.AwayFromZero));
}
public static ReagentUnit New(string value)
@@ -57,10 +57,10 @@ namespace Content.Shared.Chemistry
public static ReagentUnit operator +(ReagentUnit a) => a;
public static ReagentUnit operator -(ReagentUnit a) => new ReagentUnit(-a._value);
public static ReagentUnit operator -(ReagentUnit a) => new(-a._value);
public static ReagentUnit operator +(ReagentUnit a, ReagentUnit b)
=> new ReagentUnit(a._value + b._value);
=> new(a._value + b._value);
public static ReagentUnit operator -(ReagentUnit a, ReagentUnit b)
=> a + -b;
@@ -86,7 +86,7 @@ namespace Content.Shared.Chemistry
public static ReagentUnit operator *(ReagentUnit a, int b)
{
return new ReagentUnit(a._value * b);
return new(a._value * b);
}
public static ReagentUnit operator /(ReagentUnit a, ReagentUnit b)