fix &str compared with String, add dyn to Box<dyn ..>

master
Ondřej Hruška 5 years ago
parent 4bc4386f34
commit c81e3caf17
Signed by untrusted user: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 6
      src/digest.rs

@ -39,7 +39,7 @@ impl Algorithm {
/// Calculate a hash of bytes using the selected algorithm
pub fn hash(&self, bytes: &[u8]) -> String {
let mut hash: Box<Digest> = match self.algo {
let mut hash: Box<dyn Digest> = match self.algo {
AlgorithmType::MD5 => Box::new(Md5::new()),
AlgorithmType::SHA2_256 => Box::new(Sha256::new()),
AlgorithmType::SHA2_512_256 => Box::new(Sha512Trunc256::new()),
@ -351,7 +351,7 @@ impl WwwAuthenticateHeader {
},
opaque: kv.remove("opaque"),
stale: match kv.get("stale") {
Some(v) => v.to_ascii_lowercase() == "true",
Some(v) => &v.to_ascii_lowercase() == "true",
None => false,
},
charset: match kv.get("charset") {
@ -370,7 +370,7 @@ impl WwwAuthenticateHeader {
None
},
userhash: match kv.get("userhash") {
Some(v) => v.to_ascii_lowercase() == "true",
Some(v) => &v.to_ascii_lowercase() == "true",
None => false,
},
nc : 0

Loading…
Cancel
Save