Restore the typecast in mode_from_kind_and_perm

This reverts commit 39e78dab8fe8269dd8abedc2f9fcf22c131f2f05, because
some platforms like MacOS have "mode_t = u16" and really do need the
typecast.  Added #[allow(unnecessary_typecast)] with a comment instead,
so Linux with "mode_t = u32" doesn't get a warning.