fn total(xs: &[i64]) -> i64 { let mut t = 0; for &x in xs { t += x; } t } fn main() { assert_eq!(total(&[1,2,3]),6); assert_eq!(total(&[]),0); }