From 8bfd84539e847b9ac9d7c811a370a9c3840d6c3b Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Mon, 11 May 2020 13:01:37 +0200 Subject: Fix clippy warnings Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed} --- src/libstd/thread/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd/thread/mod.rs') diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 7a3cbbe4562..738f07250b5 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -1272,7 +1272,7 @@ impl Thread { } fn cname(&self) -> Option<&CStr> { - self.inner.name.as_ref().map(|s| &**s) + self.inner.name.as_deref() } } -- cgit 1.4.1-3-g733a5 From 2d39f5abcd3953eb1578f718c75c39c457bcb009 Mon Sep 17 00:00:00 2001 From: Kornel Date: Tue, 12 May 2020 16:38:02 +0100 Subject: Warn against thread::sleep in async fn --- src/libstd/thread/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libstd/thread/mod.rs') diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 738f07250b5..3134a596756 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -737,6 +737,8 @@ pub fn panicking() -> bool { /// The thread may sleep longer than the duration specified due to scheduling /// specifics or platform-dependent functionality. It will never sleep less. /// +/// This function is blocking, and should not be used in `async` functions. +/// /// # Platform-specific behavior /// /// On Unix platforms, the underlying syscall may be interrupted by a @@ -763,6 +765,8 @@ pub fn sleep_ms(ms: u32) { /// The thread may sleep longer than the duration specified due to scheduling /// specifics or platform-dependent functionality. It will never sleep less. /// +/// This function is blocking, and should not be used in `async` functions. +/// /// # Platform-specific behavior /// /// On Unix platforms, the underlying syscall may be interrupted by a -- cgit 1.4.1-3-g733a5