Not sure how you'd feel about it, but decided to PR just in case!
unwrap_or_default() feels somewhat easier to read than .map and
.unwrap_or_false. It doesn't make a big difference here, but we can
use an opportunity to teach folks that this idiom exists.
Note that both version work incorrectly for non-utf8 file names, which
is unfortunate, but isn't something we can do anything about in the
example.
Not sure how you'd feel about it, but decided to PR just in case!
unwrap_or_default()
feels somewhat easier to read than.map
and.unwrap_or_false
. It doesn't make a big difference here, but we can use an opportunity to teach folks that this idiom exists.Note that both version work incorrectly for non-utf8 file names, which is unfortunate, but isn't something we can do anything about in the example.