]> git.lizzy.rs Git - rust.git/blobdiff - src/libterm/terminfo/searcher.rs
Various minor/cosmetic improvements to code
[rust.git] / src / libterm / terminfo / searcher.rs
index 011d06b1c0f21664275e39c54f68d7503509a230..426dc4db87b54d84a3f3adc7043d188071166bc1 100644 (file)
 #[allow(deprecated)]
 pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
     let mut dirs_to_search = Vec::new();
-    let first_char = match term.chars().next() {
-        Some(c) => c,
-        None => return None,
-    };
+    let first_char = term.chars().next()?;
 
     // Find search directory
     if let Some(dir) = env::var_os("TERMINFO") {
@@ -67,7 +64,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
             p.pop();
 
             // on some installations the dir is named after the hex of the char
-            // (e.g. OS X)
+            // (e.g., macOS)
             p.push(&format!("{:x}", first_char as usize));
             p.push(term);
             if fs::metadata(&p).is_ok() {
@@ -82,7 +79,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
 #[ignore(reason = "buildbots don't have ncurses installed and I can't mock everything I need")]
 fn test_get_dbpath_for_term() {
     // woefully inadequate test coverage
-    // note: current tests won't work with non-standard terminfo hierarchies (e.g. OS X's)
+    // note: current tests won't work with non-standard terminfo hierarchies (e.g., macOS's)
     use std::env;
     // FIXME (#9639): This needs to handle non-utf8 paths
     fn x(t: &str) -> String {