Skip to content

Commit 6882193

Browse files
authored
Fix RCS1215: Expression is always equal to true/false (#14356)
* Fix RCS1215: Expression is always equal to true/false
1 parent ef187d9 commit 6882193

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected bool DoesProviderSupportShouldProcess(string[] paths)
107107
// may be getting piped in.
108108
bool result = true;
109109

110-
if (paths != null && paths.Length >= 0)
110+
if (paths != null)
111111
{
112112
foreach (string path in paths)
113113
{

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public Collection<int> PromptForChoice(string caption,
252252
// choices to be picked.
253253

254254
// user did not pick up any choices..choose the default
255-
if ((result.Count == 0) && (defaultChoiceKeys.Keys.Count >= 0))
255+
if (result.Count == 0)
256256
{
257257
// if there's a default, pick that one.
258258
foreach (int defaultChoice in defaultChoiceKeys.Keys)

src/Microsoft.PowerShell.Security/security/CertificateProvider.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,16 +2010,14 @@ private object GetItemAtPath(string path, bool test, out bool isContainer)
20102010
//
20112011
// Thus lengths 1 & 2 are container items.
20122012
//
2013-
isContainer = (pathElements.Length >= 0) &&
2014-
(pathElements.Length <= 2);
2013+
isContainer = pathElements.Length <= 2;
20152014

20162015
X509NativeStore store = null;
20172016

20182017
//
20192018
// handle invalid path depth
20202019
//
2021-
if ((pathElements.Length > 3) ||
2022-
(pathElements.Length < 0))
2020+
if (pathElements.Length > 3)
20232021
{
20242022
if (test)
20252023
{

src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ private Collection<int> EmulatePromptForMultipleChoice(string caption,
993993
// choices to be picked.
994994

995995
// user did not pick up any choices..choose the default
996-
if ((result.Count == 0) && (defaultChoiceKeys.Keys.Count >= 0))
996+
if (result.Count == 0)
997997
{
998998
// if there's a default, pick that one.
999999
foreach (int defaultChoice in defaultChoiceKeys.Keys)

0 commit comments

Comments
 (0)