Skip to content

Commit

Permalink
Merge pull request #53 from DoctorKrolic/struct-null-compare
Browse files Browse the repository at this point in the history
Avoid comparing structs to `null` (use `default` instead)
  • Loading branch information
KirillOsenkov authored Dec 17, 2023
2 parents beb9db9 3c46046 commit 35eccf3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Microsoft.Language.Xml/Syntax/SyntaxToken.cs
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -219,9 219,9 @@ protected override int GetTextWidth()
public override int GetSlotCountIncludingTrivia()
{
int triviaSlots = 0;
if (GetLeadingTrivia() != null)
if (GetLeadingTrivia() != default)
triviaSlots ;
if (GetTrailingTrivia() != null)
if (GetTrailingTrivia() != default)
triviaSlots ;

return triviaSlots;
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Language.Xml/Syntax/XmlEmptyElementSyntax.cs
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;

Expand Down Expand Up @@ -161,7 161,7 @@ IEnumerable<KeyValuePair<string, string>> IXmlElement.Attributes
{
get
{
if (AttributesNode == null)
if (AttributesNode == default)
{
yield break;
}
Expand Down

0 comments on commit 35eccf3

Please sign in to comment.