Remove unnecessary cloning (#4263)

Seems like Externalities already [return a
vector](https://github.com/paritytech/polkadot-sdk/blob/ffbce2a817ec2e7c8b7ce49f7ed6794584f19667/substrate/primitives/externalities/src/lib.rs#L86),
so calling `to_vec` on a vector just results in an unneeded copying.

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
This commit is contained in:
Alexander Kalankhodzhaev
2024-04-24 16:30:47 +07:00
committed by GitHub
parent e0584a153d
commit c594b10a80
+1 -1
View File
@@ -182,7 +182,7 @@ impl From<MultiRemovalResults> for KillStorageResult {
pub trait Storage {
/// Returns the data for `key` in the storage or `None` if the key can not be found.
fn get(&self, key: &[u8]) -> Option<bytes::Bytes> {
self.storage(key).map(|s| bytes::Bytes::from(s.to_vec()))
self.storage(key).map(bytes::Bytes::from)
}
/// Get `key` from storage, placing the value into `value_out` and return the number of