None of this should really change anything, but in principle it could allow the compiler to optimize slightly better. :)
More to the point, it makes better use of the standard library’s facilities for slice manipulation, which I feel makes the code clearer. In addition, it uses the named constant usize::MAX in place of the max_value method, which makes it clearer that the value in question really is a compile-time constant.
None of this should really change anything, but in principle it could allow the compiler to optimize slightly better. :)
More to the point, it makes better use of the standard library’s facilities for slice manipulation, which I feel makes the code clearer. In addition, it uses the named constant
usize::MAX
in place of themax_value
method, which makes it clearer that the value in question really is a compile-time constant.