Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Removing superfluous Box
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Drwięga committed Aug 23, 2016
1 parent 0ab65fb commit c35a1cd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions dapps/src/apps/urlhint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ pub trait URLHint {
pub struct URLHintContract {
urlhint: Contract,
registrar: Contract,
client: Arc<Box<ContractClient>>,
client: Arc<ContractClient>,
}

impl URLHintContract {
pub fn new(client: Arc<Box<ContractClient>>) -> Self {
pub fn new(client: Arc<ContractClient>) -> Self {
let urlhint = Interface::load(include_bytes!("./urlhint.json")).expect("urlhint.json is valid ABI");
let registrar = Interface::load(include_bytes!("./registrar.json")).expect("registrar.json is valid ABI");

Expand Down Expand Up @@ -244,7 +244,7 @@ mod tests {
// given
let registrar = FakeRegistrar::new();
let calls = registrar.calls.clone();
let urlhint = URLHintContract::new(Arc::new(Box::new(registrar)));
let urlhint = URLHintContract::new(Arc::new(registrar));

// when
let res = urlhint.resolve("test".bytes().collect());
Expand Down Expand Up @@ -272,7 +272,7 @@ mod tests {
Ok(format!("000000000000000000000000{}", URLHINT).from_hex().unwrap()),
Ok("0000000000000000000000000000000000000000000000000000000000000060ec4c1fe06c808fe3739858c347109b1f5f1ed4b5000000000000000000000000000000000000000000000000deadcafebeefbeefcafedeaddeedfeedffffffff0000000000000000000000000000000000000000000000000000000000000011657468636f72652f64616f2e636c61696d000000000000000000000000000000".from_hex().unwrap()),
]);
let urlhint = URLHintContract::new(Arc::new(Box::new(registrar)));
let urlhint = URLHintContract::new(Arc::new(registrar));

// when
let res = urlhint.resolve("test".bytes().collect());
Expand Down
8 changes: 4 additions & 4 deletions dapps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static DAPPS_DOMAIN : &'static str = ".parity";
pub struct ServerBuilder {
dapps_path: String,
handler: Arc<IoHandler>,
registrar: Arc<Box<ContractClient>>,
registrar: Arc<ContractClient>,
}

impl Extendable for ServerBuilder {
Expand All @@ -98,11 +98,11 @@ impl Extendable for ServerBuilder {

impl ServerBuilder {
/// Construct new dapps server
pub fn new(dapps_path: String, registrar: Box<ContractClient>) -> Self {
pub fn new(dapps_path: String, registrar: Arc<ContractClient>) -> Self {
ServerBuilder {
dapps_path: dapps_path,
handler: Arc::new(IoHandler::new()),
registrar: Arc::new(registrar),
registrar: registrar,
}
}

Expand Down Expand Up @@ -131,7 +131,7 @@ impl Server {
authorization: A,
handler: Arc<IoHandler>,
dapps_path: String,
registrar: Arc<Box<ContractClient>>,
registrar: Arc<ContractClient>,
) -> Result<Server, ServerError> {
let panic_handler = Arc::new(Mutex::new(None));
let authorization = Arc::new(authorization);
Expand Down
2 changes: 1 addition & 1 deletion parity/dapps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ mod server {
) -> Result<WebappServer, String> {
use ethcore_dapps as dapps;

let server = dapps::ServerBuilder::new(dapps_path, Box::new(Registrar {
let server = dapps::ServerBuilder::new(dapps_path, Arc::new(Registrar {
client: deps.client.clone(),
}));
let server = rpc_apis::setup_rpc(server, deps.apis.clone(), rpc_apis::ApiSet::UnsafeContext);
Expand Down

0 comments on commit c35a1cd

Please sign in to comment.