fix(compilation warns): no-default-features (#10346)

This commit is contained in:
Niklas Adolfsson 2019-02-14 15:54:44 +01:00 committed by Andronik Ordian
parent bff0bedfa9
commit 9cce6a47d4
7 changed files with 12 additions and 3 deletions

View File

@ -58,7 +58,7 @@ pub struct ImportFromGethAccounts {
#[cfg(not(feature = "accounts"))] #[cfg(not(feature = "accounts"))]
pub fn execute(cmd: AccountCmd) -> Result<String, String> { pub fn execute(_cmd: AccountCmd) -> Result<String, String> {
Err("Account management is deprecated. Please see #9997 for alternatives:\nhttps://github.com/paritytech/parity-ethereum/issues/9997".into()) Err("Account management is deprecated. Please see #9997 for alternatives:\nhttps://github.com/paritytech/parity-ethereum/issues/9997".into())
} }

View File

@ -30,12 +30,12 @@ mod accounts {
pub struct AccountProvider; pub struct AccountProvider;
impl ::ethcore::miner::LocalAccounts for AccountProvider { impl ::ethcore::miner::LocalAccounts for AccountProvider {
fn is_local(&self, address: &Address) -> bool { fn is_local(&self, _address: &Address) -> bool {
false false
} }
} }
pub fn prepare_account_provider(_spec: &SpecType, _dirs: &Directories, _data_dir: &str, cfg: AccountsConfig, _passwords: &[Password]) -> Result<AccountProvider, String> { pub fn prepare_account_provider(_spec: &SpecType, _dirs: &Directories, _data_dir: &str, _cfg: AccountsConfig, _passwords: &[Password]) -> Result<AccountProvider, String> {
warn!("Note: Your instance of Parity Ethereum is running without account support. Some CLI options are ignored."); warn!("Note: Your instance of Parity Ethereum is running without account support. Some CLI options are ignored.");
Ok(AccountProvider) Ok(AccountProvider)
} }

View File

@ -139,6 +139,7 @@ fn file_exists(path: &Path) -> bool {
} }
} }
#[cfg(any(test, feature = "accounts"))]
pub fn upgrade_key_location(from: &PathBuf, to: &PathBuf) { pub fn upgrade_key_location(from: &PathBuf, to: &PathBuf) {
match fs::create_dir_all(&to).and_then(|()| fs::read_dir(from)) { match fs::create_dir_all(&to).and_then(|()| fs::read_dir(from)) {
Ok(entries) => { Ok(entries) => {

View File

@ -201,6 +201,7 @@ pub enum SignWith {
} }
impl SignWith { impl SignWith {
#[cfg(any(test, feature = "accounts"))]
fn is_password(&self) -> bool { fn is_password(&self) -> bool {
if let SignWith::Password(_) = *self { if let SignWith::Password(_) = *self {
true true

View File

@ -43,7 +43,9 @@ mod codes {
pub const EXECUTION_ERROR: i64 = -32015; pub const EXECUTION_ERROR: i64 = -32015;
pub const EXCEPTION_ERROR: i64 = -32016; pub const EXCEPTION_ERROR: i64 = -32016;
pub const DATABASE_ERROR: i64 = -32017; pub const DATABASE_ERROR: i64 = -32017;
#[cfg(any(test, feature = "accounts"))]
pub const ACCOUNT_LOCKED: i64 = -32020; pub const ACCOUNT_LOCKED: i64 = -32020;
#[cfg(any(test, feature = "accounts"))]
pub const PASSWORD_INVALID: i64 = -32021; pub const PASSWORD_INVALID: i64 = -32021;
pub const ACCOUNT_ERROR: i64 = -32023; pub const ACCOUNT_ERROR: i64 = -32023;
pub const PRIVATE_ERROR: i64 = -32024; pub const PRIVATE_ERROR: i64 = -32024;
@ -336,6 +338,7 @@ pub fn fetch<T: fmt::Debug>(error: T) -> Error {
} }
} }
#[cfg(any(test, feature = "accounts"))]
pub fn invalid_call_data<T: fmt::Display>(error: T) -> Error { pub fn invalid_call_data<T: fmt::Display>(error: T) -> Error {
Error { Error {
code: ErrorCode::ServerError(codes::ENCODING_ERROR), code: ErrorCode::ServerError(codes::ENCODING_ERROR),

View File

@ -20,6 +20,7 @@ pub mod errors;
pub mod block_import; pub mod block_import;
pub mod deprecated; pub mod deprecated;
pub mod dispatch; pub mod dispatch;
#[cfg(any(test, feature = "accounts"))]
pub mod eip191; pub mod eip191;
#[cfg(any(test, feature = "accounts"))] #[cfg(any(test, feature = "accounts"))]
pub mod engine_signer; pub mod engine_signer;
@ -28,6 +29,7 @@ pub mod fake_sign;
pub mod ipfs; pub mod ipfs;
pub mod light_fetch; pub mod light_fetch;
pub mod nonce; pub mod nonce;
#[cfg(any(test, feature = "accounts"))]
pub mod secretstore; pub mod secretstore;
mod network_settings; mod network_settings;

View File

@ -70,6 +70,7 @@ impl From<DeriveHash> for Derive {
} }
/// Error converting request data /// Error converting request data
#[cfg(any(test, feature = "accounts"))]
#[derive(Debug)] #[derive(Debug)]
pub enum ConvertError { pub enum ConvertError {
IndexOverlfow(u64), IndexOverlfow(u64),
@ -77,6 +78,7 @@ pub enum ConvertError {
impl Derive { impl Derive {
/// Convert to account provider struct dealing with possible overflows /// Convert to account provider struct dealing with possible overflows
#[cfg(any(test, feature = "accounts"))]
pub fn to_derivation(self) -> Result<ethstore::Derivation, ConvertError> { pub fn to_derivation(self) -> Result<ethstore::Derivation, ConvertError> {
Ok(match self { Ok(match self {
Derive::Hierarchical(drv) => { Derive::Hierarchical(drv) => {