Fix clippy::significant_drop_in_scrutinee warnings
This is apparently a new warning from clippy nightly, documented in https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_in_scrutinee . I'm not in love with the temporary variables that this warning wants me to introduce, but it does seem like a decent way to avoid some kinds of deadlock.
This commit is contained in:
parent
425af9db91
commit
647d4410bb
|
@ -376,11 +376,14 @@ impl<R: Runtime> DirMgr<R> {
|
|||
v.store(false, Ordering::SeqCst);
|
||||
});
|
||||
|
||||
let schedule = match self.task_schedule.lock().expect("poisoned lock").take() {
|
||||
Some(sched) => sched,
|
||||
None => {
|
||||
debug!("Attempted to bootstrap twice; ignoring.");
|
||||
return Ok(());
|
||||
let schedule = {
|
||||
let sched = self.task_schedule.lock().expect("poisoned lock").take();
|
||||
match sched {
|
||||
Some(sched) => sched,
|
||||
None => {
|
||||
debug!("Attempted to bootstrap twice; ignoring.");
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -79,12 +79,12 @@ impl<T> SharedMutArc<T> {
|
|||
F: FnOnce(&mut T) -> Result<U>,
|
||||
T: Clone,
|
||||
{
|
||||
match self
|
||||
let mut writeable = self
|
||||
.dir
|
||||
.write()
|
||||
.expect("Poisoned lock for directory reference")
|
||||
.as_mut()
|
||||
{
|
||||
.expect("Poisoned lock for directory reference");
|
||||
let dir = writeable.as_mut();
|
||||
match dir {
|
||||
None => Err(Error::DirectoryNotPresent), // Kinda bogus.
|
||||
Some(arc) => func(Arc::make_mut(arc)),
|
||||
}
|
||||
|
|
|
@ -591,8 +591,8 @@ impl<R: Runtime> GuardMgr<R> {
|
|||
) {
|
||||
let now = self.runtime.now();
|
||||
let mut inner = self.inner.lock().expect("Poisoned lock");
|
||||
|
||||
for id in inner.lookup_ids(ed_identity, rsa_identity) {
|
||||
let ids = inner.lookup_ids(ed_identity, rsa_identity);
|
||||
for id in ids {
|
||||
match &id.0 {
|
||||
FirstHopIdInner::Guard(id) => {
|
||||
inner.guards.active_guards_mut().record_failure(
|
||||
|
|
|
@ -96,7 +96,8 @@ impl StateMgr for TestingStateMgr {
|
|||
{
|
||||
let inner = self.inner.lock().expect("Lock poisoned.");
|
||||
let storage = inner.storage.lock().expect("Lock poisoned.");
|
||||
match storage.entries.get(key) {
|
||||
let content = storage.entries.get(key);
|
||||
match content {
|
||||
Some(value) => Ok(Some(serde_json::from_str(value).map_err(load_error)?)),
|
||||
None => Ok(None),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue