Including initial CI setup (based on https://github.com/jonhoo/rust-ci-conf) #1
reviewdog [clippy] report
reported by reviewdog 🐶
Findings (0)
Filtered Findings (14)
src/cluster/state.rs|156 col 17| warning: this if
statement can be collapsed
--> src/cluster/state.rs:156:17
|
156 | / if node.addr == own_addr {
157 | | if node.tick > node_current_view.tick {
158 | | node_current_view.tick = node.tick + 1000;
159 | | continue;
160 | | }
161 | | }
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: #[warn(clippy::collapsible_if)]
on by default
help: collapse nested if block
|
156 ~ if node.addr == own_addr && node.tick > node_current_view.tick {
157 + node_current_view.tick = node.tick + 1000;
158 + continue;
159 + }
|
src/cluster/partitioning/consistent_hashing.rs|70 col 22| warning: unneeded return
statement
--> src/cluster/partitioning/consistent_hashing.rs:70:22
|
70 | ...=> return Err(Error::Internal { reason: "ConsistentHashing found a collision on its hash algorithm. This is currently an un-recoverable issue...".to_string() ...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: #[warn(clippy::needless_return)]
on by default
help: remove return
|
70 | Ok() => Err(Error::Internal { reason: "ConsistentHashing found a collision on its hash algorithm. This is currently an un-recoverable issue...".to_string() }),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/cluster/partitioning/consistent_hashing.rs|74 col 17| warning: unneeded return
statement
--> src/cluster/partitioning/consistent_hashing.rs:74:17
|
74 | return Ok(())
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove return
|
74 | Ok(())
|
src/cluster/partitioning/mock.rs|29 col 9| warning: unneeded return
statement
--> src/cluster/partitioning/mock.rs:29:9
|
29 | / return Err(crate::cluster::error::Error::Internal {
30 | | reason: "mock".to_string(),
31 | | });
| |^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove return
|
29 ~ Err(crate::cluster::error::Error::Internal {
30 + reason: "mock".to_string(),
31 ~ })
|
src/cluster/partitioning/mock.rs|26 col 9| error: this loop never actually loops
--> src/cluster/partitioning/mock.rs:26:9
|
26 | / for key in self.nodes.iter() {
27 | | return Ok(key.clone());
28 | | }
| |^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
= note: #[deny(clippy::never_loop)]
on by default
help: if you need the first element of the iterator, try writing
|
26 | if let Some(key) = self.nodes.iter().next() {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/cluster/state.rs|206 col 9| warning: you are using an explicit closure for cloning elements
--> src/cluster/state.rs:206:9
|
206 | / inner_guard
207 | | .nodes
208 | | .get(&node_key)
209 | | .ok_or(Error::Logic {
... |
212 | | })
213 | | .map(|node| node.clone())
| |__________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
= note: #[warn(clippy::map_clone)]
on by default
help: consider calling the dedicated cloned
method
|
206 ~ inner_guard
207 + .nodes
208 + .get(&node_key)
209 + .ok_or(Error::Logic {
210 + reason: "Unable to find node inside RingState. This should never happen."
211 + .to_string(),
212 + }).cloned()
|
src/cluster/state.rs|218 col 12| warning: iterating on a map's values
--> src/cluster/state.rs:218:12
|
218 | Ok(guard.nodes.iter().map(|(, v)| v.clone()).collect())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: guard.nodes.values().map(|v| v.clone())
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map
= note: #[warn(clippy::iter_kv_map)]
on by default
src/cmd/get.rs|36 col 13| warning: unneeded return
statement
--> src/cmd/get.rs:36:13
|
36 | return Ok(GetResponse { value });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove return
|
36 - return Ok(GetResponse { value });
36 + Ok(GetResponse { value })
|
src/cmd/get.rs|38 col 13| warning: unneeded return
statement
--> src/cmd/get.rs:38:13
|
38 | return Err(Error::NotFound { key: self.key });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove return
|
38 - return Err(Error::NotFound { key: self.key });
38 + Err(Error::NotFound { key: self.key })
|
src/cmd/put.rs|36 col 16| warning: useless conversion to the same type: bytes::Bytes
--> src/cmd/put.rs:36:16
|
36 | db.put(self.key.into(), self.value.into()).await?;
| ^^^^^^^^^^^^^^^ help: consider removing .into()
: self.key
|
= 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
src/cmd/put.rs|36 col 33| warning: useless conversion to the same type: bytes::Bytes
--> src/cmd/put.rs:36:33
|
36 | db.put(self.key.into(), self.value.into()).await?;
| ^^^^^^^^^^^^^^^^^ help: consider removing .into()
: self.value
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
src/cmd/mod.rs|116 col 17| warning: unneeded return
statement
--> src/cmd/mod.rs:116:17
|
116 | / return Err(Error::InvalidRequest {
117 | | reason: format!("Unrecognized command: {}", message.id),
118 | | });
| |^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove return
|
116 ~ Err(Error::InvalidRequest {
117 + reason: format!("Unrecognized command: {}", message.id),
118 ~ })
|
src/server/message.rs|10 col 33| warning: this operation has no effect
--> src/server/message.rs:10:33
|
10 | const MAX_MESSAGE_SIZE: usize = 1 * 1024 * 1024;
| ^^^^^^^^ help: consider reducing it to: 1024
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op
= note: #[warn(clippy::identity_op)]
on by default
src/storage_engine/in_memory.rs|33 col 12| warning: you are explicitly cloning with .map()
--> src/storage_engine/in_memory.rs:33:12
|
33 | Ok(guard.get(key).map(Clone::clone))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated cloned
method: guard.get(key).cloned()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone