Skip to content

Commit 94e176c

Browse files
committed
ScalafmtPlugin: extension to run unit Initialize
1 parent 6d173d9 commit 94e176c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,9 @@ object ScalafmtPlugin extends AutoPlugin {
499499

500500
override def projectSettings: Seq[Def.Setting[_]] =
501501
Seq(Compile, Test, IntegrationTest).flatMap(scalafmtConfigSettings) ++ Seq(
502-
scalafmtAll := scalafmt.?.all(anyConfigsInThisProject).map(_ => ()).value,
502+
scalafmtAll := scalafmt.?.all(anyConfigsInThisProject).unit.value,
503503
scalafmtCheckAll := scalafmtCheck.?.all(anyConfigsInThisProject)
504-
.map(_ => ()).value,
504+
.unit.value,
505505
)
506506

507507
override def buildSettings: Seq[Def.Setting[_]] =
@@ -538,4 +538,10 @@ object ScalafmtPlugin extends AutoPlugin {
538538
}
539539
}
540540

541+
private implicit class ImplicitInitialize[T](
542+
private val obj: Def.Initialize[Task[T]],
543+
) extends AnyVal {
544+
def unit = obj.map(_ => ())
545+
}
546+
541547
}

0 commit comments

Comments
 (0)