How can I suppress the \"match is not exhaustive!\" warning in the following Scala code?
val l = \"1\" :: \"2\" :: Nil
l.sliding(2).foreach{case List(a,b) =&
Making it complete with ; case _ => ??? is pretty short. ??? just throws an exception. You can define your own if you're using 2.9 or before (it's new in 2.10).
It really is pretty short compared to what you need for a match annotation:
(: @unchecked)
; case _ => ???
^ One more character!
It doesn't throw a MatchError, but does that really matter?