Skip to content

Commit d1f250f

Browse files
authored
Enable -Ywarn-unused + code cleanup (#204)
* -Ywarn-unused testing * Remove unused imports, deprecated function call
1 parent 2bd1024 commit d1f250f

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ scalacOptions ++= List(
1414
"-unchecked",
1515
"-deprecation",
1616
"-language:_",
17-
"-encoding", "UTF-8"
17+
"-encoding", "UTF-8",
18+
"-Ywarn-unused"
1819
)
1920

2021
osgiSettings

src/main/scala/com/typesafe/scalalogging/Logger.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.typesafe.scalalogging
1818

1919
import org.slf4j.{ LoggerFactory, Marker, Logger => Underlying }
20-
import scala.language.experimental.macros
2120
import scala.reflect.ClassTag
2221

2322
/**

src/main/scala/com/typesafe/scalalogging/LoggerMacro.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package com.typesafe.scalalogging
1919
import org.slf4j.Marker
2020
import scala.reflect.macros.blackbox
2121

22-
private object LoggerMacro {
22+
private[scalalogging] object LoggerMacro {
2323

2424
type LoggerContext = blackbox.Context { type PrefixType = Logger }
2525

@@ -295,7 +295,7 @@ private object LoggerMacro {
295295
case q"scala.StringContext.apply(..$parts).s(..$args)" =>
296296
val format = parts.iterator.map({ case Literal(Constant(str: String)) => str })
297297
// Emulate standard interpolator escaping
298-
.map(StringContext.treatEscapes)
298+
.map(StringContext.processEscapes)
299299
// Escape literal slf4j format anchors if the resulting call will require a format string
300300
.map(str => if (args.nonEmpty) str.replace("{}", "\\{}") else str)
301301
.mkString("{}")

src/main/scala/com/typesafe/scalalogging/LoggerTakingImplicit.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package com.typesafe.scalalogging
22

33
import org.slf4j.{ Marker, Logger => Underlying }
4-
import scala.language.experimental.macros
54

65
trait CanLog[A] {
76
def logMessage(originalMsg: String, a: A): String
8-
def afterLog(a: A): Unit = ()
7+
def afterLog(a: A): Unit = {
8+
val _ = a
9+
}
910
}
1011

1112
@SerialVersionUID(957385465L)

src/main/scala/com/typesafe/scalalogging/LoggerTakingImplicitMacro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.typesafe.scalalogging
33
import org.slf4j.Marker
44
import scala.reflect.macros.blackbox
55

6-
private object LoggerTakingImplicitMacro {
6+
private[scalalogging] object LoggerTakingImplicitMacro {
77

88
type LoggerContext[A] = blackbox.Context { type PrefixType = LoggerTakingImplicit[A] }
99

0 commit comments

Comments
 (0)