summaryrefslogtreecommitdiff
path: root/src/library/scala/ref/WeakReference.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/ref/WeakReference.scala')
-rw-r--r--src/library/scala/ref/WeakReference.scala5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/library/scala/ref/WeakReference.scala b/src/library/scala/ref/WeakReference.scala
index 6ee40aed5c..9dcc0bbe5f 100644
--- a/src/library/scala/ref/WeakReference.scala
+++ b/src/library/scala/ref/WeakReference.scala
@@ -28,10 +28,7 @@ object WeakReference {
def apply[T <: AnyRef](value: T) = new WeakReference(value)
/** Optionally returns the referenced value, or `None` if that value no longer exists */
- def unapply[T <: AnyRef](wr: WeakReference[T]): Option[T] = {
- val x = wr.underlying.get
- if (x != null) Some(x) else None
- }
+ def unapply[T <: AnyRef](wr: WeakReference[T]): Option[T] = Option(wr.underlying.get)
}
/**