Skip to content

fix tests

d52740b
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

feat: client rpc middleware #1521

fix tests
d52740b
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Mar 12, 2025 in 1s

clippy

34 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 34
Note 0
Help 0

Versions

  • rustc 1.85.0 (4d91de4e4 2025-02-17)
  • cargo 1.85.0 (d73d2caf9 2024-12-31)
  • clippy 0.1.85 (4d91de4e48 2025-02-17)

Annotations

Check warning on line 428 in core/src/client/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `serde_json::Error`

warning: useless conversion to the same type: `serde_json::Error`
   --> core/src/client/mod.rs:428:54
    |
428 |             Some(v) => Some(serde_json::from_value::<Notif>(v).map_err(Into::into)),
    |                                                               ^^^^^^^^^^^^^^^^^^^^ help: consider removing
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 402 in core/src/server/subscription.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `server::error::TrySendError`

warning: useless conversion to the same type: `server::error::TrySendError`
   --> core/src/server/subscription.rs:402:28
    |
402 |           self.inner.try_send(json).map_err(Into::into)
    |  __________________________________-^^^^^^^^^^^^^^^^^^^
403 | |     }
    | |____- help: consider removing
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 386 in core/src/server/subscription.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `server::error::SendTimeoutError`

warning: useless conversion to the same type: `server::error::SendTimeoutError`
   --> core/src/server/subscription.rs:386:47
    |
386 |           self.inner.send_timeout(json, timeout).await.map_err(Into::into)
    |  _____________________________________________________-^^^^^^^^^^^^^^^^^^^
387 | |     }
    | |____- help: consider removing
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 375 in core/src/server/subscription.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `server::error::DisconnectError`

warning: useless conversion to the same type: `server::error::DisconnectError`
   --> core/src/server/subscription.rs:375:30
    |
375 |           self.inner.send(json).await.map_err(Into::into)
    |  ____________________________________-^^^^^^^^^^^^^^^^^^^
376 | |     }
    | |____- help: consider removing
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default

Check warning on line 91 in tests/tests/metrics.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `map_or` can be simplified

warning: this `map_or` can be simplified
  --> tests/tests/metrics.rs:91:8
   |
