diff --git a/Cargo.lock b/Cargo.lock
index c8041d9cab76cb86d0b3a61ce203bf4cfacbf14c..0376bdbf6b1130933fe0f739b47f9ce97bf2813f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3416,7 +3416,6 @@ dependencies = [
  "sr-io 2.0.0",
  "sr-primitives 2.0.0",
  "sr-std 2.0.0",
- "substrate-keyring 2.0.0",
  "substrate-primitives 2.0.0",
 ]
 
diff --git a/palette/balances/Cargo.toml b/palette/balances/Cargo.toml
index d1ba5852935a9baa24416d675134c1c1741164c8..5fcbc5e0f0676454ceaea9fefecca6f1a752f40b 100644
--- a/palette/balances/Cargo.toml
+++ b/palette/balances/Cargo.toml
@@ -8,7 +8,6 @@ edition = "2018"
 serde = { version = "1.0.101", optional = true }
 safe-mix = { version = "1.0.0", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-substrate-keyring = { path = "../../primitives/keyring", optional = true }
 rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
 sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
 support = { package = "palette-support", path = "../support", default-features = false }
@@ -16,7 +15,7 @@ system = { package = "palette-system", path = "../system", default-features = fa
 
 [dev-dependencies]
 runtime-io = { package = "sr-io", path = "../../primitives/sr-io" }
-primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
+primitives = { package = "substrate-primitives", path = "../../primitives/core" }
 transaction-payment = { package = "pallet-transaction-payment", path = "../transaction-payment" }
 
 [features]
@@ -24,7 +23,6 @@ default = ["std"]
 std = [
 	"serde",
 	"safe-mix/std",
-	"substrate-keyring",
 	"codec/std",
 	"rstd/std",
 	"support/std",
diff --git a/palette/balances/src/lib.rs b/palette/balances/src/lib.rs
index e3e18be976b9d165e3b9b472211149cce1597828..4c5df40e080679377a0481b149308a73adb41de1 100644
--- a/palette/balances/src/lib.rs
+++ b/palette/balances/src/lib.rs
@@ -181,7 +181,9 @@ use sr_primitives::{
 };
 use system::{IsDeadAccount, OnNewAccount, ensure_signed, ensure_root};
 
+#[cfg(test)]
 mod mock;
+#[cfg(test)]
 mod tests;
 
 pub use self::imbalances::{PositiveImbalance, NegativeImbalance};
diff --git a/palette/balances/src/mock.rs b/palette/balances/src/mock.rs
index d90e7b2ce592e125f691abde80035b5515b1723c..62eabd1cf04d91494353a9d67e936675d06035c5 100644
--- a/palette/balances/src/mock.rs
+++ b/palette/balances/src/mock.rs
@@ -16,8 +16,6 @@
 
 //! Test utilities
 
-#![cfg(test)]
-
 use sr_primitives::{Perbill, traits::{ConvertInto, IdentityLookup}, testing::Header};
 use primitives::H256;
 use runtime_io;
diff --git a/palette/balances/src/tests.rs b/palette/balances/src/tests.rs
index 61e5a82f086dbaab2da6f58bfd51af0b374bb91d..3849df676425fa7436c0ae5f41add65ef0bc8077 100644
--- a/palette/balances/src/tests.rs
+++ b/palette/balances/src/tests.rs
@@ -16,8 +16,6 @@
 
 //! Tests for the module.
 
-#![cfg(test)]
-
 use super::*;
 use mock::{Balances, ExtBuilder, Runtime, System, info_from_weight, CALL};
 use sr_primitives::traits::SignedExtension;
diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml
index 9e6b984ac2d82e690b0ab7276019609e366b4f65..240da745f46ca983bf67afae7ea118f78ccc9807 100644
--- a/primitives/core/Cargo.toml
+++ b/primitives/core/Cargo.toml
@@ -17,7 +17,7 @@ impl-serde = { version = "0.2.3", optional = true }
 wasmi = { version = "0.6.2", optional = true }
 hash-db = { version = "0.15.2", default-features = false }
 hash256-std-hasher = { version = "0.15.2", default-features = false }
-ed25519-dalek = { version = "0.9.1",  default-features = false, features = ["u64_backend"], optional = true }
+ed25519-dalek = { version = "0.9.1", default-features = false, features = ["u64_backend"], optional = true }
 base58 = { version = "0.1.0", optional = true }
 blake2-rfc = { version = "0.2.18", default-features = false, optional = true }
 schnorrkel = { version = "0.8.5", features = ["preaudit_deprecated"], default-features = false, optional = true }
diff --git a/primitives/runtime-interface/src/impls.rs b/primitives/runtime-interface/src/impls.rs
index 7a6adc90c96ea66eb5ee89670aca172a1e38dd9a..c2821ce6ec8ac9e1bce0cf5cd73bef396b559fdd 100644
--- a/primitives/runtime-interface/src/impls.rs
+++ b/primitives/runtime-interface/src/impls.rs
@@ -47,7 +47,7 @@ assert_eq_size!(*const u8, u32);
 /// Converts a pointer and length into an `u64`.
 pub fn pointer_and_len_to_u64(ptr: u32, len: u32) -> u64 {
 	// The static assertions from above are changed into a runtime check.
-	#[cfg(all(feature = "std", not(feature = "disable_target_static_assertions")))]
+	#[cfg(all(not(feature = "std"), feature = "disable_target_static_assertions"))]
 	assert_eq!(4, rstd::mem::size_of::<usize>());
 
 	(u64::from(len) << 32) | u64::from(ptr)
@@ -56,7 +56,7 @@ pub fn pointer_and_len_to_u64(ptr: u32, len: u32) -> u64 {
 /// Splits an `u64` into the pointer and length.
 pub fn pointer_and_len_from_u64(val: u64) -> (u32, u32) {
 	// The static assertions from above are changed into a runtime check.
-	#[cfg(all(feature = "std", not(feature = "disable_target_static_assertions")))]
+	#[cfg(all(not(feature = "std"), feature = "disable_target_static_assertions"))]
 	assert_eq!(4, rstd::mem::size_of::<usize>());
 
 	let ptr = (val & (!0u32 as u64)) as u32;