From 34fb39da5b902cc645b7c5b0f3811e72bf8374b3 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Sat, 25 Mar 2017 23:30:11 +0300 Subject: [PATCH] avoid allocating string --- ethcore/src/builtin.rs | 4 ++-- ethcore/src/evm/evm.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ethcore/src/builtin.rs b/ethcore/src/builtin.rs index da0ee38e1..bdedd5739 100644 --- a/ethcore/src/builtin.rs +++ b/ethcore/src/builtin.rs @@ -28,11 +28,11 @@ use ethkey::{Signature, recover as ec_recover}; use ethjson; #[derive(Debug)] -pub struct Error(pub String); +pub struct Error(pub &'static str); impl From<&'static str> for Error { fn from(val: &'static str) -> Self { - Error(val.to_owned()) + Error(val) } } diff --git a/ethcore/src/evm/evm.rs b/ethcore/src/evm/evm.rs index 0e7a4d968..265b83559 100644 --- a/ethcore/src/evm/evm.rs +++ b/ethcore/src/evm/evm.rs @@ -61,7 +61,7 @@ pub enum Error { limit: usize }, /// Built-in contract failed on given input - BuiltIn(String), + BuiltIn(&'static str), /// Returned on evm internal error. Should never be ignored during development. /// Likely to cause consensus issues. Internal(String),