diff --git a/Directory.Packages.props b/Directory.Packages.props
index bc80d5e..44fe4ea 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -8,7 +8,6 @@
-
diff --git a/src/Ramstack.FileSystem.Abstractions/Utilities/PathTokenizer.cs b/src/Ramstack.FileSystem.Abstractions/Utilities/PathTokenizer.cs
index 4b5f608..b53bb50 100644
--- a/src/Ramstack.FileSystem.Abstractions/Utilities/PathTokenizer.cs
+++ b/src/Ramstack.FileSystem.Abstractions/Utilities/PathTokenizer.cs
@@ -49,7 +49,8 @@ internal Enumerator(string path) =>
///
/// Gets the current path component.
///
- public ReadOnlySpan Current =>
+ public ReadOnlySpan Current
+ {
//
// Using AsSpan(_start) followed by slicing is more efficient
// than AsSpan(_start, _count) because:
@@ -60,7 +61,9 @@ internal Enumerator(string path) =>
// which the JIT can't optimize away:
// (ulong)(uint)_start + (ulong)(uint)_count <= (ulong)(uint)Length
//
- _path.AsSpan(_start)[.._count];
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => _path.AsSpan(_start)[.._count];
+ }
///
/// Advances the enumerator to the next path component.
diff --git a/src/Ramstack.FileSystem.Abstractions/VirtualPath.cs b/src/Ramstack.FileSystem.Abstractions/VirtualPath.cs
index 886d652..9535ccb 100644
--- a/src/Ramstack.FileSystem.Abstractions/VirtualPath.cs
+++ b/src/Ramstack.FileSystem.Abstractions/VirtualPath.cs
@@ -1,6 +1,4 @@
using System.Buffers;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.CompilerServices;
using Ramstack.FileSystem.Utilities;
@@ -168,7 +166,7 @@ public static bool IsNormalized(ReadOnlySpan path)
{
var prior = path[0];
- for (var j = 1; j < path.Length; j++)
+ for (var j = 1; (uint)j < (uint)path.Length; j++)
{
var ch = path[j];
if (ch == '\\' || ch == '/' && prior == '/')
@@ -176,20 +174,18 @@ public static bool IsNormalized(ReadOnlySpan path)
if (ch == '.' && prior == '/')
{
- if ((uint)j + 1 >= path.Length)
+ if ((uint)j + 1 >= (uint)path.Length)
return false;
- var nch = path[j + 1];
- if (nch == '/' || nch == '\\')
+ if (path[j + 1] is '/' or '\\')
return false;
- if (nch == '.')
+ if (path[j + 1] == '.')
{
- if ((uint)j + 2 >= path.Length)
+ if ((uint)j + 2 >= (uint)path.Length)
return false;
- var sch = path[j + 2];
- if (sch == '/' || sch == '\\')
+ if (path[j + 2] is '/' or '\\')
return false;
}
}
@@ -319,7 +315,6 @@ public static string Join(ReadOnlySpan path1, ReadOnlySpan path2)
/// if the path has a leading directory separator;
/// otherwise, .
///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasLeadingSlash(string path) =>
path.StartsWith('/') || path.StartsWith('\\');
@@ -331,7 +326,6 @@ public static bool HasLeadingSlash(string path) =>
/// if the path has a trailing directory separator;
/// otherwise, .
///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasTrailingSlash(string path) =>
path.EndsWith('/') || path.EndsWith('\\');
@@ -343,7 +337,6 @@ public static bool HasTrailingSlash(string path) =>
/// if the path has a leading directory separator;
/// otherwise, .
///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasLeadingSlash(ReadOnlySpan path)
{
if (path.Length != 0)
@@ -364,7 +357,6 @@ public static bool HasLeadingSlash(ReadOnlySpan path)
/// if the path has a trailing directory separator;
/// otherwise, .
///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasTrailingSlash(ReadOnlySpan path)
{
if (path.Length != 0)
@@ -392,8 +384,4 @@ private static int GetDirectoryNameOffset(ReadOnlySpan path)
return index;
}
-
- [DoesNotReturn]
- private static void Error_InvalidPath() =>
- throw new ArgumentException("Invalid path");
}
diff --git a/src/Ramstack.FileSystem.Adapters/Ramstack.FileSystem.Adapters.csproj b/src/Ramstack.FileSystem.Adapters/Ramstack.FileSystem.Adapters.csproj
index fa1d60f..82f0333 100644
--- a/src/Ramstack.FileSystem.Adapters/Ramstack.FileSystem.Adapters.csproj
+++ b/src/Ramstack.FileSystem.Adapters/Ramstack.FileSystem.Adapters.csproj
@@ -42,7 +42,6 @@
-
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Ramstack.FileSystem.Globbing/GlobbingFileSystem.cs b/src/Ramstack.FileSystem.Globbing/GlobbingFileSystem.cs
index 1ea19f2..7fb42bf 100644
--- a/src/Ramstack.FileSystem.Globbing/GlobbingFileSystem.cs
+++ b/src/Ramstack.FileSystem.Globbing/GlobbingFileSystem.cs
@@ -55,8 +55,8 @@ public GlobbingFileSystem(IVirtualFileSystem fileSystem, string[] patterns, stri
ArgumentNullException.ThrowIfNull(patterns);
_fs = fileSystem;
- _patterns = patterns.ToArray();
- _excludes = excludes?.ToArray() ?? [];
+ _patterns = [..patterns];
+ _excludes = [..excludes ?? []];
}
///