From 4a314517ad9d52884232e4ed7e3b0d01e6e9b1e3 Mon Sep 17 00:00:00 2001 From: "C. Morgan Hamill" Date: Tue, 24 Mar 2015 14:53:42 -0400 Subject: Remove `ToStaticStr` trait. Changes in commit 95d4fba8436417a6c27522ed9b51c19a9fd7c6f9 make the trait unnecessary. The `ToStr` trait is now sufficient. --- src/ffi.rs | 3 +-- src/utils.rs | 12 ------------ 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/ffi.rs b/src/ffi.rs index 29b2ea7..1ee940a 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -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()) - } -} -- cgit v1.2.1