diff options
| author | Denys Zariaiev <denys.zariaiev@gmail.com> | 2019-03-13 21:00:45 +0100 |
|---|---|---|
| committer | Denys Zariaiev <denys.zariaiev@gmail.com> | 2019-03-13 21:00:45 +0100 |
| commit | eeb5f171da2486c34e4e473c97a1468279d05e7c (patch) | |
| tree | b452442f799d5d62141419e7091de13c212de9ff /src/libstd/ffi | |
| parent | 5c7ec6c421af26666d3ec1c5fe022d099133951c (diff) | |
| parent | 8bf1f1c8f4100247c1f9b3d9b7aecea5c970263e (diff) | |
| download | rust-eeb5f171da2486c34e4e473c97a1468279d05e7c.tar.gz rust-eeb5f171da2486c34e4e473c97a1468279d05e7c.zip | |
Merge remote-tracking branch 'upstream/master' into asm-compile-tests
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 56 | ||||
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 40 |
2 files changed, 48 insertions, 48 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 0ef72242827..ad3f45bfada 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -1,19 +1,19 @@ -use ascii; -use borrow::{Cow, Borrow}; -use cmp::Ordering; -use error::Error; -use fmt::{self, Write}; -use io; -use mem; -use memchr; -use ops; -use os::raw::c_char; -use ptr; -use rc::Rc; -use slice; -use str::{self, Utf8Error}; -use sync::Arc; -use sys; +use crate::ascii; +use crate::borrow::{Cow, Borrow}; +use crate::cmp::Ordering; +use crate::error::Error; +use crate::fmt::{self, Write}; +use crate::io; +use crate::mem; +use crate::memchr; +use crate::ops; +use crate::os::raw::c_char; +use crate::ptr; +use crate::rc::Rc; +use crate::slice; +use crate::str::{self, Utf8Error}; +use crate::sync::Arc; +use crate::sys; /// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the /// middle. @@ -690,8 +690,8 @@ impl<'a> From<Cow<'a, CStr>> for CString { } #[stable(feature = "box_from_c_str", since = "1.17.0")] -impl<'a> From<&'a CStr> for Box<CStr> { - fn from(s: &'a CStr) -> Box<CStr> { +impl From<&CStr> for Box<CStr> { + fn from(s: &CStr) -> Box<CStr> { let boxed: Box<[u8]> = Box::from(s.to_bytes_with_nul()); unsafe { Box::from_raw(Box::into_raw(boxed) as *mut CStr) } } @@ -767,7 +767,7 @@ impl From<CString> for Arc<CStr> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a CStr> for Arc<CStr> { +impl From<&CStr> for Arc<CStr> { #[inline] fn from(s: &CStr) -> Arc<CStr> { let arc: Arc<[u8]> = Arc::from(s.to_bytes_with_nul()); @@ -789,7 +789,7 @@ impl From<CString> for Rc<CStr> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a CStr> for Rc<CStr> { +impl From<&CStr> for Rc<CStr> { #[inline] fn from(s: &CStr) -> Rc<CStr> { let rc: Rc<[u8]> = Rc::from(s.to_bytes_with_nul()); @@ -1268,8 +1268,8 @@ impl ToOwned for CStr { } #[stable(feature = "cstring_asref", since = "1.7.0")] -impl<'a> From<&'a CStr> for CString { - fn from(s: &'a CStr) -> CString { +impl From<&CStr> for CString { + fn from(s: &CStr) -> CString { s.to_owned() } } @@ -1303,12 +1303,12 @@ impl AsRef<CStr> for CString { #[cfg(test)] mod tests { use super::*; - use os::raw::c_char; - use borrow::Cow::{Borrowed, Owned}; - use hash::{Hash, Hasher}; - use collections::hash_map::DefaultHasher; - use rc::Rc; - use sync::Arc; + use crate::os::raw::c_char; + use crate::borrow::Cow::{Borrowed, Owned}; + use crate::hash::{Hash, Hasher}; + use crate::collections::hash_map::DefaultHasher; + use crate::rc::Rc; + use crate::sync::Arc; #[test] fn c_to_rust() { diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 81433832ffc..3a0590021c9 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -1,13 +1,13 @@ -use borrow::{Borrow, Cow}; -use fmt; -use ops; -use cmp; -use hash::{Hash, Hasher}; -use rc::Rc; -use sync::Arc; +use crate::borrow::{Borrow, Cow}; +use crate::fmt; +use crate::ops; +use crate::cmp; +use crate::hash::{Hash, Hasher}; +use crate::rc::Rc; +use crate::sync::Arc; -use sys::os_str::{Buf, Slice}; -use sys_common::{AsInner, IntoInner, FromInner}; +use crate::sys::os_str::{Buf, Slice}; +use crate::sys_common::{AsInner, IntoInner, FromInner}; /// A type that can represent owned, mutable platform-native strings, but is /// cheaply inter-convertible with Rust strings. @@ -357,8 +357,8 @@ impl From<String> for OsString { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for OsString { - fn from(s: &'a T) -> OsString { +impl<T: ?Sized + AsRef<OsStr>> From<&T> for OsString { + fn from(s: &T) -> OsString { s.as_ref().to_os_string() } } @@ -421,8 +421,8 @@ impl PartialEq<OsString> for str { } #[stable(feature = "os_str_str_ref_eq", since = "1.29.0")] -impl<'a> PartialEq<&'a str> for OsString { - fn eq(&self, other: &&'a str) -> bool { +impl PartialEq<&str> for OsString { + fn eq(&self, other: &&str) -> bool { **self == **other } } @@ -656,8 +656,8 @@ impl OsStr { } #[stable(feature = "box_from_os_str", since = "1.17.0")] -impl<'a> From<&'a OsStr> for Box<OsStr> { - fn from(s: &'a OsStr) -> Box<OsStr> { +impl From<&OsStr> for Box<OsStr> { + fn from(s: &OsStr) -> Box<OsStr> { let rw = Box::into_raw(s.inner.into_box()) as *mut OsStr; unsafe { Box::from_raw(rw) } } @@ -707,7 +707,7 @@ impl From<OsString> for Arc<OsStr> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a OsStr> for Arc<OsStr> { +impl From<&OsStr> for Arc<OsStr> { #[inline] fn from(s: &OsStr) -> Arc<OsStr> { let arc = s.inner.into_arc(); @@ -729,7 +729,7 @@ impl From<OsString> for Rc<OsStr> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a OsStr> for Rc<OsStr> { +impl From<&OsStr> for Rc<OsStr> { #[inline] fn from(s: &OsStr) -> Rc<OsStr> { let rc = s.inner.into_rc(); @@ -968,10 +968,10 @@ impl AsInner<Slice> for OsStr { #[cfg(test)] mod tests { use super::*; - use sys_common::{AsInner, IntoInner}; + use crate::sys_common::{AsInner, IntoInner}; - use rc::Rc; - use sync::Arc; + use crate::rc::Rc; + use crate::sync::Arc; #[test] fn test_os_string_with_capacity() { |
