Skip to content

Commit 0ce5929

Browse files
Refactor: use global usings and modernize object creation
Removed redundant usings in favor of global usings in _Global.cs, streamlining imports across the codebase. Reformatted object instantiations to use concise new(...) syntax for consistency. Made minor formatting improvements for readability. No functional changes.
1 parent 6823686 commit 0ce5929

5 files changed

Lines changed: 6 additions & 12 deletions

File tree

Analyzers/SplitAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ private static void AnalyzeElementAccess(SyntaxNodeAnalysisContext context)
140140
}
141141

142142
var argument = elementAccess.ArgumentList.Arguments[0];
143-
if (argument.Expression is not LiteralExpressionSyntax literal
144-
|| literal.Token.ValueText != "0")
143+
if (argument.Expression is not LiteralExpressionSyntax literal
144+
|| literal.Token.ValueText != "0")
145145
{
146146
return;
147147
}

Benchmarks/StringConcatTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using BenchmarkDotNet.Attributes;
22
using Microsoft.Extensions.Primitives;
33
using System.Text;
4-
using Open.Text;
54
using ZLinq;
65

76
namespace Open.Text.Benchmarks;

Source.ZLinq/Extensions.StringSegment.NoAlloc.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using ZLinq;
2-
31
namespace Open.Text;
42

53
/// <summary>
@@ -29,7 +27,7 @@ public static ValueEnumerable<StringSegmentSplitEnumerator, StringSegment> Split
2927
char splitCharacter,
3028
StringSplitOptions options = StringSplitOptions.None)
3129
=> source.HasValue
32-
? new (new StringSegmentSplitEnumerator(source, splitCharacter, options))
30+
? new(new StringSegmentSplitEnumerator(source, splitCharacter, options))
3331
: throw new ArgumentNullException(nameof(source), "Must be a StringSegment that has a value (is not null).");
3432

3533
/// <summary>
@@ -52,7 +50,7 @@ public static ValueEnumerable<RegexSplitSegmentEnumerator, StringSegment> SplitA
5250
if (pattern is null) throw new ArgumentNullException(nameof(pattern));
5351
Contract.EndContractBlock();
5452

55-
return new (new RegexSplitSegmentEnumerator(source, pattern, options));
53+
return new(new RegexSplitSegmentEnumerator(source, pattern, options));
5654
}
5755

5856
/// <summary>
@@ -99,7 +97,7 @@ public static ValueEnumerable<StringSegmentJoinEnumerator, StringSegment> JoinNo
9997
this IEnumerable<StringSegment> source, StringSegment between)
10098
=> source is null
10199
? throw new ArgumentNullException(nameof(source))
102-
: new (new StringSegmentJoinEnumerator(source, between));
100+
: new(new StringSegmentJoinEnumerator(source, between));
103101

104102
/// <summary>
105103
/// Joins a regex split sequence of segments with a separator sequence (zero-allocation).

Source.ZLinq/RegexExtensions.NoAlloc.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using ZLinq;
2-
31
namespace Open.Text;
42

53
/// <summary>

Source.ZLinq/_Global.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
global using Microsoft.Extensions.Primitives;
12
global using System;
23
global using System.Collections.Generic;
3-
global using System.Diagnostics;
44
global using System.Diagnostics.CodeAnalysis;
55
global using System.Diagnostics.Contracts;
66
global using System.Text.RegularExpressions;
7-
global using Microsoft.Extensions.Primitives;
87
global using ZLinq;

0 commit comments

Comments
 (0)