@@ -38,23 +38,18 @@ pub(crate) enum PagerKind {
3838
3939impl PagerKind {
4040 fn from_bin(bin: &str) -> PagerKind {
41− use std::ffi::OsStr;
4241 use std::path::Path;
4342
44− let stem = Path::new(bin)
43+ match Path::new(bin)
4544 .file_stem()
46− .unwrap_or_else(|| OsStr::new("unknown"));
47−
48− if stem == OsStr::new("bat") {
49− PagerKind::Bat
50− } else if stem == OsStr::new("less") {
51− PagerKind::Less
52− } else if stem == OsStr::new("more") {
53− PagerKind::More
54− } else if stem == OsStr::new("most") {
55− PagerKind::Most
56− } else {
57− PagerKind::Unknown
45+ .map(|s| s.to_string_lossy())
46+ .as_deref()
47+ {
48+ Some("bat") => PagerKind::Bat,
49+ Some("less") => PagerKind::Less,
50+ Some("more") => PagerKind::More,
51+ Some("most") => PagerKind::Most,
52+ _ => PagerKind::Unknown,
5853 }
5954 }
6055}