let digest_vals = to_headermap(digest_value).ok()?;
digest_vals
.get(b"username".as_ref())
- .and_then(|b| std::str::from_utf8(*b).ok())
+ .and_then(|b| std::str::from_utf8(b).ok())
.map(|v| v.to_string())
}
}
if let (Some(username), Some(nonce), Some(user_response)) = (
digest_vals
.get(b"username".as_ref())
- .and_then(|b| std::str::from_utf8(*b).ok()),
+ .and_then(|b| std::str::from_utf8(b).ok()),
digest_vals.get(b"nonce".as_ref()),
digest_vals.get(b"response".as_ref()),
) {
if qop == &b"auth".as_ref() || qop == &b"auth-int".as_ref() {
correct_response = Some({
let mut c = Context::new();
- c.consume(&auth_pass);
+ c.consume(auth_pass);
c.consume(b":");
c.consume(nonce);
c.consume(b":");
Some(r) => r,
None => {
let mut c = Context::new();
- c.consume(&auth_pass);
+ c.consume(auth_pass);
c.consume(b":");
c.consume(nonce);
c.consume(b":");
None
};
- if let Some(mime) = mime_guess::from_path(&path).first() {
+ if let Some(mime) = mime_guess::from_path(path).first() {
res.headers_mut().typed_insert(ContentType::from(mime));
} else {
res.headers_mut().insert(
Some(path) => path,
None => return None,
};
- Some(self.args.path.join(&stripped_path))
+ Some(self.args.path.join(stripped_path))
}
fn strip_path_prefix<'a, P: AsRef<Path>>(&self, path: &'a P) -> Option<&'a Path> {
// Load public certificate from file.
pub fn load_certs(filename: &str) -> Result<Vec<Certificate>, Box<dyn std::error::Error>> {
// Open certificate file.
- let cert_file = fs::File::open(&filename)
- .map_err(|e| format!("Failed to access `{}`, {}", &filename, e))?;
+ let cert_file =
+ fs::File::open(filename).map_err(|e| format!("Failed to access `{}`, {}", &filename, e))?;
let mut reader = io::BufReader::new(cert_file);
// Load and return certificate.
// Load private key from file.
pub fn load_private_key(filename: &str) -> Result<PrivateKey, Box<dyn std::error::Error>> {
- let key_file = fs::File::open(&filename)
- .map_err(|e| format!("Failed to access `{}`, {}", &filename, e))?;
+ let key_file =
+ fs::File::open(filename).map_err(|e| format!("Failed to access `{}`, {}", &filename, e))?;
let mut reader = io::BufReader::new(key_file);
// Load and return a single private key.
#[rstest]
fn wrong_path_cert() -> Result<(), Error> {
Command::cargo_bin("dufs")?
- .args(&["--tls-cert", "wrong", "--tls-key", "tests/data/key.pem"])
+ .args(["--tls-cert", "wrong", "--tls-key", "tests/data/key.pem"])
.assert()
.failure()
.stderr(contains("error: Failed to access `wrong`"));
#[rstest]
fn wrong_path_key() -> Result<(), Error> {
Command::cargo_bin("dufs")?
- .args(&["--tls-cert", "tests/data/cert.pem", "--tls-key", "wrong"])
+ .args(["--tls-cert", "tests/data/cert.pem", "--tls-key", "wrong"])
.assert()
.failure()
.stderr(contains("error: Failed to access `wrong`"));