iolivia/rust-sokoban

use `sort_by_key` to improve readabilty

hellow554 opened this issue · 1 comments

rendering_data.sort_by(|&a, &b| a.0.z.partial_cmp(&b.0.z).expect("expected comparison"));

At first I thought: you could just use cmp instead of partial_cmp.unwrap but then at the second look, why don't you just use sort_by_key (or better sort_unstable_key_by which will improve performance for large slices because of the underlying sorting algorithmn)

great suggestion, thank you @hellow554!