Skip to content

Commit 2301b60

Browse files
authored
Merge pull request #632 from xuwei-k/scalafmt-new-syntax
update `.scalafmt.conf`. enforce new syntax
2 parents bb318cd + 590518f commit 2301b60

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

.scalafmt.conf

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ maxColumn: 120
33

44
runner.dialect = scala213source3
55

6-
fileOverride {
7-
"glob:**/scala-3/**" {
8-
runner.dialect = scala3
9-
}
10-
}
6+
project.layout = StandardConvention
7+
8+
rewrite.scala3.convertToNewSyntax = true
9+
rewrite.scala3.newSyntax.control = false
10+
runner.dialectOverride.allowUnderscoreAsTypePlaceholder = false
11+
runner.dialectOverride.allowSignificantIndentation = false
12+
runner.dialectOverride.allowStarWildcardImport = false
1113

1214
docstrings.wrap = "no"
1315

shared/src/main/scala-2/Literals.scala

+12-12
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object Literals {
2929
case None => Left("invalid IP address")
3030
}
3131
}
32-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[IpAddress] = apply(c)(args: _*)
32+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[IpAddress] = apply(c)(args*)
3333
}
3434

3535
object ipv4 extends Literally[Ipv4Address] {
@@ -40,7 +40,7 @@ object Literals {
4040
case None => Left("invalid IPv4 address")
4141
}
4242
}
43-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Ipv4Address] = apply(c)(args: _*)
43+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Ipv4Address] = apply(c)(args*)
4444
}
4545

4646
object ipv6 extends Literally[Ipv6Address] {
@@ -51,7 +51,7 @@ object Literals {
5151
case None => Left("invalid IPv6 address")
5252
}
5353
}
54-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Ipv6Address] = apply(c)(args: _*)
54+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Ipv6Address] = apply(c)(args*)
5555
}
5656

5757
object mip extends Literally[Multicast[IpAddress]] {
@@ -62,7 +62,7 @@ object Literals {
6262
case None => Left("invalid IP multicast address")
6363
}
6464
}
65-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Multicast[IpAddress]] = apply(c)(args: _*)
65+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Multicast[IpAddress]] = apply(c)(args*)
6666
}
6767

6868
object mipv4 extends Literally[Multicast[Ipv4Address]] {
@@ -73,7 +73,7 @@ object Literals {
7373
case None => Left("invalid IPv4 multicast address")
7474
}
7575
}
76-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Multicast[Ipv4Address]] = apply(c)(args: _*)
76+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Multicast[Ipv4Address]] = apply(c)(args*)
7777
}
7878

7979
object mipv6 extends Literally[Multicast[Ipv6Address]] {
@@ -84,7 +84,7 @@ object Literals {
8484
case None => Left("invalid IPv6 multicast address")
8585
}
8686
}
87-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Multicast[Ipv6Address]] = apply(c)(args: _*)
87+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Multicast[Ipv6Address]] = apply(c)(args*)
8888
}
8989

9090
object ssmip extends Literally[SourceSpecificMulticast.Strict[IpAddress]] {
@@ -96,7 +96,7 @@ object Literals {
9696
case None => Left("invalid source specific IP multicast address")
9797
}
9898
}
99-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[SourceSpecificMulticast.Strict[IpAddress]] = apply(c)(args: _*)
99+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[SourceSpecificMulticast.Strict[IpAddress]] = apply(c)(args*)
100100
}
101101

102102
object ssmipv4 extends Literally[SourceSpecificMulticast.Strict[Ipv4Address]] {
@@ -108,7 +108,7 @@ object Literals {
108108
case None => Left("invalid source specific IPv4 multicast address")
109109
}
110110
}
111-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[SourceSpecificMulticast.Strict[Ipv4Address]] = apply(c)(args: _*)
111+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[SourceSpecificMulticast.Strict[Ipv4Address]] = apply(c)(args*)
112112
}
113113

114114
object ssmipv6 extends Literally[SourceSpecificMulticast.Strict[Ipv6Address]] {
@@ -120,7 +120,7 @@ object Literals {
120120
case None => Left("invalid source specific IPv6 multicast address")
121121
}
122122
}
123-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[SourceSpecificMulticast.Strict[Ipv6Address]] = apply(c)(args: _*)
123+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[SourceSpecificMulticast.Strict[Ipv6Address]] = apply(c)(args*)
124124
}
125125

126126
object port extends Literally[Port] {
@@ -131,7 +131,7 @@ object Literals {
131131
case None => Left("invalid port")
132132
}
133133
}
134-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Port] = apply(c)(args: _*)
134+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Port] = apply(c)(args*)
135135
}
136136

137137
object hostname extends Literally[Hostname] {
@@ -142,7 +142,7 @@ object Literals {
142142
case None => Left("invalid hostname")
143143
}
144144
}
145-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Hostname] = apply(c)(args: _*)
145+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[Hostname] = apply(c)(args*)
146146
}
147147

148148
object idn extends Literally[IDN] {
@@ -153,6 +153,6 @@ object Literals {
153153
case None => Left("invalid IDN")
154154
}
155155
}
156-
def make(c: Context)(args: c.Expr[Any]*): c.Expr[IDN] = apply(c)(args: _*)
156+
def make(c: Context)(args: c.Expr[Any]*): c.Expr[IDN] = apply(c)(args*)
157157
}
158158
}

shared/src/main/scala/com/comcast/ip4s/Cidr.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ sealed class Cidr[+A <: IpAddress] protected (val address: A, val prefixBits: In
128128
override def hashCode: Int = MurmurHash3.productHash(this, productPrefix.hashCode)
129129
override def equals(other: Any): Boolean =
130130
other match {
131-
case that: Cidr[_] => address == that.address && prefixBits == that.prefixBits
131+
case that: Cidr[?] => address == that.address && prefixBits == that.prefixBits
132132
case _ => false
133133
}
134-
override def canEqual(other: Any): Boolean = other.isInstanceOf[Cidr[_]]
134+
override def canEqual(other: Any): Boolean = other.isInstanceOf[Cidr[?]]
135135
override def productArity: Int = 2
136136
override def productElement(n: Int): Any =
137137
n match {
@@ -155,7 +155,7 @@ object Cidr {
155155

156156
object Strict {
157157
def apply[A <: IpAddress](cidr: Cidr[A]): Cidr.Strict[A] = cidr match {
158-
case already: Strict[_] => already.asInstanceOf[Strict[A]]
158+
case already: Strict[?] => already.asInstanceOf[Strict[A]]
159159
case _ => new Cidr.Strict(cidr.prefix, cidr.prefixBits)
160160
}
161161
}

shared/src/main/scala/com/comcast/ip4s/Multicast.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object Multicast {
3131
private case class DefaultMulticast[+A <: IpAddress](address: A) extends Multicast[A] {
3232
override def toString: String = address.toString
3333
override def equals(that: Any): Boolean = that match {
34-
case m: Multicast[_] => address == m.address
34+
case m: Multicast[?] => address == m.address
3535
case _ => false
3636
}
3737
override def hashCode: Int = address.hashCode
@@ -72,7 +72,7 @@ object SourceSpecificMulticast {
7272
private case class DefaultSourceSpecificMulticast[+A <: IpAddress](address: A) extends SourceSpecificMulticast[A] {
7373
override def toString: String = address.toString
7474
override def equals(that: Any): Boolean = that match {
75-
case m: Multicast[_] => address == m.address
75+
case m: Multicast[?] => address == m.address
7676
case _ => false
7777
}
7878
override def hashCode: Int = address.hashCode

0 commit comments

Comments
 (0)