Skip to content

Commit e5a8acd

Browse files
committed
Fix warnings
1 parent 0f15efa commit e5a8acd

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

System.IO.Abstractions.Analyzers/CodeActions/FileServiceConstructorInitialCodeAction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ protected override async Task<Document> GetChangedDocumentAsync(CancellationToke
5555

5656
var fileSystem = RoslynClassFileSystem.GetUsing(compilationUnitSyntax, Constants.FileSystemNameSpace);
5757

58-
if (fileSystem != default(UsingDirectiveSyntax))
58+
if (fileSystem != null)
5959
{
6060
return editor.GetChangedDocument();
6161
}
6262

6363
var systemIo = RoslynClassFileSystem.GetSystemIoUsing(compilationUnitSyntax);
6464

65-
if (systemIo == default(UsingDirectiveSyntax))
65+
if (systemIo == null)
6666
{
6767
editor.InsertBefore(compilationUnitSyntax.Usings.FirstOrDefault(),
6868
RoslynClassFileSystem.GetFileSystemUsing());

System.IO.Abstractions.Analyzers/CodeActions/FileServiceInterfaceInjectionCodeAction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ protected override async Task<Document> GetChangedDocumentAsync(CancellationToke
5656

5757
var fileSystem = RoslynClassFileSystem.GetUsing(compilationUnitSyntax, Constants.FileSystemNameSpace);
5858

59-
if (fileSystem != default(UsingDirectiveSyntax))
59+
if (fileSystem != null)
6060
{
6161
return editor.GetChangedDocument();
6262
}
6363

6464
var systemIo = RoslynClassFileSystem.GetSystemIoUsing(compilationUnitSyntax);
6565

66-
if (systemIo == default(UsingDirectiveSyntax))
66+
if (systemIo == null)
6767
{
6868
editor.InsertBefore(compilationUnitSyntax.Usings.FirstOrDefault(),
6969
RoslynClassFileSystem.GetFileSystemUsing());

System.IO.Abstractions.Analyzers/CodeFixes/BaseInvokeCodeFix.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public override async sealed Task RegisterCodeFixesAsync(CodeFixContext context)
2323
var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken)
2424
.ConfigureAwait(false);
2525

26+
if (root == null)
27+
{
28+
return;
29+
}
30+
2631
var classDeclaration = root.FindNode(context.Span)
2732
.FirstAncestorOrSelf<ClassDeclarationSyntax>();
2833

0 commit comments

Comments
 (0)