Browse Source

Ban do_send_async and do_send functions

Both of these discard the return value which can lead to hard to find
bugs if the return value is an `Err`.
pAndLAndPayout
Thomas Eizinger 3 years ago
parent
commit
30dc9481e4
No known key found for this signature in database GPG Key ID: 651AC83A6C6C8B96
  1. 4
      clippy.toml
  2. 2
      daemon/src/lib.rs
  3. 3
      daemon/src/maker_cfd.rs

4
clippy.toml

@ -0,0 +1,4 @@
disallowed-methods = [
"xtra::Address::do_send_async", # discards the return value, possibly swallowing an error
"xtra::Address::do_send", # discards the return value, possibly swallowing an error
]

2
daemon/src/lib.rs

@ -1,4 +1,6 @@
#![cfg_attr(not(test), warn(clippy::unwrap_used))]
#![warn(clippy::disallowed_method)]
use crate::db::load_all_cfds;
use crate::maker_cfd::{FromTaker, NewTakerOnline};
use crate::model::cfd::{Cfd, Order, UpdateCfdProposals};

3
daemon/src/maker_cfd.rs

@ -329,6 +329,9 @@ where
None => None,
};
// Need to use `do_send_async` here because we are being invoked from the
// `maker_inc_connections::Actor`. Using `send` would result in a deadlock.
#[allow(clippy::disallowed_method)]
self.takers
.do_send_async(maker_inc_connections::TakerMessage {
taker_id,

Loading…
Cancel
Save