Fixing self_convention errors

This commit is contained in:
Tomusdrw 2016-01-19 11:15:39 +01:00
parent f169951d4e
commit fc4b67a12d
3 changed files with 5 additions and 4 deletions

View File

@ -152,6 +152,7 @@ impl Engine for Ethash {
}
}
#[allow(wrong_self_convention)] // to_ethash should take self
impl Ethash {
fn calculate_difficuty(&self, header: &Header, parent: &Header) -> U256 {
const EXP_DIFF_PERIOD: u64 = 100000;

View File

@ -75,7 +75,7 @@ impl<'a> Executive<'a> {
}
/// Creates `Externalities` from `Executive`.
pub fn to_externalities<'_>(&'_ mut self, origin_info: OriginInfo, substate: &'_ mut Substate, output: OutputPolicy<'_>) -> Externalities {
pub fn as_externalities<'_>(&'_ mut self, origin_info: OriginInfo, substate: &'_ mut Substate, output: OutputPolicy<'_>) -> Externalities {
Externalities::new(self.state, self.info, self.engine, self.depth, origin_info, substate, output)
}
@ -198,7 +198,7 @@ impl<'a> Executive<'a> {
let mut unconfirmed_substate = Substate::new();
let res = {
let mut ext = self.to_externalities(OriginInfo::from(&params), &mut unconfirmed_substate, OutputPolicy::Return(output));
let mut ext = self.as_externalities(OriginInfo::from(&params), &mut unconfirmed_substate, OutputPolicy::Return(output));
self.engine.vm_factory().create().exec(params, &mut ext)
};
@ -230,7 +230,7 @@ impl<'a> Executive<'a> {
self.state.transfer_balance(&params.sender, &params.address, &params.value);
let res = {
let mut ext = self.to_externalities(OriginInfo::from(&params), &mut unconfirmed_substate, OutputPolicy::InitContract);
let mut ext = self.as_externalities(OriginInfo::from(&params), &mut unconfirmed_substate, OutputPolicy::InitContract);
self.engine.vm_factory().create().exec(params, &mut ext)
};
self.enact_result(&res, substate, unconfirmed_substate, backup);

View File

@ -93,10 +93,10 @@ pub struct Spec {
state_root_memo: RwLock<Option<H256>>,
}
#[allow(wrong_self_convention)] // because to_engine(self) should be to_engine(&self)
impl Spec {
/// Convert this object into a boxed Engine of the right underlying type.
// TODO avoid this hard-coded nastiness - use dynamic-linked plugin framework instead.
#[allow(wrong_self_convention)]
pub fn to_engine(self) -> Result<Box<Engine>, Error> {
match self.engine_name.as_ref() {
"NullEngine" => Ok(NullEngine::new_boxed(self)),