GeezerVison is showing github.com — Code performance fixes follow-up (#14207) · PowerShell/PowerShell@fcafb7f
File treeExpand file treeCollapse file tree Open diff view settings src/System.Management.Automation
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -334,7 +334,7 @@ internal bool LoadUsingModulePath(PSModuleInfo parentModule, bool found, IEnumer | 334 | 334 | foreach (string folder in Directory.EnumerateDirectories(path)) | 335 | 335 | { | 336 | 336 | string moduleName = Path.GetFileName(folder); | 337 | | - if (string.Compare(moduleName, fileBaseName, StringComparison.OrdinalIgnoreCase) == 0) | | 337 | + if (string.Equals(moduleName, fileBaseName, StringComparison.OrdinalIgnoreCase)) | 338 | 338 | { | 339 | 339 | fileBaseName = moduleName; | 340 | 340 | #endif | @@ -3531,7 +3531,7 @@ private static void PropagateExportedTypesFromNestedModulesToRootModuleScope(Imp | 3531 | 3531 | if (nestedModule != null) | 3532 | 3532 | { | 3533 | 3533 | var exportedTypes = nestedModule.GetExportedTypeDefinitions(); | 3534 | | - if (exportedTypes != null && exportedTypes.Count != 0) | | 3534 | + if (exportedTypes != null && exportedTypes.Count > 0) | 3535 | 3535 | { | 3536 | 3536 | foreach (var t in exportedTypes) | 3537 | 3537 | { | |
Collapse file Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/Subsystem/SubsystemManager.cs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -217,7 +217,7 @@ private static void RegisterSubsystem(SubsystemInfo subsystemInfo, ISubsystem pr | 217 | 217 | nameof(proxy)); | 218 | 218 | } | 219 | 219 |
| 220 | | - if (subsystemInfo.RequiredCmdlets.Any() || subsystemInfo.RequiredFunctions.Any()) | | 220 | + if (subsystemInfo.RequiredCmdlets.Count > 0 || subsystemInfo.RequiredFunctions.Count > 0) | 221 | 221 | { | 222 | 222 | // Process 'proxy.CmdletImplementationAssembly' and 'proxy.FunctionsToDefine' | 223 | 223 | // Functions are added to global scope. | @@ -265,7 +265,7 @@ public static void UnregisterSubsystem(SubsystemKind kind, Guid id) | 265 | 265 |
| 266 | 266 | private static void UnregisterSubsystem(SubsystemInfo subsystemInfo, Guid id) | 267 | 267 | { | 268 | | - if (subsystemInfo.RequiredCmdlets.Any() || subsystemInfo.RequiredFunctions.Any()) | | 268 | + if (subsystemInfo.RequiredCmdlets.Count > 0 || subsystemInfo.RequiredFunctions.Count > 0) | 269 | 269 | { | 270 | 270 | throw new NotSupportedException("NotSupported yet: unregister subsystem that introduced new cmdlets/functions."); | 271 | 271 | } | |
Collapse file Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/parser/AstVisitor.cs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -425,7 +425,7 @@ internal static bool Contains(Ast ast, Func<Ast, bool> predicate, bool searchNes | 425 | 425 |
| 426 | 426 | var searcher = new AstSearcher(predicate, stopOnFirst: true, searchNestedScriptBlocks: searchNestedScriptBlocks); | 427 | 427 | ast.InternalVisit(searcher); | 428 | | - return searcher.Results.Any(); | | 428 | + return searcher.Results.Count > 0; | 429 | 429 | } | 430 | 430 |
| 431 | 431 | internal static bool IsUsingDollarInput(Ast ast) | |
Collapse file Copy file name to clipboardExpand all lines: src/System.Management.Automation/utils/EncodingUtils.cs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,7 +64,7 @@ internal static Encoding Convert(Cmdlet cmdlet, string encoding) | 64 | 64 | if (encodingMap.TryGetValue(encoding, out foundEncoding)) | 65 | 65 | { | 66 | 66 | // Write a warning if using utf7 as it is obsolete in .NET5 | 67 | | - if (string.Compare(encoding, Utf7, StringComparison.OrdinalIgnoreCase) == 0) | | 67 | + if (string.Equals(encoding, Utf7, StringComparison.OrdinalIgnoreCase)) | 68 | 68 | { | 69 | 69 | cmdlet.WriteWarning(PathUtilsStrings.Utf7EncodingObsolete); | 70 | 70 | } | |
|