Hands-on Rust: Add note about `.sort_by` (page 92-93 in P1.0)

The build_corridors function introduces the sort_by utility in Vec. The call appears like this:

rooms.sort_by(|a,b| a.center().x.cmp(&b.center().x));

I believe it would help readers understanding why a is used directly, whereas &b is referenced.

1 Like