diff options
| author | Andre Bogus <bogusandre@gmail.com> | 2015-09-08 00:36:29 +0200 |
|---|---|---|
| committer | Andre Bogus <bogusandre@gmail.com> | 2015-09-08 00:36:29 +0200 |
| commit | 9cca96545faf2cfc972cc67b83deae2a78935c43 (patch) | |
| tree | ef675da82a1ce1b23173921957f6a6a167ad8db8 /src/libstd/sys | |
| parent | 7bf626a68045be1d1a4fac9a635113bb7775b6bb (diff) | |
| download | rust-9cca96545faf2cfc972cc67b83deae2a78935c43.tar.gz rust-9cca96545faf2cfc972cc67b83deae2a78935c43.zip | |
some more clippy-based improvements
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/gnu/libbacktrace.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/common/net.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/common/remutex.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/common/wtf8.rs | 18 | ||||
| -rw-r--r-- | src/libstd/sys/unix/backtrace/tracing/gcc_s.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/net.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sys/unix/stdio.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sys/unix/thread.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/thread_local.rs | 2 |
10 files changed, 20 insertions, 26 deletions
diff --git a/src/libstd/sys/common/gnu/libbacktrace.rs b/src/libstd/sys/common/gnu/libbacktrace.rs index 7a2ca0a9f09..3b846fd462e 100644 --- a/src/libstd/sys/common/gnu/libbacktrace.rs +++ b/src/libstd/sys/common/gnu/libbacktrace.rs @@ -151,7 +151,7 @@ pub fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void, }; STATE = backtrace_create_state(filename, 0, error_cb, ptr::null_mut()); - return STATE + STATE } //////////////////////////////////////////////////////////////////////// diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 4fb3134eac9..37379596251 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -161,7 +161,7 @@ pub fn lookup_addr(addr: &IpAddr) -> io::Result<String> { }; match from_utf8(data.to_bytes()) { - Ok(name) => Ok(name.to_string()), + Ok(name) => Ok(name.to_owned()), Err(_) => Err(io::Error::new(io::ErrorKind::Other, "failed to lookup address information")) } diff --git a/src/libstd/sys/common/remutex.rs b/src/libstd/sys/common/remutex.rs index 4df3441f87b..f3f21e47a14 100644 --- a/src/libstd/sys/common/remutex.rs +++ b/src/libstd/sys/common/remutex.rs @@ -67,7 +67,7 @@ impl<T> ReentrantMutex<T> { data: t, }; mutex.inner.init(); - return mutex + mutex } } @@ -145,7 +145,7 @@ impl<'mutex, T> ReentrantMutexGuard<'mutex, T> { impl<'mutex, T> Deref for ReentrantMutexGuard<'mutex, T> { type Target = T; - fn deref<'a>(&'a self) -> &'a T { + fn deref(&self) -> &T { &self.__lock.data } } diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index eb313d275a1..633e7d78a9a 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -282,19 +282,13 @@ impl Wtf8Buf { /// like concatenating ill-formed UTF-16 strings effectively would. #[inline] pub fn push(&mut self, code_point: CodePoint) { - match code_point.to_u32() { - trail @ 0xDC00...0xDFFF => { - match (&*self).final_lead_surrogate() { - Some(lead) => { - let len_without_lead_surrogate = self.len() - 3; - self.bytes.truncate(len_without_lead_surrogate); - self.push_char(decode_surrogate_pair(lead, trail as u16)); - return - } - _ => {} - } + if let trail @ 0xDC00...0xDFFF = code_point.to_u32() { + if let Some(lead) = (&*self).final_lead_surrogate() { + let len_without_lead_surrogate = self.len() - 3; + self.bytes.truncate(len_without_lead_surrogate); + self.push_char(decode_surrogate_pair(lead, trail as u16)); + return } - _ => {} } // No newly paired surrogates at the boundary. diff --git a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs index cdaf69c4882..8b32b5ec040 100644 --- a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs +++ b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs @@ -99,7 +99,7 @@ pub fn write(w: &mut Write) -> io::Result<()> { } // keep going - return uw::_URC_NO_REASON + uw::_URC_NO_REASON } } diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index f1a9518d08d..6d65cb838f6 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -35,7 +35,7 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> { let detail = unsafe { str::from_utf8(CStr::from_ptr(c::gai_strerror(err)).to_bytes()).unwrap() - .to_string() + .to_owned() }; Err(io::Error::new(io::ErrorKind::Other, &format!("failed to lookup address information: {}", diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 70be04b631a..af0d8da05f4 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -88,7 +88,7 @@ pub fn error_string(errno: i32) -> String { } let p = p as *const _; - str::from_utf8(CStr::from_ptr(p).to_bytes()).unwrap().to_string() + str::from_utf8(CStr::from_ptr(p).to_bytes()).unwrap().to_owned() } } @@ -134,7 +134,7 @@ pub struct SplitPaths<'a> { fn(&'a [u8]) -> PathBuf>, } -pub fn split_paths<'a>(unparsed: &'a OsStr) -> SplitPaths<'a> { +pub fn split_paths(unparsed: &OsStr) -> SplitPaths { fn bytes_to_path(b: &[u8]) -> PathBuf { PathBuf::from(<OsStr as OsStrExt>::from_bytes(b)) } @@ -142,7 +142,7 @@ pub fn split_paths<'a>(unparsed: &'a OsStr) -> SplitPaths<'a> { let unparsed = unparsed.as_bytes(); SplitPaths { iter: unparsed.split(is_colon as fn(&u8) -> bool) - .map(bytes_to_path as fn(&'a [u8]) -> PathBuf) + .map(bytes_to_path as fn(&[u8]) -> PathBuf) } } diff --git a/src/libstd/sys/unix/stdio.rs b/src/libstd/sys/unix/stdio.rs index c87800a1498..ccbb14677c7 100644 --- a/src/libstd/sys/unix/stdio.rs +++ b/src/libstd/sys/unix/stdio.rs @@ -23,7 +23,7 @@ impl Stdin { let fd = FileDesc::new(libc::STDIN_FILENO); let ret = fd.read(data); fd.into_raw(); - return ret; + ret } } @@ -34,7 +34,7 @@ impl Stdout { let fd = FileDesc::new(libc::STDOUT_FILENO); let ret = fd.write(data); fd.into_raw(); - return ret; + ret } } @@ -45,7 +45,7 @@ impl Stderr { let fd = FileDesc::new(libc::STDERR_FILENO); let ret = fd.write(data); fd.into_raw(); - return ret; + ret } } diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 5a551e2b3f3..268ec7fe356 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -310,7 +310,7 @@ pub mod guard { ret = Some(stackaddr as usize + guardsize as usize); } assert_eq!(pthread_attr_destroy(&mut attr), 0); - return ret + ret } #[cfg(any(target_os = "linux", target_os = "android"))] diff --git a/src/libstd/sys/unix/thread_local.rs b/src/libstd/sys/unix/thread_local.rs index c375788fdc1..e697417675d 100644 --- a/src/libstd/sys/unix/thread_local.rs +++ b/src/libstd/sys/unix/thread_local.rs @@ -18,7 +18,7 @@ pub type Key = pthread_key_t; pub unsafe fn create(dtor: Option<unsafe extern fn(*mut u8)>) -> Key { let mut key = 0; assert_eq!(pthread_key_create(&mut key, dtor), 0); - return key; + key } #[inline] |
