Skip to content

Commit b9ef010

Browse files
author
Chris Martinez
committed
Fixed unreachable warning from logic error
1 parent b346d22 commit b9ef010

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Common/Versioning/ApiVersionFormatProvider.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace Microsoft.AspNetCore.Mvc.Versioning
1212
using System.Globalization;
1313
using System.Reflection;
1414
using System.Text;
15+
using static System.Char;
1516
using static System.Globalization.DateTimeFormatInfo;
1617
using static System.String;
1718

@@ -492,7 +493,7 @@ public virtual object GetFormat( Type formatType )
492493
/// <param name="format">The format string to apply to the argument.</param>
493494
/// <param name="arg">The argument to format.</param>
494495
/// <param name="formatProvider">The <see cref="IFormatProvider"/> used to format the argument.</param>
495-
/// <returns>A <see cref="String">string</see> represeting the formatted argument.</returns>
496+
/// <returns>A <see cref="string">string</see> represeting the formatted argument.</returns>
496497
public virtual string Format( string format, object arg, IFormatProvider formatProvider )
497498
{
498499
if ( !( arg is ApiVersion value ) )
@@ -911,14 +912,16 @@ static void ConsumeCustomFormat( ICollection<FormatToken> tokens, StringBuilder
911912
token.Append( ch );
912913
}
913914

914-
for ( var j = i; j < format.Length; j++, i++ )
915+
for ( ; i < format.Length; i++ )
915916
{
916-
if ( char.IsNumber( ch = format[i] ) )
917+
if ( IsNumber( ch = format[i] ) )
917918
{
918919
token.Append( ch );
919920
}
920-
921-
break;
921+
else
922+
{
923+
break;
924+
}
922925
}
923926

924927
tokens.Add( new FormatToken( token.ToString() ) );

0 commit comments

Comments
 (0)