Skip to content

Commit

Permalink
Nuke various warnings generated by relying on old compact/render code.
Browse files Browse the repository at this point in the history
As a bonus, all of these modules will no longer depend on the slower
JValue->Document->String transformation. So there may be some
performance improvements we get "for free" for lack of a better term.
  • Loading branch information
farmdawgnation committed Jul 25, 2015
1 parent 041f66a commit ee50178
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
Expand Up @@ -45,7 +45,7 @@ trait Types {
}

implicit def JValueShow[A <: JValue]: Show[A] = new Show[A] {
override def shows(json: A): String = compact(render(json))
override def shows(json: A): String = compactRender(json)
}

implicit def JValueMonoid: Monoid[JValue] = Monoid.instance(_ ++ _, JNothing)
Expand Down
Expand Up @@ -52,7 +52,7 @@ class BsonRecordField[OwnerType <: BsonRecord[OwnerType], SubRecordType <: BsonR
def asJs = asJValue match {
case JNothing => JsNull
case jv => new JsExp {
lazy val toJsCmd = Printer.compact(render(jv))
lazy val toJsCmd = compactRender(jv)
}
}
def toForm: Box[NodeSeq] = Empty
Expand Down
Expand Up @@ -73,7 +73,7 @@ trait DateTypedField extends TypedField[Date] {

def asJs = asJValue match {
case JNothing => JsNull
case jv => JsRaw(Printer.compact(render(jv)))
case jv => JsRaw(compactRender(jv))
}

def asJValue: JValue = valueBox.map(v => JsonDate(v)(formats)) openOr (JNothing: JValue)
Expand Down
Expand Up @@ -44,7 +44,7 @@ trait MongoFieldFlavor[MyType] {
*/
def asJs = asJValue match {
case JNothing => JsNull
case jv => JsRaw(Printer.compact(render(jv)))
case jv => JsRaw(compactRender(jv))
}

/** Encode the field value into a JValue */
Expand Down
Expand Up @@ -87,7 +87,7 @@ class ObjectIdField[OwnerType <: BsonRecord[OwnerType]](rec: OwnerType)

def asJs = asJValue match {
case JNothing => JsNull
case jv => JsRaw(Printer.compact(render(jv)))
case jv => JsRaw(compactRender(jv))
}

def asJValue: JValue = valueBox.map(v => JsonObjectId.asJValue(v, owner.meta.formats)) openOr (JNothing: JValue)
Expand Down
Expand Up @@ -67,7 +67,7 @@ class PatternField[OwnerType <: BsonRecord[OwnerType]](rec: OwnerType)

def asJs = asJValue match {
case JNothing => JsNull
case jv => Str(Printer.compact(render(jv)))
case jv => Str(compactRender(jv))
}

def asJValue: JValue = valueBox.map(v => JsonRegex(v)) openOr (JNothing: JValue)
Expand Down
Expand Up @@ -79,7 +79,7 @@ class UUIDField[OwnerType <: BsonRecord[OwnerType]](rec: OwnerType)

def asJs = asJValue match {
case JNothing => JsNull
case jv => JsRaw(Printer.compact(render(jv)))
case jv => JsRaw(compactRender(jv))
}

def asJValue: JValue = valueBox.map(v => JsonUUID(v)) openOr (JNothing: JValue)
Expand Down
Expand Up @@ -241,7 +241,7 @@ trait MetaRecord[BaseRecord <: Record[BaseRecord]] {
* @return a JsObj
*/
def asJsExp(inst: BaseRecord): JsExp = new JsExp {
lazy val toJsCmd = Printer.compact(render(asJValue(inst)))
lazy val toJsCmd = compactRender(asJValue(inst))
}

/** Encode a record instance into a JValue */
Expand Down

0 comments on commit ee50178

Please sign in to comment.