Skip to content

Commit a3e699c

Browse files
authored
Merge pull request #59 from SimonCropp/redundantMethods
remove some redundant methods
2 parents c10c56c + 9a6fed5 commit a3e699c

File tree

4 files changed

+2
-44
lines changed

4 files changed

+2
-44
lines changed

src/ZString.Unity/Assets/Scripts/ZString/NestedStringBuilderCreationException.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ namespace Cysharp.Text
55
// Currently, this class is internals.
66
internal class NestedStringBuilderCreationException : InvalidOperationException
77
{
8-
private NestedStringBuilderCreationException()
9-
{
10-
}
11-
128
internal protected NestedStringBuilderCreationException(string typeName, string extraMessage = "")
139
: base($"A nested call with `notNested: true`, or Either You forgot to call {typeName}.Dispose() of in the past.{extraMessage}")
1410
{

src/ZString.Unity/Assets/Scripts/ZString/Utf16ValueStringBuilder.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public void Append(ReadOnlySpan<char> value)
266266
{
267267
Grow(value.Length);
268268
}
269-
269+
270270
value.CopyTo(buffer.AsSpan(index));
271271
index += value.Length;
272272
}
@@ -632,10 +632,6 @@ static void ThrowFormatException()
632632
{
633633
throw new FormatException("Index (zero based) must be greater than or equal to zero and less than the size of the argument list.");
634634
}
635-
private static void FormatError()
636-
{
637-
throw new FormatException("Input string was not in a correct format.");
638-
}
639635

640636
void AppendFormatInternal<T>(T arg, int width, ReadOnlySpan<char> format, string argName)
641637
{
@@ -702,19 +698,6 @@ static void ThrowNestedException()
702698
throw new NestedStringBuilderCreationException(nameof(Utf16ValueStringBuilder));
703699
}
704700

705-
void AppendFormatInternal<T>(T arg1, ReadOnlySpan<char> format, string argName)
706-
{
707-
if (!FormatterCache<T>.TryFormatDelegate(arg1, buffer.AsSpan(index), out var written, format))
708-
{
709-
Grow(written);
710-
if (!FormatterCache<T>.TryFormatDelegate(arg1, buffer.AsSpan(index), out written, format))
711-
{
712-
ThrowArgumentException(argName);
713-
}
714-
}
715-
index += written;
716-
}
717-
718701
/// <summary>
719702
/// Register custom formatter
720703
/// </summary>

src/ZString/NestedStringBuilderCreationException.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ namespace Cysharp.Text
55
// Currently, this class is internals.
66
internal class NestedStringBuilderCreationException : InvalidOperationException
77
{
8-
private NestedStringBuilderCreationException()
9-
{
10-
}
11-
128
internal protected NestedStringBuilderCreationException(string typeName, string extraMessage = "")
139
: base($"A nested call with `notNested: true`, or Either You forgot to call {typeName}.Dispose() of in the past.{extraMessage}")
1410
{

src/ZString/Utf16ValueStringBuilder.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public void Append(ReadOnlySpan<char> value)
266266
{
267267
Grow(value.Length);
268268
}
269-
269+
270270
value.CopyTo(buffer.AsSpan(index));
271271
index += value.Length;
272272
}
@@ -632,10 +632,6 @@ static void ThrowFormatException()
632632
{
633633
throw new FormatException("Index (zero based) must be greater than or equal to zero and less than the size of the argument list.");
634634
}
635-
private static void FormatError()
636-
{
637-
throw new FormatException("Input string was not in a correct format.");
638-
}
639635

640636
void AppendFormatInternal<T>(T arg, int width, ReadOnlySpan<char> format, string argName)
641637
{
@@ -702,19 +698,6 @@ static void ThrowNestedException()
702698
throw new NestedStringBuilderCreationException(nameof(Utf16ValueStringBuilder));
703699
}
704700

705-
void AppendFormatInternal<T>(T arg1, ReadOnlySpan<char> format, string argName)
706-
{
707-
if (!FormatterCache<T>.TryFormatDelegate(arg1, buffer.AsSpan(index), out var written, format))
708-
{
709-
Grow(written);
710-
if (!FormatterCache<T>.TryFormatDelegate(arg1, buffer.AsSpan(index), out written, format))
711-
{
712-
ThrowArgumentException(argName);
713-
}
714-
}
715-
index += written;
716-
}
717-
718701
/// <summary>
719702
/// Register custom formatter
720703
/// </summary>

0 commit comments

Comments
 (0)