Skip to content

Commit

Permalink
remove some bool expressions where the result is known (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Feb 17, 2024
1 parent a3af303 commit d5e1c82
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ string Convert(int number, bool isOrdinal)
var lastPart = TensMap[number / 10];
if (number % 10 > 0)
{
lastPart = $"{GetUnitValue(number % 10, false)} en {(isOrdinal ? GetUnitValue(lastPartValue, isOrdinal) : lastPart)}";
lastPart = $"{GetUnitValue(number % 10, false)} en {(isOrdinal ? GetUnitValue(lastPartValue, true) : lastPart)}";
}
else if (number % 10 == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override string Convert(long input)
number %= 100;
}

if (number >= 20 && number / 10 > 0)
if (number >= 20)
{
parts.Add($"{Convert(number / 10)}kymmentä");
number %= 10;
Expand Down Expand Up @@ -128,7 +128,7 @@ static string ToOrdinal(int number, bool useExceptions)
number %= 100;
}

if (number >= 20 && number / 10 > 0)
if (number >= 20)
{
parts.Add($"{ToOrdinal(number / 10, true)}kymmenes");
number %= 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public override string ConvertToOrdinal(int number)
}

// suffix -de/-te
if (divided > 0 && number % m.Value == 0)
if (number % m.Value == 0)
{
switch (number)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Humanizer/TimeSpanHumanizeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static IEnumerable<string> CreateTheTimePartsWithUpperAndLowerLimits(TimeSpan ti
if (IsContainingOnlyNullValue(timeParts))
{
var noTimeValueCultureFormatted = toWords ? cultureFormatter.TimeSpanHumanize_Zero()
: cultureFormatter.TimeSpanHumanize(minUnit, 0, toWords);
: cultureFormatter.TimeSpanHumanize(minUnit, 0);
timeParts = CreateTimePartsWithNoTimeValue(noTimeValueCultureFormatted);
}
return timeParts;
Expand Down

0 comments on commit d5e1c82

Please sign in to comment.