From 919faae953f5bc7a87ab2d503e9ab1d3126f0cbf Mon Sep 17 00:00:00 2001 From: Sebastien Lebreton Date: Tue, 30 May 2023 20:04:02 +0200 Subject: [PATCH] Code gardening (#283) --- .../BaseVectorConversion.cs | 1 - src/Microsoft.Unity.Analyzers/ScriptInfo.cs | 15 +++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.Unity.Analyzers/BaseVectorConversion.cs b/src/Microsoft.Unity.Analyzers/BaseVectorConversion.cs index ab15e860..bf189c0a 100644 --- a/src/Microsoft.Unity.Analyzers/BaseVectorConversion.cs +++ b/src/Microsoft.Unity.Analyzers/BaseVectorConversion.cs @@ -15,7 +15,6 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; -using Microsoft.CodeAnalysis.Simplification; namespace Microsoft.Unity.Analyzers; diff --git a/src/Microsoft.Unity.Analyzers/ScriptInfo.cs b/src/Microsoft.Unity.Analyzers/ScriptInfo.cs index f440fd6e..9b8596b6 100644 --- a/src/Microsoft.Unity.Analyzers/ScriptInfo.cs +++ b/src/Microsoft.Unity.Analyzers/ScriptInfo.cs @@ -71,14 +71,13 @@ public IEnumerable GetNotImplementedMessages(Accessibility? accessib private static bool AccessibilityMatch(MethodInfo message, Accessibility accessibility) { - // If the message is declared as public or protected we need to honor it, other messages can be anything - if (message.IsPublic && message.IsVirtual) - return accessibility == Accessibility.Public; - - if (message.IsFamily && message.IsVirtual) - return accessibility == Accessibility.Protected; - - return true; + return message switch + { + // If the message is declared as public or protected we need to honor it, other messages can be anything + { IsPublic: true, IsVirtual: true } => accessibility == Accessibility.Public, + { IsFamily: true, IsVirtual: true } => accessibility == Accessibility.Protected, + _ => true + }; } private bool IsImplemented(MethodInfo method)