Skip to content

Commit 2e05b80

Browse files
committed
Update scalafmt
1 parent 8889beb commit 2e05b80

File tree

8 files changed

+220
-230
lines changed

8 files changed

+220
-230
lines changed

.scalafmt.conf

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
version=2.3.2
2-
maxColumn = 120
1+
version = 3.2.1
2+
maxColumn = 120
3+
runner.dialect = scala3
4+
fileOverride {
5+
"glob:**/scala-2/**" {
6+
runner.dialect = scala213
7+
}
8+
"glob:**/scala-2.13+/**" {
9+
runner.dialect = scala213
10+
}
11+
"glob:**/scala-2.13-/**" {
12+
runner.dialect = scala213
13+
}
14+
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.5.5
1+
sbt.version=1.5.7

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion)
66
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.7.0")
77
addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.1")
88

9-
val sbtSoftwareMillVersion = "2.0.8"
9+
val sbtSoftwareMillVersion = "2.0.9"
1010
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion)
1111
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)

quicklens/src/main/scala-2.13+/com.softwaremill.quicklens/package.scala

Lines changed: 44 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@ package object quicklens extends LowPriorityImplicits {
1313
private[softwaremill] def canOnlyBeUsedInsideModify(method: String) =
1414
s"$method can only be used inside modify"
1515

16-
/**
17-
* Create an object allowing modifying the given (deeply nested) field accessible in a `case class` hierarchy
18-
* via `path` on the given `obj`.
16+
/** Create an object allowing modifying the given (deeply nested) field accessible in a `case class` hierarchy via
17+
* `path` on the given `obj`.
1918
*
2019
* All modifications are side-effect free and create copies of the original objects.
2120
*
2221
* You can use `.each` to traverse options, lists, etc.
2322
*/
2423
def modify[T, U](obj: T)(path: T => U): PathModify[T, U] = macro QuicklensMacros.modify_impl[T, U]
2524

26-
/**
27-
* Create an object allowing modifying the given (deeply nested) fields accessible in a `case class` hierarchy
28-
* via `paths` on the given `obj`.
25+
/** Create an object allowing modifying the given (deeply nested) fields accessible in a `case class` hierarchy via
26+
* `paths` on the given `obj`.
2927
*
3028
* All modifications are side-effect free and create copies of the original objects.
3129
*
@@ -36,19 +34,17 @@ package object quicklens extends LowPriorityImplicits {
3634

3735
implicit class ModifyPimp[T](t: T) {
3836

39-
/**
40-
* Create an object allowing modifying the given (deeply nested) field accessible in a `case class` hierarchy
41-
* via `path` on the given `obj`.
37+
/** Create an object allowing modifying the given (deeply nested) field accessible in a `case class` hierarchy via
38+
* `path` on the given `obj`.
4239
*
4340
* All modifications are side-effect free and create copies of the original objects.
4441
*
4542
* You can use `.each` to traverse options, lists, etc.
4643
*/
4744
def modify[U](path: T => U): PathModify[T, U] = macro QuicklensMacros.modifyPimp_impl[T, U]
4845

49-
/**
50-
* Create an object allowing modifying the given (deeply nested) fields accessible in a `case class` hierarchy
51-
* via `paths` on the given `obj`.
46+
/** Create an object allowing modifying the given (deeply nested) fields accessible in a `case class` hierarchy via
47+
* `paths` on the given `obj`.
5248
*
5349
* All modifications are side-effect free and create copies of the original objects.
5450
*
@@ -59,16 +55,16 @@ package object quicklens extends LowPriorityImplicits {
5955

6056
case class PathModify[T, U](obj: T, doModify: (T, U => U) => T) {
6157

62-
/**
63-
* Transform the value of the field(s) using the given function.
58+
/** Transform the value of the field(s) using the given function.
6459
*
65-
* @return A copy of the root object with the (deeply nested) field(s) modified.
60+
* @return
61+
* A copy of the root object with the (deeply nested) field(s) modified.
6662
*/
6763
def using(mod: U => U): T = doModify(obj, mod)
6864

69-
/** An alias for [[using]]. Explicit calls to [[using]] are preferred over this alias, but quicklens provides
70-
* this option because code auto-formatters (like scalafmt) will generally not keep [[modify]]/[[using]]
71-
* pairs on the same line, leading to code like
65+
/** An alias for [[using]]. Explicit calls to [[using]] are preferred over this alias, but quicklens provides this
66+
* option because code auto-formatters (like scalafmt) will generally not keep [[modify]]/[[using]] pairs on the
67+
* same line, leading to code like
7268
* {{{
7369
* x
7470
* .modify(_.foo)
@@ -82,38 +78,37 @@ package object quicklens extends LowPriorityImplicits {
8278
* .modify(_.foo)(newFoo :: _)
8379
* .modify(_.bar)(_ + newBar)
8480
* }}}
85-
* */
81+
*/
8682
final def apply(mod: U => U): T = using(mod)
8783

88-
/**
89-
* Transform the value of the field(s) using the given function, if the condition is true. Otherwise, returns the
84+
/** Transform the value of the field(s) using the given function, if the condition is true. Otherwise, returns the
9085
* original object unchanged.
9186
*
92-
* @return A copy of the root object with the (deeply nested) field(s) modified, if `condition` is true.
87+
* @return
88+
* A copy of the root object with the (deeply nested) field(s) modified, if `condition` is true.
9389
*/
9490
def usingIf(condition: Boolean)(mod: U => U): T = if (condition) doModify(obj, mod) else obj
9591

96-
/**
97-
* Set the value of the field(s) to a new value.
92+
/** Set the value of the field(s) to a new value.
9893
*
99-
* @return A copy of the root object with the (deeply nested) field(s) set to the new value.
94+
* @return
95+
* A copy of the root object with the (deeply nested) field(s) set to the new value.
10096
*/
10197
def setTo(v: U): T = doModify(obj, _ => v)
10298

103-
/**
104-
* Set the value of the field(s) to a new value, if it is defined. Otherwise, returns the original object
99+
/** Set the value of the field(s) to a new value, if it is defined. Otherwise, returns the original object
105100
* unchanged.
106101
*
107-
* @return A copy of the root object with the (deeply nested) field(s) set to the new value, if it is defined.
102+
* @return
103+
* A copy of the root object with the (deeply nested) field(s) set to the new value, if it is defined.
108104
*/
109105
def setToIfDefined(v: Option[U]): T = v.fold(obj)(setTo)
110106

111-
/**
112-
* Set the value of the field(s) to a new value, if the condition is true. Otherwise, returns the original object
107+
/** Set the value of the field(s) to a new value, if the condition is true. Otherwise, returns the original object
113108
* unchanged.
114109
*
115-
* @return A copy of the root object with the (deeply nested) field(s) set to the new value, if `condition` is
116-
* true.
110+
* @return
111+
* A copy of the root object with the (deeply nested) field(s) set to the new value, if `condition` is true.
117112
*/
118113
def setToIf(condition: Boolean)(v: => U): T = if (condition) setTo(v) else obj
119114
}
@@ -142,38 +137,32 @@ package object quicklens extends LowPriorityImplicits {
142137

143138
self =>
144139

145-
/**
146-
* see [[PathModify.using]]
140+
/** see [[PathModify.using]]
147141
*/
148142
def using(mod: U => U): T => T = obj => doModify(obj, mod)
149143

150-
/**
151-
* see [[PathModify.usingIf]]
144+
/** see [[PathModify.usingIf]]
152145
*/
153146
def usingIf(condition: Boolean)(mod: U => U): T => T =
154147
obj =>
155148
if (condition) doModify(obj, mod)
156149
else obj
157150

158-
/**
159-
* see [[PathModify.setTo]]
151+
/** see [[PathModify.setTo]]
160152
*/
161153
def setTo(v: U): T => T = obj => doModify(obj, _ => v)
162154

163-
/**
164-
* see [[PathModify.setToIfDefined]]
155+
/** see [[PathModify.setToIfDefined]]
165156
*/
166157
def setToIfDefined(v: Option[U]): T => T = v.fold((obj: T) => obj)(setTo)
167158

168-
/**
169-
* see [[PathModify.setToIf]]
159+
/** see [[PathModify.setToIf]]
170160
*/
171161
def setToIf(condition: Boolean)(v: => U): T => T =
172162
if (condition) setTo(v)
173163
else obj => obj
174164

175-
/**
176-
* see [[AbstractPathModifyPimp]]
165+
/** see [[AbstractPathModifyPimp]]
177166
*/
178167
def andThenModify[V](f2: PathLazyModify[U, V]): PathLazyModify[T, V] =
179168
PathLazyModify[T, V]((t, vv) => self.doModify(t, u => f2.doModify(u, vv)))
@@ -213,8 +202,8 @@ package object quicklens extends LowPriorityImplicits {
213202
def index: T = sys.error("")
214203
}
215204

216-
implicit def traversableQuicklensFunctor[F[_], A](
217-
implicit fac: Factory[A, F[A]],
205+
implicit def traversableQuicklensFunctor[F[_], A](implicit
206+
fac: Factory[A, F[A]],
218207
ev: F[A] => Iterable[A]
219208
): QuicklensFunctor[F, A] =
220209
new QuicklensFunctor[F, A] {
@@ -233,8 +222,8 @@ package object quicklens extends LowPriorityImplicits {
233222
def index(fa: F[T], idx: Int)(f: T => T): F[T]
234223
}
235224

236-
implicit class QuicklensMapAt[M[KT, TT], K, T](t: M[K, T])(
237-
implicit f: QuicklensMapAtFunctor[M, K, T]
225+
implicit class QuicklensMapAt[M[KT, TT], K, T](t: M[K, T])(implicit
226+
f: QuicklensMapAtFunctor[M, K, T]
238227
) {
239228
@compileTimeOnly(canOnlyBeUsedInsideModify("at"))
240229
def at(idx: K): T = sys.error("")
@@ -256,8 +245,8 @@ package object quicklens extends LowPriorityImplicits {
256245
def each(fa: F[K, T])(f: T => T): F[K, T]
257246
}
258247

259-
implicit def mapQuicklensFunctor[M[KT, TT] <: Map[KT, TT], K, T](
260-
implicit fac: Factory[(K, T), M[K, T]]
248+
implicit def mapQuicklensFunctor[M[KT, TT] <: Map[KT, TT], K, T](implicit
249+
fac: Factory[(K, T), M[K, T]]
261250
): QuicklensMapAtFunctor[M, K, T] = new QuicklensMapAtFunctor[M, K, T] {
262251
override def at(fa: M[K, T], key: K)(f: T => T): M[K, T] =
263252
fa.updated(key, f(fa(key))).to(fac)
@@ -270,14 +259,14 @@ package object quicklens extends LowPriorityImplicits {
270259
}
271260
}
272261

273-
implicit def seqQuicklensAtFunctor[F[_], T](
274-
implicit fac: Factory[T, F[T]],
262+
implicit def seqQuicklensAtFunctor[F[_], T](implicit
263+
fac: Factory[T, F[T]],
275264
ev: F[T] => Seq[T]
276265
): QuicklensAtFunctor[F, T] =
277266
new QuicklensAtFunctor[F, T] {
278-
override def at(fa: F[T], idx: Int)(f: T => T):F[T] =
267+
override def at(fa: F[T], idx: Int)(f: T => T): F[T] =
279268
fa.updated(idx, f(fa(idx))).to(fac)
280-
override def index(fa: F[T], idx: Int)(f: T => T):F[T] =
269+
override def index(fa: F[T], idx: Int)(f: T => T): F[T] =
281270
if (idx < fa.size) fa.updated(idx, f(fa(idx))).to(fac) else fa
282271
}
283272

@@ -310,8 +299,7 @@ sealed trait LowPriorityImplicits {
310299

311300
import quicklens._
312301

313-
/**
314-
* `QuicklensEach` is in `LowPriorityImplicits` to not conflict with the `QuicklensMapAtFunctor` on `each` calls.
302+
/** `QuicklensEach` is in `LowPriorityImplicits` to not conflict with the `QuicklensMapAtFunctor` on `each` calls.
315303
*/
316304
implicit class QuicklensEach[F[_], T](t: F[T])(implicit f: QuicklensFunctor[F, T]) {
317305
@compileTimeOnly(canOnlyBeUsedInsideModify("each"))

0 commit comments

Comments
 (0)