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

View File

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

View File

@ -323,7 +323,7 @@ macro_rules! tuple_encode(
($($x:ident),*) => ( ($($x:ident),*) => (
impl <SS:SimpleEncoder<EE>, EE, $($x: ConsensusEncodable<SS, EE>),*> ConsensusEncodable<SS, EE> for ($($x),*) { impl <SS:SimpleEncoder<EE>, EE, $($x: ConsensusEncodable<SS, EE>),*> ConsensusEncodable<SS, EE> for ($($x),*) {
#[inline] #[inline]
#[allow(uppercase_variables)] #[allow(non_snake_case)]
fn consensus_encode(&self, s: &mut SS) -> Result<(), EE> { fn consensus_encode(&self, s: &mut SS) -> Result<(), EE> {
let &($(ref $x),*) = self; let &($(ref $x),*) = self;
$( try!($x.consensus_encode(s)); )* $( 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),*) { impl<DD:SimpleDecoder<EE>, EE, $($x: ConsensusDecodable<DD, EE>),*> ConsensusDecodable<DD, EE> for ($($x),*) {
#[inline] #[inline]
#[allow(uppercase_variables)] #[allow(non_snake_case)]
fn consensus_decode(d: &mut DD) -> Result<($($x),*), EE> { fn consensus_decode(d: &mut DD) -> Result<($($x),*), EE> {
Ok(($(try!({let $x = ConsensusDecodable::consensus_decode(d); $x })),*)) 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<()> { pub fn connect(&mut self, host: &str, port: u16) -> IoResult<()> {
// Boot off any lingering readers or writers // Boot off any lingering readers or writers
if self.socket.is_some() { if self.socket.is_some() {
let _ = self.socket.get_mut_ref().close_read(); let _ = self.socket.as_mut().unwrap().close_read();
let _ = self.socket.get_mut_ref().close_write(); let _ = self.socket.as_mut().unwrap().close_write();
} }
// These locks should just pop open now // These locks should just pop open now
let mut reader_lock = self.buffered_reader.lock(); 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); tmp.skip_prefix = tmp.skip_prefix.mask(diff);
// Recurse // Recurse
idx += 1 + diff; idx += 1 + diff;
node = &mut **insert.get_mut_ref(); node = &mut **insert.as_mut().unwrap();
} }
// Prefixes match // Prefixes match
else { 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 // 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 search_len vs prefix len
} // end if prefixes match } // end if prefixes match
} // end loop } // 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); return (false, None);
} }
// Otherwise, do it // 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.shr(&(tree.skip_len as uint + 1)),
key_len - tree.skip_len as uint - 1); key_len - tree.skip_len as uint - 1);
if delete_child { 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, // If we haven't started, maybe return the "last" return value,
// which will be the root node. // which will be the root node.
if !self.started { 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(); return self.node.unwrap().data.as_ref();
} }
self.started = true; self.started = true;