There should be a convenience way to get the maximum of an array or a set. Which would work like this.
assert_eq!([1,2,3].maximum(), 3);
assert_eq!([1,2,3].minimum(), 1);
There should be a convenience way to get the maximum of an array or a set. Which would work like this.
assert_eq!([1,2,3].maximum(), 3);
assert_eq!([1,2,3].minimum(), 1);
There is already max on iterators for this purpose:
assert_eq!([1, 2, 3].into_iter().max().unwrap(), 3);
There's also this, experimentally: smallest in std::cmp - Rust