Skip to content

Commit

Permalink
Remove unnecessary lifetime annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryant Mairs committed Dec 20, 2017
1 parent f91586f commit b4a7983
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ pub fn openat<P: ?Sized + NixPath>(dirfd: RawFd, path: &P, oflag: OFlag, mode: M
Errno::result(fd)
}

fn wrap_readlink_result<'a>(buffer: &'a mut[u8], res: ssize_t)
-> Result<&'a OsStr> {
fn wrap_readlink_result(buffer: &mut[u8], res: ssize_t) -> Result<&OsStr> {
match Errno::result(res) {
Err(err) => Err(err),
Ok(len) => {
Expand Down
2 changes: 1 addition & 1 deletion src/sys/uio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub struct IoVec<T>(libc::iovec, PhantomData<T>);

impl<T> IoVec<T> {
#[inline]
pub fn as_slice<'a>(&'a self) -> &'a [u8] {
pub fn as_slice(&self) -> &[u8] {
use std::slice;

unsafe {
Expand Down
10 changes: 5 additions & 5 deletions src/sys/utsname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ pub struct UtsName(libc::utsname);
impl Clone for UtsName { fn clone(&self) -> UtsName { *self } }

impl UtsName {
pub fn sysname<'a>(&'a self) -> &'a str {
pub fn sysname(&self) -> &str {
to_str(&(&self.0.sysname as *const c_char ) as *const *const c_char)
}

pub fn nodename<'a>(&'a self) -> &'a str {
pub fn nodename(&self) -> &str {
to_str(&(&self.0.nodename as *const c_char ) as *const *const c_char)
}

pub fn release<'a>(&'a self) -> &'a str {
pub fn release(&self) -> &str {
to_str(&(&self.0.release as *const c_char ) as *const *const c_char)
}

pub fn version<'a>(&'a self) -> &'a str {
pub fn version(&self) -> &str {
to_str(&(&self.0.version as *const c_char ) as *const *const c_char)
}

pub fn machine<'a>(&'a self) -> &'a str {
pub fn machine(&self) -> &str {
to_str(&(&self.0.machine as *const c_char ) as *const *const c_char)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ pub fn sethostname<S: AsRef<OsStr>>(name: S) -> Result<()> {
/// let hostname = hostname_cstr.to_str().expect("Hostname wasn't valid UTF-8");
/// println!("Hostname: {}", hostname);
/// ```
pub fn gethostname<'a>(buffer: &'a mut [u8]) -> Result<&'a CStr> {
pub fn gethostname(buffer: &mut [u8]) -> Result<&CStr> {
let ptr = buffer.as_mut_ptr() as *mut c_char;
let len = buffer.len() as size_t;

Expand Down

0 comments on commit b4a7983

Please sign in to comment.