Files
compiler-explorer/examples/rust/Max_array.rs
T
Christopher Serr 91a35e65d4 Improve the Rust examples
This commit
 - formats the Rust examples idiomatically
 - uses idiomatic code
 - uses only safe code without compromising on performance
 - makes them compile on stable
2020-03-26 23:28:49 +01:00

6 lines
162 B
Rust

pub fn max_array(x: &mut [f64; 65536], y: &[f64; 65536]) {
for (x, y) in x.iter_mut().zip(y.iter_mut()) {
*x = if *y > *x { *y } else { *x };
}
}