Skip to content

Commit 78ca757

Browse files
authored
chore: fix clippy lints (#1541)
* chore: fix clippy lints * use is_none_or
1 parent e48072a commit 78ca757

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

core/src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ where
425425
type Item = Result<Notif, serde_json::Error>;
426426
fn poll_next(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<Option<Self::Item>> {
427427
let res = match futures_util::ready!(self.rx.poll_next_unpin(cx)) {
428-
Some(v) => Some(serde_json::from_value::<Notif>(v).map_err(Into::into)),
428+
Some(v) => Some(serde_json::from_value::<Notif>(v)),
429429
None => {
430430
self.is_closed = true;
431431
None

core/src/server/subscription.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl SubscriptionSink {
372372
}
373373

374374
let json = sub_message_to_json(msg, SubNotifResultOrError::Result, &self.uniq_sub.sub_id, self.method);
375-
self.inner.send(json).await.map_err(Into::into)
375+
self.inner.send(json).await
376376
}
377377

378378
/// Similar to `SubscriptionSink::send` but only waits for a limited time.
@@ -383,7 +383,7 @@ impl SubscriptionSink {
383383
}
384384

385385
let json = sub_message_to_json(msg, SubNotifResultOrError::Result, &self.uniq_sub.sub_id, self.method);
386-
self.inner.send_timeout(json, timeout).await.map_err(Into::into)
386+
self.inner.send_timeout(json, timeout).await
387387
}
388388

389389
/// Attempts to immediately send out the message as JSON string to the subscribers but fails if the
@@ -399,7 +399,7 @@ impl SubscriptionSink {
399399
}
400400

401401
let json = sub_message_to_json(msg, SubNotifResultOrError::Result, &self.uniq_sub.sub_id, self.method);
402-
self.inner.try_send(json).map_err(Into::into)
402+
self.inner.try_send(json)
403403
}
404404

405405
/// Returns whether the subscription is closed.

server/src/middleware/http/host_filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ where
122122
return async { Ok(http::response::malformed()) }.boxed();
123123
};
124124

125-
if self.filter.as_ref().map_or(true, |f| f.recognize(&authority)) {
125+
if self.filter.as_ref().is_none_or(|f| f.recognize(&authority)) {
126126
Box::pin(self.inner.call(request).map_err(Into::into))
127127
} else {
128128
tracing::debug!(target: LOG_TARGET, "Denied request: {:?}", request);

server/src/transport/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn content_type_is_json<T: Body>(request: &HttpRequest<T>) -> bool {
1818

1919
/// Returns true if the `content_type` header indicates a valid JSON message.
2020
pub fn is_json(content_type: Option<&hyper::header::HeaderValue>) -> bool {
21-
content_type.and_then(|val| val.to_str().ok()).map_or(false, |content| {
21+
content_type.and_then(|val| val.to_str().ok()).is_some_and(|content| {
2222
content.eq_ignore_ascii_case("application/json")
2323
|| content.eq_ignore_ascii_case("application/json; charset=utf-8")
2424
|| content.eq_ignore_ascii_case("application/json;charset=utf-8")

server/src/transport/ws.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ enum Incoming {
3434

3535
pub(crate) async fn send_message(sender: &mut Sender, response: String) -> Result<(), SokettoError> {
3636
sender.send_text_owned(response).await?;
37-
sender.flush().await.map_err(Into::into)
37+
sender.flush().await
3838
}
3939

4040
pub(crate) async fn send_ping(sender: &mut Sender) -> Result<(), SokettoError> {
@@ -44,7 +44,7 @@ pub(crate) async fn send_ping(sender: &mut Sender) -> Result<(), SokettoError> {
4444
// Byte slice fails if the provided slice is larger than 125 bytes.
4545
let byte_slice = ByteSlice125::try_from(slice).expect("Empty slice should fit into ByteSlice125");
4646
sender.send_ping(byte_slice).await?;
47-
sender.flush().await.map_err(Into::into)
47+
sender.flush().await
4848
}
4949

5050
pub(crate) struct BackgroundTaskParams<S> {

0 commit comments

Comments
 (0)