Skip to content

Commit 9c9e138

Browse files
authored
Allow testing/example with no features (#85)
1 parent 5cb58ce commit 9c9e138

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

examples/hash.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
extern crate bcrypt;
22

3+
#[cfg(any(feature = "alloc", feature = "std"))]
34
use bcrypt::{hash, verify, DEFAULT_COST};
45

6+
#[cfg(any(feature = "alloc", feature = "std"))]
57
fn main() {
68
let hashed = hash("hunter2", DEFAULT_COST).unwrap();
79
let valid = verify("hunter2", &hashed).unwrap();
810
println!("{:?}", valid);
911
}
12+
13+
#[cfg(not(any(feature = "alloc", feature = "std")))]
14+
fn main() {}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub fn verify<P: AsRef<[u8]>>(password: P, hash: &str) -> BcryptResult<bool> {
219219
Ok(source_decoded.ct_eq(&generated_decoded).into())
220220
}
221221

222-
#[cfg(test)]
222+
#[cfg(all(test, any(feature = "alloc", feature = "std")))]
223223
mod tests {
224224
use super::{
225225
_hash_password,

0 commit comments

Comments
 (0)