This repository has been archived on 2023-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
rustlings-exercises-completed/exercises/primitive_types/primitive_types4.rs

13 lines
324 B
Rust
Raw Permalink Normal View History

2018-02-22 00:09:53 -06:00
// primitive_types4.rs
// Get a slice out of Array a where the ??? is so that the test passes.
2022-07-12 07:54:12 -05:00
// Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand for a hint.
#[test]
fn slice_out_of_array() {
let a = [1, 2, 3, 4, 5];
2023-03-24 16:18:51 -05:00
let nice_slice = &a[1..4];
2020-04-08 03:42:35 -05:00
assert_eq!([2, 3, 4], nice_slice)
}