[PATCH] rust: replace length checks with match