Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 3f3e71c

Browse files
committed
code-base style: statements with single control-flow expr (return/throw) don't need braces
1 parent 135b60e commit 3f3e71c

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

src/ServiceStack.Text/Support/StringSegmentExtensions.cs

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,7 @@ public static decimal ParseDecimal(this StringSegment value, bool allowThousands
416416
state = ParseState.FractionNumber;
417417

418418
if (i == end)
419-
{
420419
throw new FormatException(BadFormat);
421-
}
422420
}
423421
else if (c == '0')
424422
{
@@ -429,10 +427,7 @@ public static decimal ParseDecimal(this StringSegment value, bool allowThousands
429427
preResult = (ulong)(c - '0');
430428
state = ParseState.Number;
431429
}
432-
else
433-
{
434-
throw new FormatException(BadFormat);
435-
}
430+
else throw new FormatException(BadFormat);
436431
break;
437432
case ParseState.Sign:
438433
if (c == '.')
@@ -441,9 +436,7 @@ public static decimal ParseDecimal(this StringSegment value, bool allowThousands
441436
state = ParseState.FractionNumber;
442437

443438
if (i == end)
444-
{
445439
throw new FormatException(BadFormat);
446-
}
447440
}
448441
else if (c == '0')
449442
{
@@ -454,10 +447,7 @@ public static decimal ParseDecimal(this StringSegment value, bool allowThousands
454447
preResult = (ulong)(c - '0');
455448
state = ParseState.Number;
456449
}
457-
else
458-
{
459-
throw new FormatException(BadFormat);
460-
}
450+
else throw new FormatException(BadFormat);
461451
break;
462452
case ParseState.Number:
463453
if (c == '.')
@@ -490,20 +480,14 @@ public static decimal ParseDecimal(this StringSegment value, bool allowThousands
490480
else if (allowThousands && c == ',')
491481
{
492482
}
493-
else
494-
{
495-
throw new FormatException(BadFormat);
496-
}
483+
else throw new FormatException(BadFormat);
497484
break;
498485
case ParseState.DecimalPoint:
499486
if (c == '.')
500487
{
501488
state = ParseState.FractionNumber;
502489
}
503-
else
504-
{
505-
throw new FormatException(BadFormat);
506-
}
490+
else throw new FormatException(BadFormat);
507491
break;
508492
case ParseState.FractionNumber:
509493
if (JsonUtils.IsWhiteSpace(c))
@@ -538,10 +522,7 @@ public static decimal ParseDecimal(this StringSegment value, bool allowThousands
538522
}
539523
scale++;
540524
}
541-
else
542-
{
543-
throw new FormatException(BadFormat);
544-
}
525+
else throw new FormatException(BadFormat);
545526
break;
546527
case ParseState.Exponent:
547528
bool expNegative = false;
@@ -602,10 +583,7 @@ public static decimal ParseDecimal(this StringSegment value, bool allowThousands
602583
//set i to end of string, because ParseInt16 eats number and all trailing whites
603584
i = end;
604585
}
605-
else
606-
{
607-
throw new FormatException(BadFormat);
608-
}
586+
else throw new FormatException(BadFormat);
609587
break;
610588
case ParseState.TrailingWhite:
611589
if (!JsonUtils.IsWhiteSpace(c))

0 commit comments

Comments
 (0)