91 |                 if rp.as_ref().map_or(false, |r| r.is_success()) {
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_ok_and instead: `rp.as_ref().is_ok_and(|r| r.is_success())`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
   = note: `#[warn(clippy::unnecessary_map_or)]` on by default

Check warning on line 125 in server/src/middleware/http/host_filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `map_or` can be simplified

warning: this `map_or` can be simplified
   --> server/src/middleware/http/host_filter.rs:125:6
    |
125 |         if self.filter.as_ref().map_or(true, |f| f.recognize(&authority)) {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_none_or instead: `self.filter.as_ref().is_none_or(|f| f.recognize(&authority))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or

Check warning on line 48 in server/src/transport/ws.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `soketto::connection::Error`

warning: useless conversion to the same type: `soketto::connection::Error`
  --> server/src/transport/ws.rs:48:22
   |
48 |       sender.flush().await.map_err(Into::into)
   |  _________________________-^^^^^^^^^^^^^^^^^^^
49 | | }
   | |_- help: consider removing
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 38 in server/src/transport/ws.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `soketto::connection::Error`

warning: useless conversion to the same type: `soketto::connection::Error`
  --> server/src/transport/ws.rs:38:22
   |
38 |       sender.flush().await.map_err(Into::into)
   |  _________________________-^^^^^^^^^^^^^^^^^^^
39 | | }
   | |_- help: consider removing
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
   = note: `#[warn(clippy::useless_conversion)]` on by default

Check warning on line 29 in server/src/transport/http.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `map_or` can be simplified

warning: this `map_or` can be simplified
  --> server/src/transport/http.rs:22:2
   |
22 | /     content_type.and_then(|val| val.to_str().ok()).map_or(false, |content| {
23 | |         content.eq_ignore_ascii_case("application/json")
24 | |             || content.eq_ignore_ascii_case("application/json; charset=utf-8")
25 | |             || content.eq_ignore_ascii_case("application/json;charset=utf-8")
...  |
28 | |             || content.eq_ignore_ascii_case("application/json-rpc; charset=utf-8")
29 | |     })
   | |______^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
   = note: `#[warn(clippy::unnecessary_map_or)]` on by default
help: use is_some_and instead
   |
22 ~     content_type.and_then(|val| val.to_str().ok()).is_some_and(|content| {
23 ~         content.eq_ignore_ascii_case("application/json")
24 ~             || content.eq_ignore_ascii_case("application/json; charset=utf-8")
25 ~             || content.eq_ignore_ascii_case("application/json;charset=utf-8")
26 ~             || content.eq_ignore_ascii_case("application/json-rpc")
27 ~             || content.eq_ignore_ascii_case("application/json-rpc;charset=utf-8")
28 ~             || content.eq_ignore_ascii_case("application/json-rpc; charset=utf-8")
29 ~     })
   |

Check warning on line 1303 in server/src/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
    --> server/src/server.rs:1303:20
     |
1303 |             if got_notif && batch_response.as_result().len() == 0 {
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `batch_response.as_result().is_empty()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
     = note: `#[warn(clippy::len_zero)]` on by default

Check warning on line 440 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> client/http-client/src/client.rs:440:75
    |
440 |         let json_responses: Vec<Response<&JsonRawValue>> = serde_json::from_str(&batch.as_result())?;
    |                                                                                 ^^^^^^^^^^^^^^^^^^ help: change this to: `batch.as_result()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 402 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> client/http-client/src/client.rs:402:92
    |
402 |         let response = ResponseSuccess::try_from(serde_json::from_str::<Response<&JsonRawValue>>(&rp.as_result())?)?;
    |                                                                                                  ^^^^^^^^^^^^^^^ help: change this to: `rp.as_result()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

Check warning on line 125 in server/src/middleware/http/host_filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `map_or` can be simplified

warning: this `map_or` can be simplified
   --> server/src/middleware/http/host_filter.rs:125:6
    |
125 |         if self.filter.as_ref().map_or(true, |f| f.recognize(&authority)) {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_none_or instead: `self.filter.as_ref().is_none_or(|f| f.recognize(&authority))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or

Check warning on line 48 in server/src/transport/ws.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `soketto::connection::Error`

warning: useless conversion to the same type: `soketto::connection::Error`
  --> server/src/transport/ws.rs:48:22
   |
48 |       sender.flush().await.map_err(Into::into)
   |  _________________________-^^^^^^^^^^^^^^^^^^^
49 | | }
   | |_- help: consider removing
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 38 in server/src/transport/ws.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `soketto::connection::Error`

warning: useless conversion to the same type: `soketto::connection::Error`
  --> server/src/transport/ws.rs:38:22
   |
38 |       sender.flush().await.map_err(Into::into)
   |  _________________________-^^^^^^^^^^^^^^^^^^^
39 | | }
   | |_- help: consider removing
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
   = note: `#[warn(clippy::useless_conversion)]` on by default

Check warning on line 29 in server/src/transport/http.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `map_or` can be simplified

warning: this `map_or` can be simplified
  --> server/src/transport/http.rs:22:2
   |
22 | /     content_type.and_then(|val| val.to_str().ok()).map_or(false, |content| {
23 | |         content.eq_ignore_ascii_case("application/json")
24 | |             || content.eq_ignore_ascii_case("application/json; charset=utf-8")
25 | |             || content.eq_ignore_ascii_case("application/json;charset=utf-8")
...  |
28 | |             || content.eq_ignore_ascii_case("application/json-rpc; charset=utf-8")
29 | |     })
   | |______^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
   = note: `#[warn(clippy::unnecessary_map_or)]` on by default
help: use is_some_and instead
   |
22 ~     content_type.and_then(|val| val.to_str().ok()).is_some_and(|content| {
23 ~         content.eq_ignore_ascii_case("application/json")
24 ~             || content.eq_ignore_ascii_case("application/json; charset=utf-8")
25 ~             || content.eq_ignore_ascii_case("application/json;charset=utf-8")
26 ~             || content.eq_ignore_ascii_case("application/json-rpc")
27 ~             || content.eq_ignore_ascii_case("application/json-rpc;charset=utf-8")
28 ~             || content.eq_ignore_ascii_case("application/json-rpc; charset=utf-8")
29 ~     })
   |

Check warning on line 1303 in server/src/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
    --> server/src/server.rs:1303:20
     |
1303 |             if got_notif && batch_response.as_result().len() == 0 {
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `batch_response.as_result().is_empty()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
     = note: `#[warn(clippy::len_zero)]` on by default

Check warning on line 125 in server/src/middleware/http/host_filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `map_or` can be simplified

warning: this `map_or` can be simplified
   --> server/src/middleware/http/host_filter.rs:125:6
    |
125 |         if self.filter.as_ref().map_or(true, |f| f.recognize(&authority)) {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_none_or instead: `self.filter.as_ref().is_none_or(|f| f.recognize(&authority))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or

Check warning on line 48 in server/src/transport/ws.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `soketto::connection::Error`

warning: useless conversion to the same type: `soketto::connection::Error`
  --> server/src/transport/ws.rs:48:22
   |
48 |       sender.flush().await.map_err(Into::into)
   |  _________________________-^^^^^^^^^^^^^^^^^^^
49 | | }
   | |_- help: consider removing
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 38 in server/src/transport/ws.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `soketto::connection::Error`

warning: useless conversion to the same type: `soketto::connection::Error`
  --> server/src/transport/ws.rs:38:22
   |
38 |       sender.flush().await.map_err(Into::into)
   |  _________________________-^^^^^^^^^^^^^^^^^^^
39 | | }
   | |_- help: consider removing
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
   = note: `#[warn(clippy::useless_conversion)]` on by default

Check warning on line 29 in server/src/transport/http.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `map_or` can be simplified

warning: this `map_or` can be simplified
  --> server/src/transport/http.rs:22:2
   |
22 | /     content_type.and_then(|val| val.to_str().ok()).map_or(false, |content| {
23 | |         content.eq_ignore_ascii_case("application/json")
24 | |             || content.eq_ignore_ascii_case("application/json; charset=utf-8")
25 | |             || content.eq_ignore_ascii_case("application/json;charset=utf-8")
...  |
28 | |             || content.eq_ignore_ascii_case("application/json-rpc; charset=utf-8")
29 | |     })
   | |______^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
   = note: `#[warn(clippy::unnecessary_map_or)]` on by default
help: use is_some_and instead
   |
22 ~     content_type.and_then(|val| val.to_str().ok()).is_some_and(|content| {
23 ~         content.eq_ignore_ascii_case("application/json")
24 ~             || content.eq_ignore_ascii_case("application/json; charset=utf-8")
25 ~             || content.eq_ignore_ascii_case("application/json;charset=utf-8")
26 ~             || content.eq_ignore_ascii_case("application/json-rpc")
27 ~             || content.eq_ignore_ascii_case("application/json-rpc;charset=utf-8")
28 ~             || content.eq_ignore_ascii_case("application/json-rpc; charset=utf-8")
29 ~     })
   |

Check warning on line 1303 in server/src/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
    --> server/src/server.rs:1303:20
     |
1303 |             if got_notif && batch_response.as_result().len() == 0 {
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `batch_response.as_result().is_empty()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
     = note: `#[warn(clippy::len_zero)]` on by default

Check warning on line 440 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> client/http-client/src/client.rs:440:75
    |
440 |         let json_responses: Vec<Response<&JsonRawValue>> = serde_json::from_str(&batch.as_result())?;
    |                                                                                 ^^^^^^^^^^^^^^^^^^ help: change this to: `batch.as_result()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 402 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> client/http-client/src/client.rs:402:92
    |
402 |         let response = ResponseSuccess::try_from(serde_json::from_str::<Response<&JsonRawValue>>(&rp.as_result())?)?;
    |                                                                                                  ^^^^^^^^^^^^^^^ help: change this to: `rp.as_result()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

Check warning on line 440 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> client/http-client/src/client.rs:440:75
    |
440 |         let json_responses: Vec<Response<&JsonRawValue>> = serde_json::from_str(&batch.as_result())?;
    |                                                                                 ^^^^^^^^^^^^^^^^^^ help: change this to: `batch.as_result()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow