clippy
27 errors
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 27 |
Warning | 0 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.75.0-nightly (59edd6705 2023-10-09)
- cargo 1.75.0-nightly (794d0a825 2023-10-03)
- clippy 0.1.75 (59edd67 2023-10-09)
Annotations
Check failure on line 30 in solana/solana-ibc/programs/solana-ibc/src/lib.rs
github-actions / clippy
the `Err`-variant returned from this function is very large
error: the `Err`-variant returned from this function is very large
--> solana/solana-ibc/programs/solana-ibc/src/lib.rs:30:10
|
30 | ) -> Result<()> {
| ^^^^^^^^^^ the `Err`-variant is at least 160 bytes
|
= help: try reducing the size of `anchor_lang::error::Error`, for example by boxing large elements or replacing it with `Box<anchor_lang::error::Error>`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
= note: `-D clippy::result-large-err` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::result_large_err)]`
Check failure on line 367 in solana/solana-ibc/programs/solana-ibc/src/validation_context.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
error: this expression creates a reference which is immediately dereferenced by the compiler
--> solana/solana-ibc/programs/solana-ibc/src/validation_context.rs:367:9
|
367 | &self
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `-D clippy::needless-borrow` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`
Check failure on line 358 in solana/solana-ibc/programs/solana-ibc/src/validation_context.rs
github-actions / clippy
unnecessary use of `to_string`
error: unnecessary use of `to_string`
--> solana/solana-ibc/programs/solana-ibc/src/validation_context.rs:358:32
|
358 | match Pubkey::from_str(&signer.to_string()) {
| ^^^^^^^^^^^^^^^^^^^ help: use: `signer.as_ref()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned
= note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]`
Check failure on line 107 in solana/solana-ibc/programs/solana-ibc/src/validation_context.rs
github-actions / clippy
useless use of `format!`
error: useless use of `format!`
--> solana/solana-ibc/programs/solana-ibc/src/validation_context.rs:104:26
|
104 | description: format!(
| __________________________^
105 | | "The `host_consensus_state` is not supported on Solana \
106 | | protocol."
107 | | ),
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
= note: `-D clippy::useless-format` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::useless_format)]`
help: consider using `.to_string()`
|
104 ~ description: "The `host_consensus_state` is not supported on Solana \
105 ~ protocol.".to_string(),
|
Check failure on line 87 in solana/solana-ibc/programs/solana-ibc/src/validation_context.rs
github-actions / clippy
redundant closure
error: redundant closure
--> solana/solana-ibc/programs/solana-ibc/src/validation_context.rs:87:22
|
87 | .map_err(|e| ContextError::ClientError(e))?)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `ContextError::ClientError`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: `-D clippy::redundant-closure` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]`
Check failure on line 87 in solana/solana-ibc/programs/solana-ibc/src/validation_context.rs
github-actions / clippy
question mark operator is useless here
error: question mark operator is useless here
--> solana/solana-ibc/programs/solana-ibc/src/validation_context.rs:86:9
|
86 | / Ok(ibc::Height::new(self.height.0, self.height.1)
87 | | .map_err(|e| ContextError::ClientError(e))?)
| |________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
= note: `-D clippy::needless-question-mark` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::needless_question_mark)]`
help: try removing question mark and `Ok()`
|
86 ~ ibc::Height::new(self.height.0, self.height.1)
87 + .map_err(|e| ContextError::ClientError(e))
|
Check failure on line 399 in solana/solana-ibc/programs/solana-ibc/src/execution_context.rs
github-actions / clippy
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> solana/solana-ibc/programs/solana-ibc/src/execution_context.rs:397:5
|
397 | // hash_map.get_mut(&key).map(|sequences| {
398 | || sequences.push(u64::from(*sequence));
399 | || });
| ||______^- help: try: `if let Some(sequences) = hash_map.get_mut(&key) { sequences.push(u64::from(*sequence)); }`
| |______|
|
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
Check failure on line 372 in solana/solana-ibc/programs/solana-ibc/src/execution_context.rs
github-actions / clippy
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> solana/solana-ibc/programs/solana-ibc/src/execution_context.rs:370:13
|
370 | / self.ibc_events_history
371 | | .get_mut(&inner_host_height)
372 | | .map(|events| events.push(event_in_bytes.clone()));
| |__________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
help: try
|
370 ~ if let Some(events) = self.ibc_events_history
371 + .get_mut(&inner_host_height) { events.push(event_in_bytes.clone()) }
|
Check failure on line 376 in solana/solana-ibc/programs/solana-ibc/src/execution_context.rs
github-actions / clippy
usage of `contains_key` followed by `insert` on a `BTreeMap`
error: usage of `contains_key` followed by `insert` on a `BTreeMap`
--> solana/solana-ibc/programs/solana-ibc/src/execution_context.rs:369:9
|
369 | / if self.ibc_events_history.contains_key(&inner_host_height) {
370 | | self.ibc_events_history
371 | | .get_mut(&inner_host_height)
372 | | .map(|events| events.push(event_in_bytes.clone()));
... |
375 | | .insert(inner_host_height, vec![event_in_bytes.clone()]);
376 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
= note: `-D clippy::map-entry` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::map_entry)]`
help: try
|
369 ~ if let std::collections::btree_map::Entry::Vacant(e) = self.ibc_events_history.entry(inner_host_height) {
370 + e.insert(vec![event_in_bytes.clone()]);
371 + } else {
372 + self.ibc_events_history
373 + .get_mut(&inner_host_height)
374 + .map(|events| events.push(event_in_bytes.clone()));
375 + }
|
Check failure on line 287 in solana/solana-ibc/programs/solana-ibc/src/execution_context.rs
github-actions / clippy
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> solana/solana-ibc/programs/solana-ibc/src/execution_context.rs:279:9
|
279 | / self.packet_acknowledgement_sequence_sets
280 | | .get_mut(&(
281 | | ack_path.port_id.clone().to_string(),
282 | | ack_path.channel_id.clone().to_string(),
... |
286 | | sequences.remove(sequence_as_u64 as usize);
287 | | });
| |______________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
help: try
|
279 ~ if let Some(sequences) = self.packet_acknowledgement_sequence_sets
280 + .get_mut(&(
281 + ack_path.port_id.clone().to_string(),
282 + ack_path.channel_id.clone().to_string(),
283 + )) { ... }
|
Check failure on line 232 in solana/solana-ibc/programs/solana-ibc/src/execution_context.rs
github-actions / clippy
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> solana/solana-ibc/programs/solana-ibc/src/execution_context.rs:221:9
|
221 | / self.packet_commitment_sequence_sets
222 | | .get_mut(&(
223 | | commitment_path.port_id.clone().to_string(),
224 | | commitment_path.channel_id.clone().to_string(),
... |
231 | | sequences.remove(index);
232 | | });
| |______________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
= note: `-D clippy::option-map-unit-fn` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::option_map_unit_fn)]`
help: try
|
221 ~ if let Some(sequences) = self.packet_commitment_sequence_sets
222 + .get_mut(&(
223 + commitment_path.port_id.clone().to_string(),
224 + commitment_path.channel_id.clone().to_string(),
225 + )) { ... }
|
Check failure on line 149 in solana/solana-ibc/programs/solana-ibc/src/execution_context.rs
github-actions / clippy
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> solana/solana-ibc/programs/solana-ibc/src/execution_context.rs:138:9
|
138 | / self.client_processed_heights.get_mut(&client_id.to_string()).and_then(
139 | | |processed_heights| {
140 | | Some(BTreeMap::insert(
141 | | processed_heights,
... |
148 | | },
149 | | );
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try
|
138 ~ self.client_processed_heights.get_mut(&client_id.to_string()).map(|processed_heights| BTreeMap::insert(
139 + processed_heights,
140 + (height.revision_number(), height.revision_height()),
141 + (
142 + host_height.revision_number(),
143 + host_height.revision_height(),
144 + ),
145 ~ ));
|
Check failure on line 111 in solana/solana-ibc/programs/solana-ibc/src/execution_context.rs
github-actions / clippy
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> solana/solana-ibc/programs/solana-ibc/src/execution_context.rs:103:9
|
103 | / self.client_processed_times.get_mut(&client_id.to_string()).and_then(
104 | | |processed_times| {
105 | | Some(BTreeMap::insert(
106 | | processed_times,
... |
110 | | },
111 | | );
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
= note: `-D clippy::bind-instead-of-map` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::bind_instead_of_map)]`
help: try
|
103 ~ self.client_processed_times.get_mut(&client_id.to_string()).map(|processed_times| BTreeMap::insert(
104 + processed_times,
105 + (height.revision_number(), height.revision_height()),
106 + timestamp.nanoseconds(),
107 ~ ));
|
Check failure on line 307 in solana/solana-ibc/programs/solana-ibc/src/client_state.rs
github-actions / clippy
casting integer literal to `u64` is unnecessary
error: casting integer literal to `u64` is unnecessary
--> solana/solana-ibc/programs/solana-ibc/src/client_state.rs:307:53
|
307 | let end_height = (height.revision_number(), 1 as u64);
| ^^^^^^^^ help: try: `1_u64`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check failure on line 289 in solana/solana-ibc/programs/solana-ibc/src/client_state.rs
github-actions / clippy
casting integer literal to `u64` is unnecessary
error: casting integer literal to `u64` is unnecessary
--> solana/solana-ibc/programs/solana-ibc/src/client_state.rs:289:57
|
289 | let end_height = (height.revision_number() + 1, 1 as u64);
| ^^^^^^^^ help: try: `1_u64`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `-D clippy::unnecessary-cast` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_cast)]`
Check failure on line 160 in solana/solana-ibc/programs/solana-ibc/src/lib.rs
github-actions / clippy
associated function `new` is never used
error: associated function `new` is never used
--> solana/solana-ibc/programs/solana-ibc/src/lib.rs:160:8
|
159 | impl SolanaIbcStorage {
| --------------------- associated function in this implementation
160 | fn new(account: Pubkey) -> Self {
| ^^^
|
= note: `-D dead-code` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(dead_code)]`
Check failure on line 196 in solana/solana-ibc/programs/solana-ibc/src/lib.rs
github-actions / clippy
unused variable: `store`
error: unused variable: `store`
--> solana/solana-ibc/programs/solana-ibc/src/lib.rs:196:29
|
196 | fn set_solana_ibc_store(store: &SolanaIbcStorage) { todo!() }
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_store`
Check failure on line 191 in solana/solana-ibc/programs/solana-ibc/src/lib.rs
github-actions / clippy
unused variable: `account`
error: unused variable: `account`
--> solana/solana-ibc/programs/solana-ibc/src/lib.rs:191:29
|
191 | fn get_solana_ibc_store(account: Pubkey) -> SolanaIbcStorage {
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_account`
Check failure on line 40 in solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs
github-actions / clippy
unused variable: `base_denom`
error: unused variable: `base_denom`
--> solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs:40:13
|
40 | let base_denom = amt.denom.base_denom.to_string();
| ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_base_denom`
Check failure on line 39 in solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs
github-actions / clippy
unused variable: `receiver_id`
error: unused variable: `receiver_id`
--> solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs:39:13
|
39 | let receiver_id = to.to_string();
| ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_receiver_id`
Check failure on line 38 in solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs
github-actions / clippy
unused variable: `sender_id`
error: unused variable: `sender_id`
--> solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs:38:13
|
38 | let sender_id = from.to_string();
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_sender_id`
Check failure on line 102 in solana/solana-ibc/programs/solana-ibc/src/client_state.rs
github-actions / clippy
unused variable: `client_id`
error: unused variable: `client_id`
--> solana/solana-ibc/programs/solana-ibc/src/client_state.rs:102:9
|
102 | client_id: &ClientId,
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_client_id`
Check failure on line 101 in solana/solana-ibc/programs/solana-ibc/src/client_state.rs
github-actions / clippy
unused variable: `ctx`
error: unused variable: `ctx`
--> solana/solana-ibc/programs/solana-ibc/src/client_state.rs:101:9
|
101 | ctx: &SolanaIbcStorage,
| ^^^ help: if this is intentional, prefix it with an underscore: `_ctx`
|
= note: `-D unused-variables` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unused_variables)]`
Check failure on line 4 in solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs
github-actions / clippy
unused import: `anchor_lang::ToAccountInfo`
error: unused import: `anchor_lang::ToAccountInfo`
--> solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs:4:5
|
4 | use anchor_lang::ToAccountInfo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Check failure on line 2 in solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs
github-actions / clippy
unused import: `anchor_lang::solana_program::account_info::AccountInfo`
error: unused import: `anchor_lang::solana_program::account_info::AccountInfo`
--> solana/solana-ibc/programs/solana-ibc/src/transfer/impls.rs:2:5
|
2 | use anchor_lang::solana_program::account_info::AccountInfo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^