Skip to content

Commit

Permalink
Scala: fix deprecated-usage warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 29, 2024
1 parent beaecf7 commit 5261e85
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cli/src/main/scala/mdoc/PostModifier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object PostModifier {
ServiceLoader.load(classOf[PostModifier], classLoader).iterator().asScala.toList
implicit val surface: Surface[Settings] = new Surface(Nil)
implicit val decoder: ConfDecoder[PostModifier] =
ConfDecoder.instanceF[PostModifier](_ => ConfError.message("unsupported").notOk)
ConfDecoder.from[PostModifier](_ => ConfError.message("unsupported").notOk)
implicit val encoder: ConfEncoder[PostModifier] =
ConfEncoder.StringEncoder.contramap(mod => s"<${mod.name}>")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,8 @@ object Instrumenter {
pat.collect { case m: Member => m.name }
def unapply(tree: Tree): Option[List[Name]] =
tree match {
case Defn.Val(mods, _, _, _) if mods.exists(_.isInstanceOf[Lazy]) => Some(Nil)
case Defn.Val(_, pats, _, _) => Some(pats.flatMap(binders))
case Defn.Var(_, pats, _, _) => Some(pats.flatMap(binders))
case t: Defn.Val if t.mods.exists(_.isInstanceOf[Lazy]) => Some(Nil)
case t: Tree.WithPats with Defn => Some(t.pats.flatMap(binders))
case _: Defn => Some(Nil)
case _: Import => Some(Nil)
case _ => None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ object Instrumenter {
pat.collect { case m: Member => m.name }
def unapply(tree: Tree): Option[List[Name]] =
tree match {
case Defn.Val(mods, _, _, _) if mods.exists(_.isInstanceOf[Lazy]) => Some(Nil)
case Defn.Val(_, pats, _, _) => Some(pats.flatMap(binders))
case Defn.Var(_, pats, _, _) => Some(pats.flatMap(binders))
case t: Defn.Val if t.mods.exists(_.isInstanceOf[Lazy]) => Some(Nil)
case t: Tree.WithPats with Defn => Some(t.pats.flatMap(binders))
case _: Defn => Some(Nil)
case _: Import => Some(Nil)
case _ => None
Expand Down
3 changes: 1 addition & 2 deletions mdoc/src/main/scala/mdoc/internal/pos/PositionSyntax.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ object PositionSyntax extends CliEnrichments with CollectionEnrichments {
mpos.toUnslicedPosition
}
def toOriginal(edit: TokenEditDistance): Position = {
val Right(x) = edit.toOriginal(pos.startLine, pos.startColumn)
x.toUnslicedPosition
edit.toOriginal(pos.startLine, pos.startColumn).toOption.get.toUnslicedPosition
}
}
implicit class XtensionPositionMdoc2(pos: Position) {
Expand Down

0 comments on commit 5261e85

Please sign in to comment.