From 4e21101ba5958e9e460ab88e0cab7ce20f718220 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Wed, 2 Sep 2020 04:07:49 +0100 Subject: [PATCH] Use boolean instead of bitwise operators on bools (#13506) * Autofix RCS1233: Use short-circuiting operator https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1233.md --- src/System.Management.Automation/engine/COM/ComProperty.cs | 2 +- .../engine/CmdletParameterBinderController.cs | 2 +- .../engine/interpreter/LocalVariables.cs | 2 +- .../engine/remoting/fanin/BaseTransportManager.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/System.Management.Automation/engine/COM/ComProperty.cs b/src/System.Management.Automation/engine/COM/ComProperty.cs index 2de108a872..b36d271753 100644 --- a/src/System.Management.Automation/engine/COM/ComProperty.cs +++ b/src/System.Management.Automation/engine/COM/ComProperty.cs @@ -130,7 +130,7 @@ namespace System.Management.Automation { get { - return _hasSetter | _hasSetterByRef; + return _hasSetter || _hasSetterByRef; } } diff --git a/src/System.Management.Automation/engine/CmdletParameterBinderController.cs b/src/System.Management.Automation/engine/CmdletParameterBinderController.cs index a8d9b4b4ff..2be37b569b 100644 --- a/src/System.Management.Automation/engine/CmdletParameterBinderController.cs +++ b/src/System.Management.Automation/engine/CmdletParameterBinderController.cs @@ -2257,7 +2257,7 @@ namespace System.Management.Automation // If we have one or the other, we can latch onto that set without difficulty uint uniqueSetThatTakesPipelineInput = 0; - if ((foundSetThatTakesPipelineInputByValue & foundSetThatTakesPipelineInputByPropertyName) && + if (foundSetThatTakesPipelineInputByValue && foundSetThatTakesPipelineInputByPropertyName && (setThatTakesPipelineInputByValue == setThatTakesPipelineInputByPropertyName)) { uniqueSetThatTakesPipelineInput = setThatTakesPipelineInputByValue; diff --git a/src/System.Management.Automation/engine/interpreter/LocalVariables.cs b/src/System.Management.Automation/engine/interpreter/LocalVariables.cs index 97908c8b2b..e093877ce3 100644 --- a/src/System.Management.Automation/engine/interpreter/LocalVariables.cs +++ b/src/System.Management.Automation/engine/interpreter/LocalVariables.cs @@ -57,7 +57,7 @@ namespace System.Management.Automation.Interpreter public bool InClosureOrBoxed { - get { return InClosure | IsBoxed; } + get { return InClosure || IsBoxed; } } internal LocalVariable(int index, bool closure, bool boxed) diff --git a/src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs index e0dfba1cd0..269b404a0a 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs @@ -1352,7 +1352,7 @@ namespace System.Management.Automation.Remoting.Server (UInt32)_dataType, (UInt32)_targetInterface); - SendDataToClient(dataToSend, (isEndFragment & _shouldFlushData) ? true : false, _reportAsPending, isEndFragment); + SendDataToClient(dataToSend, isEndFragment && _shouldFlushData, _reportAsPending, isEndFragment); } ///