diff --git a/src/Consolonia.Core/Drawing/PixelBufferImplementation/DrawingBoxSymbol.cs b/src/Consolonia.Core/Drawing/PixelBufferImplementation/DrawingBoxSymbol.cs index 1b7d01d..af6011a 100644 --- a/src/Consolonia.Core/Drawing/PixelBufferImplementation/DrawingBoxSymbol.cs +++ b/src/Consolonia.Core/Drawing/PixelBufferImplementation/DrawingBoxSymbol.cs @@ -155,13 +155,11 @@ public override int GetHashCode() public static bool operator ==(DrawingBoxSymbol left, DrawingBoxSymbol right) { - if ((object)left is null) return (object)right is null; return left.Equals(right); } public static bool operator !=(DrawingBoxSymbol left, DrawingBoxSymbol right) { - if ((object)left is null) return (object)right is not null; return !left!.Equals(right); } } diff --git a/src/Consolonia.Core/Drawing/PixelBufferImplementation/Pixel.cs b/src/Consolonia.Core/Drawing/PixelBufferImplementation/Pixel.cs index 3c0e7ab..87086b9 100644 --- a/src/Consolonia.Core/Drawing/PixelBufferImplementation/Pixel.cs +++ b/src/Consolonia.Core/Drawing/PixelBufferImplementation/Pixel.cs @@ -88,9 +88,6 @@ public Pixel(PixelForeground foreground, public bool Equals(Pixel other) { - if ((object)other == null) - return false; - return Foreground.Equals(other.Foreground) && Background.Equals(other.Background) && IsCaret.Equals(other.IsCaret); @@ -179,14 +176,11 @@ public override int GetHashCode() public static bool operator ==(Pixel left, Pixel right) { - if ((object)left is null) return (object)right is null; - return left.Equals(right); } public static bool operator !=(Pixel left, Pixel right) { - if ((object)left is null) return (object)right is not null; return !left.Equals(right); } } diff --git a/src/Consolonia.Core/Drawing/PixelBufferImplementation/PixelBackground.cs b/src/Consolonia.Core/Drawing/PixelBufferImplementation/PixelBackground.cs index f265ca0..b2f72af 100644 --- a/src/Consolonia.Core/Drawing/PixelBufferImplementation/PixelBackground.cs +++ b/src/Consolonia.Core/Drawing/PixelBufferImplementation/PixelBackground.cs @@ -35,7 +35,6 @@ public PixelBackground(PixelBackgroundMode mode, Color? color = null) public bool Equals(PixelBackground other) { - if ((object)other is null) return false; return Color.Equals(other.Color) && Mode == other.Mode; } @@ -74,13 +73,11 @@ public override int GetHashCode() public static bool operator ==(PixelBackground left, PixelBackground right) { - if ((object)left is null) return (object)right is null; return left.Equals(right); } public static bool operator !=(PixelBackground left, PixelBackground right) { - if ((object)left == null) return (object)right != null; return !left.Equals(right); } } diff --git a/src/Consolonia.Core/Drawing/PixelBufferImplementation/PixelForeground.cs b/src/Consolonia.Core/Drawing/PixelBufferImplementation/PixelForeground.cs index 1eafef2..ebc6ad3 100644 --- a/src/Consolonia.Core/Drawing/PixelBufferImplementation/PixelForeground.cs +++ b/src/Consolonia.Core/Drawing/PixelBufferImplementation/PixelForeground.cs @@ -49,8 +49,6 @@ public PixelForeground(ISymbol symbol, Color color, public bool Equals(PixelForeground other) { - if ((object)other is null) return false; - return Symbol.Equals(other.Symbol) && Color.Equals(other.Color) && Weight.Equals(other.Weight) && @@ -88,13 +86,11 @@ public override int GetHashCode() public static bool operator ==(PixelForeground left, PixelForeground right) { - if ((object)left is null) return (object)right is null; return left.Equals(right); } public static bool operator !=(PixelForeground left, PixelForeground right) { - if ((object)left is null) return (object)right is not null; return !left.Equals(right); } } diff --git a/src/Consolonia.Core/Drawing/PixelBufferImplementation/SimpleSymbol.cs b/src/Consolonia.Core/Drawing/PixelBufferImplementation/SimpleSymbol.cs index b130cca..fb6b103 100644 --- a/src/Consolonia.Core/Drawing/PixelBufferImplementation/SimpleSymbol.cs +++ b/src/Consolonia.Core/Drawing/PixelBufferImplementation/SimpleSymbol.cs @@ -38,9 +38,6 @@ public SimpleSymbol(Rune rune) public bool Equals(SimpleSymbol other) { - if ((object)other is null) - return false; - return Text.Equals(other.Text, StringComparison.Ordinal); } @@ -70,14 +67,11 @@ public override int GetHashCode() public static bool operator ==(SimpleSymbol left, SimpleSymbol right) { - if ((object)left is null) return (object)right is null; return left.Equals(right); } public static bool operator !=(SimpleSymbol left, SimpleSymbol right) { - if ((object)left is null) return (object)right is not null; - return !left.Equals(right); } } diff --git a/src/Consolonia.Core/Drawing/RenderTarget.cs b/src/Consolonia.Core/Drawing/RenderTarget.cs index 91f0565..72fede2 100644 --- a/src/Consolonia.Core/Drawing/RenderTarget.cs +++ b/src/Consolonia.Core/Drawing/RenderTarget.cs @@ -198,7 +198,7 @@ public void WritePixel( // want to output as they are already invisible and represented // by the complex glyph coming before it (aka double-wide chars) if (pixel.Foreground.Symbol.Width > 0) - _stringBuilder.Append(pixel.Foreground.Symbol!.Text); + _stringBuilder.Append(pixel.Foreground.Symbol.Text); _currentBufferPoint = _currentBufferPoint.WithXpp(); } diff --git a/src/Tests/Consolonia.Core.Tests/DrawingContextImplTests.cs b/src/Tests/Consolonia.Core.Tests/DrawingContextImplTests.cs index e335b4b..04cf43c 100644 --- a/src/Tests/Consolonia.Core.Tests/DrawingContextImplTests.cs +++ b/src/Tests/Consolonia.Core.Tests/DrawingContextImplTests.cs @@ -109,7 +109,7 @@ public void DrawDoubleWide() else if (x == 6) { Assert.IsTrue(pixel.Width == 0); - Assert.IsTrue(pixel.Foreground.Symbol!.Text.Length == 0); + Assert.IsTrue(pixel.Foreground.Symbol.Text.Length == 0); } else { @@ -141,7 +141,7 @@ public void DrawOverDoubleWideFirstChar() else if (x == 6) { Assert.IsTrue(pixel.Width == 1); - Assert.IsTrue(pixel.Foreground.Symbol!.Text == " "); + Assert.IsTrue(pixel.Foreground.Symbol.Text == " "); } else { @@ -173,7 +173,7 @@ public void DrawOverDoubleWideSecondChar() else if (x == 6) { Assert.IsTrue(pixel.Width == 1); - Assert.IsTrue(pixel.Foreground.Symbol!.Text == "X"); + Assert.IsTrue(pixel.Foreground.Symbol.Text == "X"); Assert.IsTrue(pixel.Foreground.Color == Colors.Red); } else