Selection sort algorithm in Rust I am just trying to use Rust so I will be thankful for all remarks and corrections:

fn selection_sort(array: &amp;mut [i32]) {

    let mut min;

    for i in 0..array.len() {

        min = i;

        for j in (i+1)..array.len() {

            if array[j] &lt; array[min] {
                min = j;
            }
        }

        let tmp = array[i];
        array[i] = array[min];
        array[min] = tmp;
    }
}

fn main() {

    let mut values = [ 5, 8, 4, 1, 7, 2, 3, 6 ];
    println!("Hello, world! The value is {:?}", values);

    selection_sort(&amp;mut values);
    println!("Hello, world! The value is {:?}", values);
}
You could use min_by_key to find the minimum's index and the method swap defined in slices: 

fn selection_sort(array: &amp;mut [i32]) {
    let len = array.len();
    for i in 0..len {
        let min = (i..len).min_by_key(|x| array[*x])
                          .unwrap();
        array.swap(min, i);
    }
}