Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed all clippy complaints
  • Loading branch information
maciejzelaszczyk committed Nov 28, 2022
commit beefd134ab4cea97e5ad402e3bcc2cbf97dbeeac
4 changes: 2 additions & 2 deletions finality-aleph/src/network/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ mod tests {
}
}

impl Into<FromType> for IntoType {
fn into(self) -> FromType {
impl From<IntoType> for FromType {
fn from(_value: IntoType) -> Self {
FromType::A
}
}
Expand Down
2 changes: 1 addition & 1 deletion finality-aleph/src/network/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl<T> Channel<T> {
self.1.lock().await.by_ref().take(n).collect::<Vec<_>>(),
)
.await
.unwrap_or(Vec::new())
.unwrap_or_default()
}

pub async fn try_next(&self) -> Option<T> {
Expand Down
2 changes: 1 addition & 1 deletion finality-aleph/src/testing/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl TestData {
self.network_service_exit_tx.send(()).unwrap();
self.network_manager_handle.await.unwrap();
self.network_service_handle.await.unwrap();
while let Some(_) = self.network.send_message.try_next().await {}
while (self.network.send_message.try_next().await).is_some() {}
self.network.close_channels().await;
self.validator_network.close_channels().await;
}
Expand Down
5 changes: 1 addition & 4 deletions finality-aleph/src/validator_network/manager/direction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ mod tests {
let (mut container0, id0) = container_with_id().await;
let (mut container1, id1) = container_with_id().await;
let addresses = some_addresses();
assert!(
container0.add_peer(id1, addresses.clone())
!= container1.add_peer(id0, addresses.clone())
);
assert!(container0.add_peer(id1, addresses.clone()) != container1.add_peer(id0, addresses));
}

async fn container_with_added_connecting_peer(
Expand Down
2 changes: 1 addition & 1 deletion finality-aleph/src/validator_network/manager/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ mod tests {
// rx should fail
assert!(rx.try_next().expect("channel should be closed").is_none());
// add peer, this time for real
assert!(manager.add_peer(peer_id.clone(), addresses.clone()));
assert!(manager.add_peer(peer_id.clone(), addresses));
let (tx, mut rx) = mpsc::unbounded();
// should just add
assert_eq!(manager.add_incoming(peer_id.clone(), tx), Added);
Expand Down
8 changes: 2 additions & 6 deletions finality-aleph/src/validator_network/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,8 @@ mod tests {
} else {
// We need to switch the names around, because the connection was randomly the
// other way around.
let temp_id = connecting_id;
connecting_id = listening_id;
listening_id = temp_id;
let temp_manager = connecting_manager;
connecting_manager = listening_manager;
listening_manager = temp_manager;
std::mem::swap(&mut connecting_id, &mut listening_id);
std::mem::swap(&mut connecting_manager, &mut listening_manager);
assert!(connecting_manager.add_peer(listening_id.clone(), addresses.clone()));
}
// add outgoing to connecting
Expand Down