Skip to content

Commit 100086a

Browse files
authored
Update scalafmt to 3.0.1 (twitter#998)
* Update scalafmt to 3.0.1 * fixup! Update scalafmt to 3.0.1 * fixup! Update scalafmt to 3.0.1
1 parent 601a901 commit 100086a

File tree

116 files changed

+1753
-2008
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1753
-2008
lines changed

.scalafmt.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
version=2.7.5
1+
version=3.0.1
22
maxColumn = 110
3-
docstrings = JavaDoc
3+
docstrings.style = Asterisk
44
newlines.alwaysBeforeMultilineDef = false
55
newlines.penalizeSingleSelectMultiArgList = false
66
align.openParenCallSite = false

algebird-benchmark/src/main/scala/com/twitter/algebird/benchmark/CMSHashingBenchmark.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import com.twitter.algebird.CMSHasher
66
/**
77
* Benchmarks the hashing algorithms used by Count-Min sketch for CMS[BigInt].
88
*
9-
* The input values are generated ahead of time to ensure that each trial uses the same input (and that the RNG is not
10-
* influencing the runtime of the trials).
9+
* The input values are generated ahead of time to ensure that each trial uses the same input (and that the
10+
* RNG is not influencing the runtime of the trials).
1111
*
1212
* More details available at https://github.com/twitter/algebird/issues/392.
1313
*/

algebird-bijection/src/main/scala/com/twitter/algebird/bijection/AlgebirdBijections.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ import com.twitter.bijection.{AbstractBijection, Bijection, ImplicitBijection, R
2222
/**
2323
* Bijections on Algebird's abstract algebra datatypes.
2424
*
25-
* @author Oscar Boykin
26-
* @author Sam Ritchie
25+
* @author
26+
* Oscar Boykin
27+
* @author
28+
* Sam Ritchie
2729
*/
2830
class BijectedSemigroup[T, U](implicit val sg: Semigroup[T], bij: ImplicitBijection[T, U])
2931
extends InvariantSemigroup[T, U](bij.bijection.toFunction, bij.bijection.inverse.toFunction) {

algebird-core/src/main/scala-2.13+/com/twitter/algebird/compat.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ private[algebird] trait CompatFold {
2121
* Simple Fold that collects elements into a container.
2222
*/
2323
def container[I, C[_]](implicit cbf: Factory[I, C[I]]): Fold[I, C[I]] =
24-
Fold.foldMutable[Builder[I, C[I]], I, C[I]]({ case (b, i) => b += i }, { _ =>
25-
cbf.newBuilder
26-
}, { _.result })
24+
Fold.foldMutable[Builder[I, C[I]], I, C[I]](
25+
{ case (b, i) => b += i },
26+
_ => cbf.newBuilder,
27+
_.result
28+
)
2729
}
2830

2931
private[algebird] trait CompatDecayedVector {

algebird-core/src/main/scala/com/twitter/algebird/AdaptiveCache.scala

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ limitations under the License.
1717
package com.twitter.algebird
1818

1919
/**
20-
* @author Avi Bryant
20+
* @author
21+
* Avi Bryant
2122
*/
2223
import collection.mutable.HashMap
2324
import ref.SoftReference
2425

2526
/**
26-
* This is a summing cache whose goal is to grow until we run out of memory,
27-
* at which point it clears itself and stops growing.
28-
* Note that we can lose the values in this cache at any point;
29-
* we don't put anything here we care about.
27+
* This is a summing cache whose goal is to grow until we run out of memory, at which point it clears itself
28+
* and stops growing. Note that we can lose the values in this cache at any point; we don't put anything here
29+
* we care about.
3030
*/
3131
class SentinelCache[K, V](implicit sgv: Semigroup[V]) {
3232
private val map = new SoftReference(new HashMap[K, V]())
@@ -52,13 +52,11 @@ class SentinelCache[K, V](implicit sgv: Semigroup[V]) {
5252
}
5353

5454
/**
55-
* This is a wrapper around SummingCache that attempts to grow the capacity
56-
* by up to some maximum, as long as there's enough RAM.
57-
* It determines that there's enough RAM to grow by maintaining a SentinelCache
58-
* which keeps caching and summing the evicted values.
59-
* Once the SentinelCache has grown to the same size as the current cache,
60-
* plus some margin, without running out of RAM, then this indicates that we
61-
* have enough headroom to double the capacity.
55+
* This is a wrapper around SummingCache that attempts to grow the capacity by up to some maximum, as long as
56+
* there's enough RAM. It determines that there's enough RAM to grow by maintaining a SentinelCache which
57+
* keeps caching and summing the evicted values. Once the SentinelCache has grown to the same size as the
58+
* current cache, plus some margin, without running out of RAM, then this indicates that we have enough
59+
* headroom to double the capacity.
6260
*/
6361
class AdaptiveCache[K, V: Semigroup](maxCapacity: Int, growthMargin: Double = 3.0)
6462
extends StatefulSummer[Map[K, V]] {

algebird-core/src/main/scala/com/twitter/algebird/AdjoinedUnitRing.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import algebra.ring.Rng
1919

2020
/**
2121
* This is for the case where your Ring[T] is a Rng (i.e. there is no unit).
22-
* @see http://en.wikipedia.org/wiki/Pseudo-ring#Adjoining_an_identity_element
22+
* @see
23+
* http://en.wikipedia.org/wiki/Pseudo-ring#Adjoining_an_identity_element
2324
*/
2425
case class AdjoinedUnit[T](ones: BigInt, get: T) {
2526
def unwrap: Option[T] = if (ones == 0) Some(get) else None

algebird-core/src/main/scala/com/twitter/algebird/AffineFunction.scala

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ limitations under the License.
1717
package com.twitter.algebird
1818

1919
/**
20-
* Represents functions of the kind:
21-
* f(x) = slope * x + intercept
20+
* Represents functions of the kind: f(x) = slope * x + intercept
2221
*/
2322
case class AffineFunction[R](slope: R, intercept: R) extends java.io.Serializable {
2423
def toFn(implicit ring: Ring[R]): Function1[R, R] = { x => this.apply(x)(ring) }
@@ -27,13 +26,11 @@ case class AffineFunction[R](slope: R, intercept: R) extends java.io.Serializabl
2726
}
2827

2928
/**
30-
* This feeds the value in on the LEFT!!! This may seem counter intuitive, but
31-
* with this approach, a stream/iterator which is summed will have the same output
32-
* as applying the function one at a time in order to the input.
33-
* If we did the "lexigraphically correct" thing, which might be (f+g)(x) = f(g(x))
34-
* then we would wind up reversing the list in the sum.
35-
* (f1 + f2)(x) = f2(f1(x)) so that:
36-
* listOfFn.foldLeft(x) { (v, fn) => fn(v) } = (Monoid.sum(listOfFn))(x)
29+
* This feeds the value in on the LEFT!!! This may seem counter intuitive, but with this approach, a
30+
* stream/iterator which is summed will have the same output as applying the function one at a time in order
31+
* to the input. If we did the "lexigraphically correct" thing, which might be (f+g)(x) = f(g(x)) then we
32+
* would wind up reversing the list in the sum. (f1 + f2)(x) = f2(f1(x)) so that: listOfFn.foldLeft(x) { (v,
33+
* fn) => fn(v) } = (Monoid.sum(listOfFn))(x)
3734
*/
3835
class AffineFunctionMonoid[R](implicit ring: Ring[R]) extends Monoid[AffineFunction[R]] {
3936
override lazy val zero: AffineFunction[R] = AffineFunction[R](ring.one, ring.zero)

0 commit comments

Comments
 (0)