Run rustfmt.

This commit is contained in:
Jordan Petridis
2017-12-09 05:57:16 +02:00
parent 5b19274e6a
commit b528c48e3b
10 changed files with 68 additions and 67 deletions
+10 -9
View File
@@ -60,15 +60,16 @@ fn download_into(dir: &str, file_title: &str, url: &str) -> Result<String> {
// Determine the file extension from the http content-type header.
fn get_ext(content: Option<ContentType>) -> Option<String> {
let cont = content.clone()?;
content.and_then(|c| mime_guess::get_extensions(c.type_().as_ref(), c.subtype().as_ref()))
.and_then(|c| {
if c.contains(&cont.subtype().as_ref()) {
Some(cont.subtype().as_ref().to_string())
} else {
Some(c.first().unwrap().to_string())
}
})
}
content
.and_then(|c| mime_guess::get_extensions(c.type_().as_ref(), c.subtype().as_ref()))
.and_then(|c| {
if c.contains(&cont.subtype().as_ref()) {
Some(cont.subtype().as_ref().to_string())
} else {
Some(c.first().unwrap().to_string())
}
})
}
// TODO: Write unit-tests.
/// Handles the I/O of fetching a remote file and saving into a Buffer and A File.