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/common | |
| parent | 7bf626a68045be1d1a4fac9a635113bb7775b6bb (diff) | |
| download | rust-9cca96545faf2cfc972cc67b83deae2a78935c43.tar.gz rust-9cca96545faf2cfc972cc67b83deae2a78935c43.zip | |
some more clippy-based improvements
Diffstat (limited to 'src/libstd/sys/common')
| -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 |
4 files changed, 10 insertions, 16 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. |
