Thorough testing will show that your solution actually matches everything on the map, and not just records like (String, Int). A warning from the compiler tells you that the types of your match will be thrown out at runtime so that your code actually does something like this:
val m1: Map[String, Int] = m collect {case e:Tuple2[Any,Any] => e.asInstanceOf[Tuple2[String,Int]]}
And the call to asInstanceOf will not explode, since it only discards Tuple2, and the bit (String, Int) is again lost due to erasure. You will get an unpleasant crash when you try to repeat the result, though ...
Try it in REPL
val m:Map[String,Int] = Map("2" -> 3, 3 -> 4, "6" -> 10) collect {case e:(String, Int) => e}
`
source share