No longer need explicit refs in rustc 1.26
This commit is contained in:
@ -215,8 +215,8 @@ impl Bank {
|
|||||||
.read()
|
.read()
|
||||||
.expect("timestamp creation in apply_credits")));
|
.expect("timestamp creation in apply_credits")));
|
||||||
|
|
||||||
if let Some(ref payment) = plan.final_payment() {
|
if let Some(payment) = plan.final_payment() {
|
||||||
self.apply_payment(payment);
|
self.apply_payment(&payment);
|
||||||
} else {
|
} else {
|
||||||
let mut pending = self.pending
|
let mut pending = self.pending
|
||||||
.write()
|
.write()
|
||||||
@ -329,8 +329,8 @@ impl Bank {
|
|||||||
plan.apply_witness(&Witness::Timestamp(*self.last_time
|
plan.apply_witness(&Witness::Timestamp(*self.last_time
|
||||||
.read()
|
.read()
|
||||||
.expect("'last_time' read lock when creating timestamp")));
|
.expect("'last_time' read lock when creating timestamp")));
|
||||||
if let Some(ref payment) = plan.final_payment() {
|
if let Some(payment) = plan.final_payment() {
|
||||||
self.apply_payment(payment);
|
self.apply_payment(&payment);
|
||||||
completed.push(key.clone());
|
completed.push(key.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ mod bench {
|
|||||||
&packet_recycler,
|
&packet_recycler,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
let signal = signal_receiver.recv().unwrap();
|
let signal = signal_receiver.recv().unwrap();
|
||||||
if let Signal::Events(ref transactions) = signal {
|
if let Signal::Events(transactions) = signal {
|
||||||
assert_eq!(transactions.len(), tx);
|
assert_eq!(transactions.len(), tx);
|
||||||
} else {
|
} else {
|
||||||
assert!(false);
|
assert!(false);
|
||||||
|
@ -18,8 +18,8 @@ impl Condition {
|
|||||||
/// Return true if the given Witness satisfies this Condition.
|
/// Return true if the given Witness satisfies this Condition.
|
||||||
pub fn is_satisfied(&self, witness: &Witness) -> bool {
|
pub fn is_satisfied(&self, witness: &Witness) -> bool {
|
||||||
match (self, witness) {
|
match (self, witness) {
|
||||||
(&Condition::Signature(ref pubkey), &Witness::Signature(ref from)) => pubkey == from,
|
(Condition::Signature(pubkey), Witness::Signature(from)) => pubkey == from,
|
||||||
(&Condition::Timestamp(ref dt), &Witness::Timestamp(ref last_time)) => dt <= last_time,
|
(Condition::Timestamp(dt), Witness::Timestamp(last_time)) => dt <= last_time,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,31 +67,27 @@ impl Budget {
|
|||||||
impl PaymentPlan for Budget {
|
impl PaymentPlan for Budget {
|
||||||
/// Return Payment if the budget requires no additional Witnesses.
|
/// Return Payment if the budget requires no additional Witnesses.
|
||||||
fn final_payment(&self) -> Option<Payment> {
|
fn final_payment(&self) -> Option<Payment> {
|
||||||
match *self {
|
match self {
|
||||||
Budget::Pay(ref payment) => Some(payment.clone()),
|
Budget::Pay(payment) => Some(payment.clone()),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true if the budget spends exactly `spendable_tokens`.
|
/// Return true if the budget spends exactly `spendable_tokens`.
|
||||||
fn verify(&self, spendable_tokens: i64) -> bool {
|
fn verify(&self, spendable_tokens: i64) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
Budget::Pay(ref payment) | Budget::After(_, ref payment) => {
|
Budget::Pay(payment) | Budget::After(_, payment) => payment.tokens == spendable_tokens,
|
||||||
payment.tokens == spendable_tokens
|
Budget::Race(a, b) => a.1.tokens == spendable_tokens && b.1.tokens == spendable_tokens,
|
||||||
}
|
|
||||||
Budget::Race(ref a, ref b) => {
|
|
||||||
a.1.tokens == spendable_tokens && b.1.tokens == spendable_tokens
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply a witness to the budget to see if the budget can be reduced.
|
/// Apply a witness to the budget to see if the budget can be reduced.
|
||||||
/// If so, modify the budget in-place.
|
/// If so, modify the budget in-place.
|
||||||
fn apply_witness(&mut self, witness: &Witness) {
|
fn apply_witness(&mut self, witness: &Witness) {
|
||||||
let new_payment = match *self {
|
let new_payment = match self {
|
||||||
Budget::After(ref cond, ref payment) if cond.is_satisfied(witness) => Some(payment),
|
Budget::After(cond, payment) if cond.is_satisfied(witness) => Some(payment),
|
||||||
Budget::Race((ref cond, ref payment), _) if cond.is_satisfied(witness) => Some(payment),
|
Budget::Race((cond, payment), _) if cond.is_satisfied(witness) => Some(payment),
|
||||||
Budget::Race(_, (ref cond, ref payment)) if cond.is_satisfied(witness) => Some(payment),
|
Budget::Race(_, (cond, payment)) if cond.is_satisfied(witness) => Some(payment),
|
||||||
_ => None,
|
_ => None,
|
||||||
}.cloned();
|
}.cloned();
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ impl Crdt {
|
|||||||
blob_recycler: &BlobRecycler,
|
blob_recycler: &BlobRecycler,
|
||||||
) -> Option<SharedBlob> {
|
) -> Option<SharedBlob> {
|
||||||
let pos = (ix as usize) % window.read().unwrap().len();
|
let pos = (ix as usize) % window.read().unwrap().len();
|
||||||
if let &Some(ref blob) = &window.read().unwrap()[pos] {
|
if let Some(blob) = &window.read().unwrap()[pos] {
|
||||||
let rblob = blob.read().unwrap();
|
let rblob = blob.read().unwrap();
|
||||||
let blob_ix = rblob.get_index().expect("run_window_request get_index");
|
let blob_ix = rblob.get_index().expect("run_window_request get_index");
|
||||||
if blob_ix == ix {
|
if blob_ix == ix {
|
||||||
|
@ -270,7 +270,7 @@ fn recv_window(
|
|||||||
let mut window = locked_window.write().unwrap();
|
let mut window = locked_window.write().unwrap();
|
||||||
if window[w].is_none() {
|
if window[w].is_none() {
|
||||||
window[w] = Some(b_);
|
window[w] = Some(b_);
|
||||||
} else if let &Some(ref cblob) = &window[w] {
|
} else if let Some(cblob) = &window[w] {
|
||||||
if cblob.read().unwrap().get_index().unwrap() != pix as u64 {
|
if cblob.read().unwrap().get_index().unwrap() != pix as u64 {
|
||||||
warn!("overrun blob at index {:}", w);
|
warn!("overrun blob at index {:}", w);
|
||||||
} else {
|
} else {
|
||||||
|
@ -105,7 +105,7 @@ impl ThinClient {
|
|||||||
while !done {
|
while !done {
|
||||||
let resp = self.recv_response()?;
|
let resp = self.recv_response()?;
|
||||||
trace!("recv_response {:?}", resp);
|
trace!("recv_response {:?}", resp);
|
||||||
if let &Response::Balance { ref key, .. } = &resp {
|
if let Response::Balance { key, .. } = &resp {
|
||||||
done = key == pubkey;
|
done = key == pubkey;
|
||||||
}
|
}
|
||||||
self.process_response(resp);
|
self.process_response(resp);
|
||||||
|
@ -45,7 +45,7 @@ where
|
|||||||
for i in 0..(num * 32) {
|
for i in 0..(num * 32) {
|
||||||
done = false;
|
done = false;
|
||||||
trace!("round {}", i);
|
trace!("round {}", i);
|
||||||
for &(ref c, _, _) in listen.iter() {
|
for (c, _, _) in &listen {
|
||||||
if num == c.read().unwrap().convergence() as usize {
|
if num == c.read().unwrap().convergence() as usize {
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user