Skip to content

Commit f918ffb

Browse files
committed
Include alloc feature in std, run cargo fmt
1 parent 8dc1350 commit f918ffb

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ resolver = "2"
1616

1717
[features]
1818
default = ["std", "derive", "multihash-impl", "secure-hashes"]
19-
std = ["unsigned-varint/std", "multihash-derive/std"]
19+
std = ["unsigned-varint/std", "multihash-derive/std", "alloc"]
2020
alloc = []
2121
multihash-impl = ["derive"]
2222
derive = ["multihash-derive"]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#![deny(missing_docs)]
5353
#![cfg_attr(not(feature = "std"), no_std)]
5454

55-
#[cfg(all(not(feature = "std"), feature = "alloc"))]
55+
#[cfg(feature = "alloc")]
5656
#[macro_use]
5757
extern crate alloc;
5858

src/multihash.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::hasher::{Digest, Size};
22
use crate::Error;
3-
#[cfg(all(not(feature = "std"), feature = "alloc"))]
3+
#[cfg(feature = "alloc")]
44
use alloc::vec::Vec;
55
use core::convert::TryFrom;
66

@@ -160,7 +160,7 @@ impl<S: Size> Multihash<S> {
160160
write_multihash(w, self.code(), self.size(), self.digest())
161161
}
162162

163-
#[cfg(any(feature = "std", feature = "alloc"))]
163+
#[cfg(feature = "alloc")]
164164
/// Returns the bytes of a multihash.
165165
pub fn to_bytes(&self) -> Vec<u8> {
166166
let mut bytes = Vec::with_capacity(self.size().into());
@@ -179,7 +179,7 @@ impl<S: Size> core::hash::Hash for Multihash<S> {
179179
}
180180
}
181181

182-
#[cfg(any(feature = "std", feature = "alloc"))]
182+
#[cfg(feature = "alloc")]
183183
impl<S: Size> From<Multihash<S>> for Vec<u8> {
184184
fn from(multihash: Multihash<S>) -> Self {
185185
multihash.to_bytes()
@@ -286,8 +286,8 @@ where
286286
R: io::Read,
287287
S: Size,
288288
{
289-
let code = read_u64(&mut r)?;
290-
let size = read_u64(&mut r)?;
289+
let code = read_u64(&mut r)?;
290+
let size = read_u64(&mut r)?;
291291

292292
if size > S::to_u64() || size > u8::MAX as u64 {
293293
return Err(Error::InvalidSize(size));

0 commit comments

Comments
 (0)