Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] p2p: add AsyncSecretConnection based on tokio #1464

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

rustfmt

dff86ab
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Draft

[WIP] p2p: add AsyncSecretConnection based on tokio #1464

rustfmt
dff86ab
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy failed Aug 28, 2024 in 0s

reviewdog [clippy] report

reported by reviewdog 🐶

Findings (5)

p2p/src/secret_connection.rs|35 col 33| error: item name ends with its containing module's name
--> p2p/src/secret_connection.rs:35:33
|
35 | pub use self::async_connection::AsyncSecretConnection;
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
= note: -D clippy::module-name-repetitions implied by -D warnings
= help: to override -D warnings add #[allow(clippy::module_name_repetitions)]
p2p/src/secret_connection/async_connection.rs|31 col 5| error: future cannot be sent between threads safely
--> p2p/src/secret_connection/async_connection.rs:31:5
|
31 | / pub async fn connect_tcp<A: ToSocketAddrs>(
32 | | addr: A,
33 | | local_privkey: ed25519_consensus::SigningKey,
34 | | protocol_version: Version,
35 | | ) -> Result<Self, Error> {
| |^ future returned by connect_tcp is not Send
|
note: captured value is not Send
--> p2p/src/secret_connection/async_connection.rs:32:9
|
32 | addr: A,
| ^^^^ has type A which is not Send
= note: A doesn't implement std::marker::Send
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
= note: -D clippy::future-not-send implied by -D warnings
= help: to override -D warnings add #[allow(clippy::future_not_send)]
p2p/src/secret_connection/async_connection.rs|108 col 25| error: the following explicit lifetimes could be elided: 'a
--> p2p/src/secret_connection/async_connection.rs:108:25
|
108 | async fn read_chunk<'a>(&'a mut self) -> Result<Vec, Error> {
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
= note: -D clippy::needless-lifetimes implied by -D warnings
= help: to override -D warnings add #[allow(clippy::needless_lifetimes)]
p2p/src/secret_connection/async_connection.rs|148 col 5| error: docs for function which may panic missing # Panics section
--> p2p/src/secret_connection/async_connection.rs:148:5
|
148 | pub async fn write_all<'a>(&'a mut self, src: &'a [u8]) -> Result<usize, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> p2p/src/secret_connection/async_connection.rs:164:17
|
164 | n = n
| _________________^
165 | | .checked_add(chunk.len())
166 | | .expect("overflow when adding chunk lengths");
| |
_________________________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
= note: -D clippy::missing-panics-doc implied by -D warnings
= help: to override -D warnings add #[allow(clippy::missing_panics_doc)]
p2p/src/secret_connection/async_connection.rs|148 col 5| error: docs for function returning Result missing # Errors section
--> p2p/src/secret_connection/async_connection.rs:148:5
|
148 | pub async fn write_all<'a>(&'a mut self, src: &'a [u8]) -> Result<usize, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
= note: -D clippy::missing-errors-doc implied by -D warnings
= help: to override -D warnings add #[allow(clippy::missing_errors_doc)]

Filtered Findings (3)

p2p/src/lib.rs|1 col 1| error: multiple versions for dependency block-buffer: 0.9.0, 0.10.4
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
= note: -D clippy::multiple-crate-versions implied by -D warnings
= help: to override -D warnings add #[allow(clippy::multiple_crate_versions)]
p2p/src/lib.rs|1 col 1| error: multiple versions for dependency digest: 0.9.0, 0.10.7
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
p2p/src/lib.rs|1 col 1| error: multiple versions for dependency sha2: 0.9.9, 0.10.8
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions

Annotations

Check failure on line 35 in p2p/src/secret_connection.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] p2p/src/secret_connection.rs#L35

error: item name ends with its containing module's name
  --> p2p/src/secret_connection.rs:35:33
   |
35 | pub use self::async_connection::AsyncSecretConnection;
   |                                 ^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
   = note: `-D clippy::module-name-repetitions` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::module_name_repetitions)]`
Raw output
p2p/src/secret_connection.rs:35:33:e:error: item name ends with its containing module's name
  --> p2p/src/secret_connection.rs:35:33
   |
35 | pub use self::async_connection::AsyncSecretConnection;
   |                                 ^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
   = note: `-D clippy::module-name-repetitions` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::module_name_repetitions)]`


__END__

Check failure on line 31 in p2p/src/secret_connection/async_connection.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] p2p/src/secret_connection/async_connection.rs#L31

error: future cannot be sent between threads safely
  --> p2p/src/secret_connection/async_connection.rs:31:5
   |
