about summary refs log tree commit diff
path: root/src/libterm/terminfo
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2015-03-18 09:14:54 -0700
committerAaron Turon <aturon@mozilla.com>2015-03-23 15:01:45 -0700
commit8389253df0431e58bfe0a8e0e3949d58ebe7400f (patch)
tree816e989b62f4c6b9fb6dc8ea199fe3c2538d2a80 /src/libterm/terminfo
parentb0aad7dd4fad8d7e2e2f877a511a637258949597 (diff)
Add generic conversion traits
This commit:

* Introduces `std::convert`, providing an implementation of
RFC 529.

* Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all
in favor of the corresponding generic conversion traits.

  Consequently, various IO APIs now take `AsRef<Path>` rather than
`AsPath`, and so on. Since the types provided by `std` implement both
traits, this should cause relatively little breakage.

* Deprecates many `from_foo` constructors in favor of `from`.

* Changes `PathBuf::new` to take no argument (creating an empty buffer,
  as per convention). The previous behavior is now available as
  `PathBuf::from`.

* De-stabilizes `IntoCow`. It's not clear whether we need this separate trait.

Closes #22751
Closes #14433

[breaking-change]
Diffstat (limited to 'src/libterm/terminfo')
-rw-r--r--src/libterm/terminfo/searcher.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs
index f47921cbf5e..66ee2b1ba87 100644
--- a/src/libterm/terminfo/searcher.rs
+++ b/src/libterm/terminfo/searcher.rs
@@ -31,7 +31,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<PathBuf>> {
 
     // Find search directory
     match env::var_os("TERMINFO") {
-        Some(dir) => dirs_to_search.push(PathBuf::new(&dir)),
+        Some(dir) => dirs_to_search.push(PathBuf::from(dir)),
         None => {
             if homedir.is_some() {
                 // ncurses compatibility;
@@ -40,9 +40,9 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<PathBuf>> {
             match env::var("TERMINFO_DIRS") {
                 Ok(dirs) => for i in dirs.split(':') {
                     if i == "" {
-                        dirs_to_search.push(PathBuf::new("/usr/share/terminfo"));
+                        dirs_to_search.push(PathBuf::from("/usr/share/terminfo"));
                     } else {
-                        dirs_to_search.push(PathBuf::new(i));
+                        dirs_to_search.push(PathBuf::from(i));
                     }
                 },
                 // Found nothing in TERMINFO_DIRS, use the default paths:
@@ -50,9 +50,9 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<PathBuf>> {
                 // ~/.terminfo, ncurses will search /etc/terminfo, then
                 // /lib/terminfo, and eventually /usr/share/terminfo.
                 Err(..) => {
-                    dirs_to_search.push(PathBuf::new("/etc/terminfo"));
-                    dirs_to_search.push(PathBuf::new("/lib/terminfo"));
-                    dirs_to_search.push(PathBuf::new("/usr/share/terminfo"));
+                    dirs_to_search.push(PathBuf::from("/etc/terminfo"));
+                    dirs_to_search.push(PathBuf::from("/lib/terminfo"));
+                    dirs_to_search.push(PathBuf::from("/usr/share/terminfo"));
                 }
             }
         }