[PT Run][Folder] Use static SearchValues to resolve CA1870

This commit is contained in:
Jeremy Sinclair 2023-10-11 14:30:01 -04:00
parent 720a503b6b
commit 6b6c0dd5e4

View File

@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
@ -15,6 +16,7 @@ namespace Microsoft.Plugin.Folder.Sources
{
public class QueryInternalDirectory : IQueryInternalDirectory
{
private static readonly SearchValues<char> PathChars = SearchValues.Create("\\/");
private readonly FolderSettings _settings;
private readonly IQueryFileSystemInfo _queryFileSystemInfo;
private readonly IDirectory _directory;
@ -51,7 +53,7 @@ namespace Microsoft.Plugin.Folder.Sources
{
// if folder doesn't exist, we want to take the last part and use it afterwards to help the user
// find the right folder.
int index = search.LastIndexOfAny(new char[] { '\\', '/' });
int index = search.AsSpan().LastIndexOfAny(PathChars);
// No slashes found, so probably not a folder
if (index <= 0 || index >= search.Length - 1)