From 86c601aa7187c2d89db87e8ccd83650a1c3e20d0 Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Mon, 27 Jan 2025 11:05:37 +0400 Subject: [PATCH] style: satisfy clippy --- elfo-core/src/context.rs | 6 +++--- elfo-core/src/dumping/dump.rs | 2 +- elfo-macros-impl/src/msg.rs | 4 ++-- elfo-network/src/worker/mod.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/elfo-core/src/context.rs b/elfo-core/src/context.rs index 8df2a48a..b2e62904 100644 --- a/elfo-core/src/context.rs +++ b/elfo-core/src/context.rs @@ -1129,7 +1129,7 @@ impl<'c, C, K, R> RequestBuilder<'c, C, K, R, Any> { } } -impl<'c, C, K, R: Request, M> RequestBuilder<'c, C, K, R, M> { +impl RequestBuilder<'_, C, K, R, M> { /// Specified the recipient of the request. #[inline] fn to(mut self, addr: Addr) -> Self { @@ -1156,7 +1156,7 @@ impl<'c, C, K, R: Request, M> RequestBuilder<'c, C, K, R, M> { } // TODO: add `pub async fn id() { ... }` -impl<'c, C: 'static, K, R: Request> RequestBuilder<'c, C, K, R, Any> { +impl RequestBuilder<'_, C, K, R, Any> { /// Waits for the response. pub async fn resolve(self) -> Result { // TODO: use `context.actor` after removing pruned contexts. @@ -1181,7 +1181,7 @@ impl<'c, C: 'static, K, R: Request> RequestBuilder<'c, C, K, R, Any> { } } -impl<'c, C: 'static, K, R: Request> RequestBuilder<'c, C, K, R, All> { +impl RequestBuilder<'_, C, K, R, All> { /// Waits for the responses. pub async fn resolve(self) -> Vec> { // TODO: use `context.actor` after removing pruned contexts. diff --git a/elfo-core/src/dumping/dump.rs b/elfo-core/src/dumping/dump.rs index 40a43f73..ff9d1bd0 100644 --- a/elfo-core/src/dumping/dump.rs +++ b/elfo-core/src/dumping/dump.rs @@ -157,7 +157,7 @@ impl<'a> PartialEq<&'a str> for MessageName { fn eq(&self, s: &&'a str) -> bool { if let Some(variant) = self.1 { s.split_once("::") - .map_or(false, |(n, v)| n == self.0 && v == variant) + .is_some_and(|(n, v)| n == self.0 && v == variant) } else { self.0 == *s } diff --git a/elfo-macros-impl/src/msg.rs b/elfo-macros-impl/src/msg.rs index 8c07cee8..3bb6e9ba 100644 --- a/elfo-macros-impl/src/msg.rs +++ b/elfo-macros-impl/src/msg.rs @@ -34,7 +34,7 @@ fn is_type_ident(ident: &Ident) -> bool { .to_string() .chars() .next() - .map_or(false, char::is_uppercase) + .is_some_and(char::is_uppercase) } fn extract_path_to_type(path: &Path) -> Path { @@ -125,7 +125,7 @@ fn is_binding_with_type(ident: &PatIdent) -> bool { ident .subpat .as_ref() - .map_or(false, |sp| is_likely_type(&sp.1)) + .is_some_and(|sp| is_likely_type(&sp.1)) } fn refine_pat(pat: &mut Pat) { diff --git a/elfo-network/src/worker/mod.rs b/elfo-network/src/worker/mod.rs index 9c536bd8..107e44dd 100644 --- a/elfo-network/src/worker/mod.rs +++ b/elfo-network/src/worker/mod.rs @@ -667,7 +667,7 @@ impl SocketReader { // If the recipient is unstable (i.e. already has pending messages), enqueue and // return. The envelope will be handled by the corresponding pusher. // Unexisted flows (new ones or already closed) are considered stable. - if flow.as_ref().map_or(false, |f| !f.is_stable()) { + if flow.as_ref().is_some_and(|f| !f.is_stable()) { let mut flow = flow.unwrap(); flow.acquire_direct(!routed); flow.enqueue(envelope, routed);