Rust: 4ms
rust\nimpl Solution {\n    pub fn matrix_reshape(mat: Vec<Vec<i32>>, r: i32, c: i32) -> Vec<Vec<i32>> {\n        let (r, c) = (r as usize, c as usize);\n       
```rust\nimpl Solution {\n    pub fn matrix_reshape(mat: Vec<Vec<i32>>, r: i32, c: i32) -> Vec<Vec<i32>> {\n        let (r, c) = (r as usize, c as usize);\n        let (m, n) = (mat.len(), mat[0].len());\n        if r * c != m * n {\n            mat\n        } else {\n            mat.iter()\n                .flat_map(|r| r.iter().copied())\n                .collect::<Vec<_>>()\n                .chunks(c)\n                .map(|r| r.to_vec())\n                .collect()\n        }\n    }\n}\n```
['Rust']