aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariot Tsitoara <[email protected]>2021-01-02 01:23:38 +0100
committerMariot Tsitoara <[email protected]>2021-01-02 01:23:38 +0100
commit03f0b6b3e61092b726dc3cda02ddf5e9be490b6b (patch)
tree183cc4a9c79f3d3cd18d732d205f50c5b2dc56bf
parentRemove unnecessary parentheses (diff)
downloadchan-downloader-03f0b6b3e61092b726dc3cda02ddf5e9be490b6b.tar.xz
chan-downloader-03f0b6b3e61092b726dc3cda02ddf5e9be490b6b.zip
Remove unused tempdir calls
-rw-r--r--Cargo.toml1
-rw-r--r--src/main.rs8
2 files changed, 1 insertions, 8 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 1e7d9ae..f0cfe0d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,4 +17,3 @@ indicatif = "0.11.0"
lazy_static = "1.3.0"
regex = "1.1.2"
reqwest = "0.9.12"
-tempdir = "0.3.7"
diff --git a/src/main.rs b/src/main.rs
index e98d6de..38e0328 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,13 +4,11 @@ extern crate clap;
extern crate lazy_static;
extern crate regex;
extern crate reqwest;
-extern crate tempdir;
use clap::{App, ArgMatches};
use indicatif::{ProgressBar, ProgressStyle};
use regex::Regex;
use reqwest::{Client, StatusCode};
-use tempdir::TempDir;
use std::env;
use std::fs::create_dir_all;
@@ -31,15 +29,11 @@ fn load(url: &str, client: &Client) -> reqwest::Response {
}
fn save_image(url: &str, name: &str, client: &Client) -> Result<String, String> {
- let tmp_dir = TempDir::new("inb4404_temp");
let mut response = client.get(url).send().unwrap();
let file_name = match response.status() {
StatusCode::OK => {
- let mut dest = {
- tmp_dir.unwrap().path().join(name);
- File::create(name).unwrap()
- };
+ let mut dest = File::create(name).unwrap();
copy(&mut response, &mut dest).unwrap();
name
}