Skip to content

Commit

Permalink
Merge pull request #632 from xuwei-k/scalafmt-new-syntax
Browse files Browse the repository at this point in the history
update `.scalafmt.conf`. enforce new syntax
  • Loading branch information
mpilquist authored Jan 19, 2025
2 parents bb318cd + 590518f commit 2301b60
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
12 changes: 7 additions & 5 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ maxColumn: 120

runner.dialect = scala213source3

fileOverride {
"glob:**/scala-3/**" {
runner.dialect = scala3
}
}
project.layout = StandardConvention

rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.newSyntax.control = false
runner.dialectOverride.allowUnderscoreAsTypePlaceholder = false
runner.dialectOverride.allowSignificantIndentation = false
runner.dialectOverride.allowStarWildcardImport = false

docstrings.wrap = "no"

24 changes: 12 additions & 12 deletions shared/src/main/scala-2/Literals.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object Literals {
case None => Left("invalid IP address")
}
}
def make(c: Context)(args: c.Expr[Any]*): c.Expr[IpAddress] = apply(c)(args: _*)
def make(c: Context)(args: c.Expr[Any]*): c.Expr[IpAddress] = apply(c)(args*)
}

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

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

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

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

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

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

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

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

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

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

object idn extends Literally[IDN] {
Expand All @@ -153,6 +153,6 @@ object Literals {
case None => Left("invalid IDN")
}
}
def make(c: Context)(args: c.Expr[Any]*): c.Expr[IDN] = apply(c)(args: _*)
def make(c: Context)(args: c.Expr[Any]*): c.Expr[IDN] = apply(c)(args*)
}
}
6 changes: 3 additions & 3 deletions shared/src/main/scala/com/comcast/ip4s/Cidr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ sealed class Cidr[+A <: IpAddress] protected (val address: A, val prefixBits: In
override def hashCode: Int = MurmurHash3.productHash(this, productPrefix.hashCode)
override def equals(other: Any): Boolean =
other match {
case that: Cidr[_] => address == that.address && prefixBits == that.prefixBits
case that: Cidr[?] => address == that.address && prefixBits == that.prefixBits
case _ => false
}
override def canEqual(other: Any): Boolean = other.isInstanceOf[Cidr[_]]
override def canEqual(other: Any): Boolean = other.isInstanceOf[Cidr[?]]
override def productArity: Int = 2
override def productElement(n: Int): Any =
n match {
Expand All @@ -155,7 +155,7 @@ object Cidr {

object Strict {
def apply[A <: IpAddress](cidr: Cidr[A]): Cidr.Strict[A] = cidr match {
case already: Strict[_] => already.asInstanceOf[Strict[A]]
case already: Strict[?] => already.asInstanceOf[Strict[A]]
case _ => new Cidr.Strict(cidr.prefix, cidr.prefixBits)
}
}
Expand Down
4 changes: 2 additions & 2 deletions shared/src/main/scala/com/comcast/ip4s/Multicast.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object Multicast {
private case class DefaultMulticast[+A <: IpAddress](address: A) extends Multicast[A] {
override def toString: String = address.toString
override def equals(that: Any): Boolean = that match {
case m: Multicast[_] => address == m.address
case m: Multicast[?] => address == m.address
case _ => false
}
override def hashCode: Int = address.hashCode
Expand Down Expand Up @@ -72,7 +72,7 @@ object SourceSpecificMulticast {
private case class DefaultSourceSpecificMulticast[+A <: IpAddress](address: A) extends SourceSpecificMulticast[A] {
override def toString: String = address.toString
override def equals(that: Any): Boolean = that match {
case m: Multicast[_] => address == m.address
case m: Multicast[?] => address == m.address
case _ => false
}
override def hashCode: Int = address.hashCode
Expand Down

0 comments on commit 2301b60

Please sign in to comment.