Skip to content

Enable -Ywarn-unused + code cleanup #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ scalacOptions ++= List(
"-unchecked",
"-deprecation",
"-language:_",
"-encoding", "UTF-8"
"-encoding", "UTF-8",
"-Ywarn-unused"
)

osgiSettings
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/com/typesafe/scalalogging/Logger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.typesafe.scalalogging

import org.slf4j.{ LoggerFactory, Marker, Logger => Underlying }
import scala.language.experimental.macros
import scala.reflect.ClassTag

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/typesafe/scalalogging/LoggerMacro.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.typesafe.scalalogging
import org.slf4j.Marker
import scala.reflect.macros.blackbox

private object LoggerMacro {
private[scalalogging] object LoggerMacro {

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

Expand Down Expand Up @@ -295,7 +295,7 @@ private object LoggerMacro {
case q"scala.StringContext.apply(..$parts).s(..$args)" =>
val format = parts.iterator.map({ case Literal(Constant(str: String)) => str })
// Emulate standard interpolator escaping
.map(StringContext.treatEscapes)
.map(StringContext.processEscapes)
// Escape literal slf4j format anchors if the resulting call will require a format string
.map(str => if (args.nonEmpty) str.replace("{}", "\\{}") else str)
.mkString("{}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.typesafe.scalalogging

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

trait CanLog[A] {
def logMessage(originalMsg: String, a: A): String
def afterLog(a: A): Unit = ()
def afterLog(a: A): Unit = {
val _ = a
}
}

@SerialVersionUID(957385465L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.typesafe.scalalogging
import org.slf4j.Marker
import scala.reflect.macros.blackbox

private object LoggerTakingImplicitMacro {
private[scalalogging] object LoggerTakingImplicitMacro {

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

Expand Down