Fixes for rustc changes

This commit is contained in:
Andrew Poelstra 2014-08-30 16:08:38 -07:00
parent 38f8132067
commit 8f5c28a533
5 changed files with 12 additions and 13 deletions

View File

@ -238,7 +238,7 @@ impl Transaction {
}
if trace.error.is_none() {
trace.pubkey_trace = Some(txo.script_pubkey.trace(&mut stack, Some((self, n))));
let err = trace.pubkey_trace.get_ref().error.as_ref().map(|e| e.clone());
let err = trace.pubkey_trace.as_ref().unwrap().error.as_ref().map(|e| e.clone());
err.map(|e| trace.error = Some(OutputScriptFailure(e)));
match stack.pop() {
Some(v) => {
@ -250,7 +250,7 @@ impl Transaction {
}
if trace.error.is_none() && txo.script_pubkey.is_p2sh() {
trace.p2sh_trace = Some(p2sh_script.trace(&mut p2sh_stack, Some((self, n))));
let err = trace.p2sh_trace.get_ref().error.as_ref().map(|e| e.clone());
let err = trace.p2sh_trace.as_ref().unwrap().error.as_ref().map(|e| e.clone());
err.map(|e| trace.error = Some(P2shScriptFailure(e)));
match p2sh_stack.pop() {
Some(v) => {

View File

@ -38,10 +38,9 @@
#![license = "CC0"]
// Coding conventions
#![deny(non_uppercase_pattern_statics)]
#![deny(uppercase_variables)]
#![warn(non_uppercase_statics)]
#![deny(non_camel_case_types)]
#![deny(non_snake_case_functions)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![warn(missing_doc)]

View File

@ -323,7 +323,7 @@ macro_rules! tuple_encode(
($($x:ident),*) => (
impl <SS:SimpleEncoder<EE>, EE, $($x: ConsensusEncodable<SS, EE>),*> ConsensusEncodable<SS, EE> for ($($x),*) {
#[inline]
#[allow(uppercase_variables)]
#[allow(non_snake_case)]
fn consensus_encode(&self, s: &mut SS) -> Result<(), EE> {
let &($(ref $x),*) = self;
$( try!($x.consensus_encode(s)); )*
@ -333,7 +333,7 @@ macro_rules! tuple_encode(
impl<DD:SimpleDecoder<EE>, EE, $($x: ConsensusDecodable<DD, EE>),*> ConsensusDecodable<DD, EE> for ($($x),*) {
#[inline]
#[allow(uppercase_variables)]
#[allow(non_snake_case)]
fn consensus_decode(d: &mut DD) -> Result<($($x),*), EE> {
Ok(($(try!({let $x = ConsensusDecodable::consensus_decode(d); $x })),*))
}

View File

@ -88,8 +88,8 @@ impl Socket {
pub fn connect(&mut self, host: &str, port: u16) -> IoResult<()> {
// Boot off any lingering readers or writers
if self.socket.is_some() {
let _ = self.socket.get_mut_ref().close_read();
let _ = self.socket.get_mut_ref().close_write();
let _ = self.socket.as_mut().unwrap().close_read();
let _ = self.socket.as_mut().unwrap().close_write();
}
// These locks should just pop open now
let mut reader_lock = self.buffered_reader.lock();

View File

@ -147,7 +147,7 @@ impl<K:BitArray+Eq+Zero+One+BitXor<K,K>+Shl<uint,K>+Shr<uint,K>, V> PatriciaTree
tmp.skip_prefix = tmp.skip_prefix.mask(diff);
// Recurse
idx += 1 + diff;
node = &mut **insert.get_mut_ref();
node = &mut **insert.as_mut().unwrap();
}
// Prefixes match
else {
@ -203,7 +203,7 @@ impl<K:BitArray+Eq+Zero+One+BitXor<K,K>+Shl<uint,K>+Shr<uint,K>, V> PatriciaTree
});
}
// subtree.get_mut_ref is a &mut Box<U> here, so &mut ** gets a &mut U
node = &mut **subtree.get_mut_ref();
node = &mut **subtree.as_mut().unwrap();
} // end search_len vs prefix len
} // end if prefixes match
} // end loop
@ -270,7 +270,7 @@ impl<K:BitArray+Eq+Zero+One+BitXor<K,K>+Shl<uint,K>+Shr<uint,K>, V> PatriciaTree
return (false, None);
}
// Otherwise, do it
let (delete_child, ret) = recurse(&mut **target.get_mut_ref(),
let (delete_child, ret) = recurse(&mut **target.as_mut().unwrap(),
&key.shr(&(tree.skip_len as uint + 1)),
key_len - tree.skip_len as uint - 1);
if delete_child {
@ -434,7 +434,7 @@ impl<'a, K, V> Iterator<&'a V> for Items<'a, K, V> {
// If we haven't started, maybe return the "last" return value,
// which will be the root node.
if !self.started {
if self.node.is_some() && (**self.node.get_ref()).data.is_some() {
if self.node.is_some() && (**self.node.as_ref().unwrap()).data.is_some() {
return self.node.unwrap().data.as_ref();
}
self.started = true;