diff options
| author | C. Morgan Hamill <me@cmhamill.org> | 2015-03-24 19:53:42 +0100 |
|---|---|---|
| committer | C. Morgan Hamill <me@cmhamill.org> | 2015-03-24 19:53:42 +0100 |
| commit | 4a314517ad9d52884232e4ed7e3b0d01e6e9b1e3 (patch) | |
| tree | ca32316c354392e8dbce7d4a0b9843b1a2bd95cf | |
| parent | 4a1e068f7ec752ef51891f04494f52c26ce7090c (diff) | |
| download | mail-4a314517ad9d52884232e4ed7e3b0d01e6e9b1e3.tar.gz | |
Remove `ToStaticStr` trait.
Changes in commit 95d4fba8436417a6c27522ed9b51c19a9fd7c6f9
make the trait unnecessary. The `ToStr` trait is now sufficient.
| -rw-r--r-- | src/ffi.rs | 3 | ||||
| -rw-r--r-- | src/utils.rs | 12 |
2 files changed, 1 insertions, 14 deletions
@@ -19,7 +19,6 @@ use std::{ use utils::{ NotmuchType, - ToStaticStr, ToStr, }; @@ -70,7 +69,7 @@ impl ToStr for NotmuchStatus { fn to_str<'a>(&self) -> Result<&'a str, str::Utf8Error> { unsafe { notmuch_status_to_string(self.to_notmuch_t()) - }.to_static_str() + }.to_str() } } diff --git a/src/utils.rs b/src/utils.rs index ad6cf9b..75a5788 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -35,15 +35,3 @@ impl ToStr for *const libc::c_char { }.to_bytes()) } } - -pub trait ToStaticStr { - fn to_static_str(&self) -> Result<&'static str, str::Utf8Error>; -} - -impl ToStaticStr for *const libc::c_char { - fn to_static_str(&self) -> Result<&'static str, str::Utf8Error> { - str::from_utf8(unsafe { - ffi::CStr::from_ptr(*self) - }.to_bytes()) - } -} |
