Skip to content

Commit 0a3a265

Browse files
authored
Merge pull request #409 from cquiroz/sfmt
2 parents 1ca7308 + fda4917 commit 0a3a265

File tree

12 files changed

+48
-47
lines changed

12 files changed

+48
-47
lines changed

.scalafmt.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "3.5.2"
1+
version = "3.5.9"
22
style = default
33

44
maxColumn = 100

core/shared/src/main/scala/org/threeten/bp/LocalTime.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ final class LocalTime(_hour: Int, _minute: Int, _second: Int, private val nano:
588588
case MICRO_OF_SECOND => nano.toLong / 1000L
589589
case MICRO_OF_DAY => throw new DateTimeException(s"Field too large for an int: $field")
590590
case MILLI_OF_SECOND => nano.toLong / 1000000L
591-
case MILLI_OF_DAY => (toNanoOfDay / 1000000L)
591+
case MILLI_OF_DAY => toNanoOfDay / 1000000L
592592
case SECOND_OF_MINUTE => second.toLong
593593
case SECOND_OF_DAY => toSecondOfDay.toLong
594594
case MINUTE_OF_HOUR => minute.toLong

core/shared/src/main/scala/org/threeten/bp/ZonedDateTime.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ final class ZonedDateTime(
615615
field match {
616616
case _: ChronoField => true
617617
case _ =>
618-
(field != null && field.isSupportedBy(this))
618+
field != null && field.isSupportedBy(this)
619619
}
620620

621621
def isSupported(unit: TemporalUnit): Boolean =

core/shared/src/main/scala/org/threeten/bp/chrono/HijrahDate.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ object HijrahDate {
525525
}
526526
if (cycleDays == null)
527527
cycleDays = java.lang.Long.valueOf(cycleNumber.toLong * 10631)
528-
(cycleDays.longValue + dayInCycle + HIJRAH_JAN_1_1_GREGORIAN_DAY - 1)
528+
cycleDays.longValue + dayInCycle + HIJRAH_JAN_1_1_GREGORIAN_DAY - 1
529529
}
530530

531531
/**

core/shared/src/main/scala/org/threeten/bp/chrono/IsoChronology.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,14 @@ final class IsoChronology private () extends Chronology with Serializable {
374374
if (year != null)
375375
updateResolveMap(fieldValues,
376376
YEAR,
377-
(if (year > 0) yoeLong else Math.subtractExact(1, yoeLong))
377+
if (year > 0) yoeLong else Math.subtractExact(1, yoeLong)
378378
)
379379
else fieldValues.put(YEAR_OF_ERA, yoeLong)
380380
else
381381
updateResolveMap(
382382
fieldValues,
383383
YEAR,
384-
(if (year == null || year > 0) yoeLong else Math.subtractExact(1, yoeLong))
384+
if (year == null || year > 0) yoeLong else Math.subtractExact(1, yoeLong)
385385
)
386386
} else if (era.longValue == 1L)
387387
updateResolveMap(fieldValues, YEAR, yoeLong)

core/shared/src/main/scala/org/threeten/bp/format/internal/TTBPSimpleDateTimeTextProvider.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ object TTBPSimpleDateTimeTextProvider {
9595
val continue = !acc.contains(v)
9696
(continue, acc + (v -> (v -> k)))
9797
}
98-
val list = reverse._2.values.toList.sortBy(x => (-x._1.length))
98+
val list = reverse._2.values.toList.sortBy(x => -x._1.length)
9999
(all ::: list, map + (style -> list))
100100
}
101-
(u._1.sortBy(x => (-x._1.length)), u._2)
101+
(u._1.sortBy(x => -x._1.length), u._2)
102102
}
103103

104104
/**

core/shared/src/main/scala/org/threeten/bp/temporal/TemporalAdjusters.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ object TemporalAdjusters {
295295
val temp: Temporal = temporal.`with`(DAY_OF_MONTH, temporal.range(DAY_OF_MONTH).getMaximum)
296296
val curDow: Int = temp.get(DAY_OF_WEEK)
297297
var daysDiff: Int = dowValue - curDow
298-
daysDiff = if (daysDiff == 0) 0 else (if (daysDiff > 0) daysDiff - 7 else daysDiff)
298+
daysDiff = if (daysDiff == 0) 0 else if (daysDiff > 0) daysDiff - 7 else daysDiff
299299
daysDiff -= ((-ordinal - 1L) * 7L).toInt
300300
temp.plus(daysDiff.toLong, DAYS)
301301
}

core/shared/src/main/scala/org/threeten/bp/zone/StandardZoneRules.scala

+25-24
Original file line numberDiff line numberDiff line change
@@ -194,30 +194,31 @@ final class StandardZoneRules private (
194194
wallOffsets: Array[ZoneOffset],
195195
lastRules: Array[ZoneOffsetTransitionRule]
196196
) =
197-
this(standardTransitions,
198-
standardOffsets,
199-
savingsInstantTransitions,
200-
wallOffsets,
201-
lastRules, {
202-
val localTransitionList: java.util.List[LocalDateTime] =
203-
new java.util.ArrayList[LocalDateTime]
204-
var i: Int = 0
205-
while (i < savingsInstantTransitions.length) {
206-
val before: ZoneOffset = wallOffsets(i)
207-
val after: ZoneOffset = wallOffsets(i + 1)
208-
val trans: ZoneOffsetTransition =
209-
new ZoneOffsetTransition(savingsInstantTransitions(i), before, after)
210-
if (trans.isGap) {
211-
localTransitionList.add(trans.getDateTimeBefore)
212-
localTransitionList.add(trans.getDateTimeAfter)
213-
} else {
214-
localTransitionList.add(trans.getDateTimeAfter)
215-
localTransitionList.add(trans.getDateTimeBefore)
216-
}
217-
i += 1
218-
}
219-
localTransitionList.toArray(new Array[LocalDateTime](localTransitionList.size))
220-
}
197+
this(
198+
standardTransitions,
199+
standardOffsets,
200+
savingsInstantTransitions,
201+
wallOffsets,
202+
lastRules, {
203+
val localTransitionList: java.util.List[LocalDateTime] =
204+
new java.util.ArrayList[LocalDateTime]
205+
var i: Int = 0
206+
while (i < savingsInstantTransitions.length) {
207+
val before: ZoneOffset = wallOffsets(i)
208+
val after: ZoneOffset = wallOffsets(i + 1)
209+
val trans: ZoneOffsetTransition =
210+
new ZoneOffsetTransition(savingsInstantTransitions(i), before, after)
211+
if (trans.isGap) {
212+
localTransitionList.add(trans.getDateTimeBefore)
213+
localTransitionList.add(trans.getDateTimeAfter)
214+
} else {
215+
localTransitionList.add(trans.getDateTimeAfter)
216+
localTransitionList.add(trans.getDateTimeBefore)
217+
}
218+
i += 1
219+
}
220+
localTransitionList.toArray(new Array[LocalDateTime](localTransitionList.size))
221+
}
221222
)
222223

223224
def isFixedOffset: Boolean = savingsInstantTransitions.length == 0

tests/shared/src/test/scala/org/threeten/bp/chrono/TestChronoLocalDate.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ object TestChronoLocalDate {
160160

161161
class TestChronoLocalDate extends AnyFunSuite with AssertionsHelper {
162162
val data_of_calendars: List[Chronology] =
163-
List[Chronology]((HijrahChronology.INSTANCE),
164-
(IsoChronology.INSTANCE),
163+
List[Chronology](HijrahChronology.INSTANCE,
164+
IsoChronology.INSTANCE,
165165
// (JapaneseChronology.INSTANCE),
166-
(MinguoChronology.INSTANCE),
167-
(ThaiBuddhistChronology.INSTANCE)
166+
MinguoChronology.INSTANCE,
167+
ThaiBuddhistChronology.INSTANCE
168168
)
169169

170170
test("test_badWithAdjusterChrono") {

tests/shared/src/test/scala/org/threeten/bp/chrono/TestChronoLocalDateTime.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ object TestChronoLocalDateTime {
159159

160160
class TestChronoLocalDateTime extends AnyFunSuite with AssertionsHelper {
161161
val data_of_calendars: List[Chronology] =
162-
List((HijrahChronology.INSTANCE),
163-
(IsoChronology.INSTANCE),
162+
List(HijrahChronology.INSTANCE,
163+
IsoChronology.INSTANCE,
164164
// (JapaneseChronology.INSTANCE),
165-
(MinguoChronology.INSTANCE),
166-
(ThaiBuddhistChronology.INSTANCE)
165+
MinguoChronology.INSTANCE,
166+
ThaiBuddhistChronology.INSTANCE
167167
)
168168

169169
test("test_badWithAdjusterChrono") {

tests/shared/src/test/scala/org/threeten/bp/chrono/TestChronoZonedDateTime.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ object TestChronoZonedDateTime {
160160

161161
class TestChronoZonedDateTime extends AnyFunSuite with AssertionsHelper {
162162
val data_of_calendars: List[Chronology] =
163-
List((HijrahChronology.INSTANCE),
164-
(IsoChronology.INSTANCE),
163+
List(HijrahChronology.INSTANCE,
164+
IsoChronology.INSTANCE,
165165
// (JapaneseChronology.INSTANCE),
166-
(MinguoChronology.INSTANCE),
167-
(ThaiBuddhistChronology.INSTANCE)
166+
MinguoChronology.INSTANCE,
167+
ThaiBuddhistChronology.INSTANCE
168168
)
169169

170170
test("test_badWithAdjusterChrono") {

tests/shared/src/test/scala/org/threeten/bp/format/TestNumberParser.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class TestNumberParser extends AnyFunSuite with GenTestPrinterParser with Assert
276276

277277
test("parseSignsStrict") {
278278
provider_parseSignsStrict.foreach {
279-
case (input: String) :: (min: Int) :: (max: Int) :: (style: SignStyle) :: (parseLen: Int) ::(Some(
279+
case (input: String) :: (min: Int) :: (max: Int) :: (style: SignStyle) :: (parseLen: Int) :: (Some(
280280
parseVal: Int
281281
)) :: Nil =>
282282
super.beforeEach()
@@ -382,7 +382,7 @@ class TestNumberParser extends AnyFunSuite with GenTestPrinterParser with Assert
382382

383383
test("parseSignsLenient") {
384384
provider_parseSignsLenient.foreach {
385-
case (input: String) :: (min: Int) :: (max: Int) :: (style: SignStyle) :: (parseLen: Int) ::(Some(
385+
case (input: String) :: (min: Int) :: (max: Int) :: (style: SignStyle) :: (parseLen: Int) :: (Some(
386386
parseVal: Int
387387
)) :: Nil =>
388388
super.beforeEach()

0 commit comments

Comments
 (0)