From c580f3b021de3c5b55c08d4964ba519643e0669c Mon Sep 17 00:00:00 2001 From: Lars Hupel <lars.hupel@mytum.de> Date: Tue, 25 Aug 2015 13:53:24 +0200 Subject: [PATCH] change List.contains to use pattern matching without guards --- library/collection/List.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/collection/List.scala b/library/collection/List.scala index 7b8692a8b..b98dbf3c2 100644 --- a/library/collection/List.scala +++ b/library/collection/List.scala @@ -22,8 +22,7 @@ sealed abstract class List[T] { } def contains(v: T): Boolean = (this match { - case Cons(h, t) if h == v => true - case Cons(_, t) => t.contains(v) + case Cons(h, t) => h == v || t.contains(v) case Nil() => false }) ensuring { _ == (content contains v) } -- GitLab