Skip to content

Store packets

Store packets #240

This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / clippy failed Oct 30, 2023 in 1s

clippy

2 errors

Details

Results

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

Versions

  • rustc 1.75.0-nightly (608e9682f 2023-10-29)
  • cargo 1.75.0-nightly (708383d62 2023-10-27)
  • clippy 0.1.75 (608e968 2023-10-29)

Annotations

Check failure on line 91 in solana/solana-ibc/programs/solana-ibc/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> solana/solana-ibc/programs/solana-ibc/src/lib.rs:71:17
   |
71 | /                 match msg {
72 | |                     MsgEnvelope::Packet(packet) => {
73 | |                         // store the packet if not exists
74 | |                         let mut inner_store = store.0.borrow_mut();
...  |
90 | |                     _ => (),
91 | |                 }
   | |_________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `-D clippy::single-match` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::single_match)]`
help: try
   |
71 ~                 if let MsgEnvelope::Packet(packet) = msg {
72 +                     // store the packet if not exists
73 +                     let mut inner_store = store.0.borrow_mut();
74 +                     let serialized_packet = borsh::to_vec(&packet).unwrap();
75 +                     // Find if the packet already exists
76 +                     match inner_store
77 +                         .private
78 +                         .packets
79 +                         .iter()
80 +                         .find(|&pack| pack == &serialized_packet)
81 +                     {
82 +                         Some(_) => (),
83 +                         None => inner_store
84 +                             .private
85 +                             .packets
86 +                             .push(serialized_packet),
87 +                     }
88 +                 }
   |

Check failure on line 12 in solana/solana-ibc/programs/solana-ibc/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `ibc::core::ics04_channel::msgs::PacketMsg`

error: unused import: `ibc::core::ics04_channel::msgs::PacketMsg`
  --> solana/solana-ibc/programs/solana-ibc/src/lib.rs:12:5
   |
12 | use ibc::core::ics04_channel::msgs::PacketMsg;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D unused-imports` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_imports)]`