31 | /     pub async fn connect_tcp<A: ToSocketAddrs>(
32 | |         addr: A,
33 | |         local_privkey: ed25519_consensus::SigningKey,
34 | |         protocol_version: Version,
35 | |     ) -> Result<Self, Error> {
   | |____________________________^ future returned by `connect_tcp` is not `Send`
   |
note: captured value is not `Send`
  --> p2p/src/secret_connection/async_connection.rs:32:9
   |
32 |         addr: A,
   |         ^^^^ has type `A` which is not `Send`
   = note: `A` doesn't implement `std::marker::Send`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
   = note: `-D clippy::future-not-send` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::future_not_send)]`
Raw output
p2p/src/secret_connection/async_connection.rs:31:5:e:error: future cannot be sent between threads safely
  --> p2p/src/secret_connection/async_connection.rs:31:5
   |
31 | /     pub async fn connect_tcp<A: ToSocketAddrs>(
32 | |         addr: A,
33 | |         local_privkey: ed25519_consensus::SigningKey,
34 | |         protocol_version: Version,
35 | |     ) -> Result<Self, Error> {
   | |____________________________^ future returned by `connect_tcp` is not `Send`
   |
note: captured value is not `Send`
  --> p2p/src/secret_connection/async_connection.rs:32:9
   |
32 |         addr: A,
   |         ^^^^ has type `A` which is not `Send`
   = note: `A` doesn't implement `std::marker::Send`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
   = note: `-D clippy::future-not-send` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::future_not_send)]`


__END__

Check failure on line 108 in p2p/src/secret_connection/async_connection.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] p2p/src/secret_connection/async_connection.rs#L108

error: the following explicit lifetimes could be elided: 'a
   --> p2p/src/secret_connection/async_connection.rs:108:25
    |
108 |     async fn read_chunk<'a>(&'a mut self) -> Result<Vec<u8>, Error> {
    |                         ^^   ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`
Raw output
p2p/src/secret_connection/async_connection.rs:108:25:e:error: the following explicit lifetimes could be elided: 'a
   --> p2p/src/secret_connection/async_connection.rs:108:25
    |
108 |     async fn read_chunk<'a>(&'a mut self) -> Result<Vec<u8>, Error> {
    |                         ^^   ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`


__END__

Check failure on line 148 in p2p/src/secret_connection/async_connection.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] p2p/src/secret_connection/async_connection.rs#L148

error: docs for function which may panic missing `# Panics` section
   --> p2p/src/secret_connection/async_connection.rs:148:5
    |
148 |     pub async fn write_all<'a>(&'a mut self, src: &'a [u8]) -> Result<usize, Error> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> p2p/src/secret_connection/async_connection.rs:164:17
    |
164 |               n = n
    |  _________________^
165 | |                 .checked_add(chunk.len())
166 | |                 .expect("overflow when adding chunk lengths");
    | |_____________________________________________________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: `-D clippy::missing-panics-doc` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::missing_panics_doc)]`
Raw output
p2p/src/secret_connection/async_connection.rs:148:5:e:error: docs for function which may panic missing `# Panics` section
   --> p2p/src/secret_connection/async_connection.rs:148:5
    |
148 |     pub async fn write_all<'a>(&'a mut self, src: &'a [u8]) -> Result<usize, Error> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> p2p/src/secret_connection/async_connection.rs:164:17
    |
164 |               n = n
    |  _________________^
165 | |                 .checked_add(chunk.len())
166 | |                 .expect("overflow when adding chunk lengths");
    | |_____________________________________________________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: `-D clippy::missing-panics-doc` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::missing_panics_doc)]`


__END__

Check failure on line 148 in p2p/src/secret_connection/async_connection.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] p2p/src/secret_connection/async_connection.rs#L148

error: docs for function returning `Result` missing `# Errors` section
   --> p2p/src/secret_connection/async_connection.rs:148:5
    |
148 |     pub async fn write_all<'a>(&'a mut self, src: &'a [u8]) -> Result<usize, Error> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
    = note: `-D clippy::missing-errors-doc` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::missing_errors_doc)]`
Raw output
p2p/src/secret_connection/async_connection.rs:148:5:e:error: docs for function returning `Result` missing `# Errors` section
   --> p2p/src/secret_connection/async_connection.rs:148:5
    |
148 |     pub async fn write_all<'a>(&'a mut self, src: &'a [u8]) -> Result<usize, Error> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
    = note: `-D clippy::missing-errors-doc` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::missing_errors_doc)]`


__END__