The C code is forced to use a function pointer and hence do dynamic virtual calls for each comparison, while Rust and C++ can use generics/templates to get static dispatch (and hence inlining, constant folding etc.). You can see C vs. C++ in
http://www.martin-ueding.de/en/programming/qsort/index.html , and Rust is likely to be similar to C++.