Skip to content

Commit 88e8ee0

Browse files
committed
Simplify InheritsFrom method
1 parent d9ee84b commit 88e8ee0

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

StyleCop.Analyzers.Status.Generator/SolutionReader.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,20 +235,17 @@ private CodeFixStatus HasCodeFix(string diagnosticId, INamedTypeSymbol classSymb
235235

236236
private bool InheritsFrom(INamedTypeSymbol declaration, INamedTypeSymbol possibleBaseType)
237237
{
238-
while (true)
238+
while (declaration != null)
239239
{
240-
if (declaration == null)
241-
{
242-
return false;
243-
}
244-
245240
if (declaration == possibleBaseType)
246241
{
247242
return true;
248243
}
249244

250245
declaration = declaration.BaseType;
251246
}
247+
248+
return false;
252249
}
253250
}
254251
}

0 commit comments

Comments
 (0)