diff --git a/src/lib.rs b/src/lib.rs index ca692d4..206abb8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -162,9 +162,9 @@ impl Downloader { out_path.push(filename); if !out_path.exists() { - let mut res = reqwest::get(url).expect("failed to download url"); - let mut file = File::open(out_path.as_path()).expect("failed to open file"); - copy(&mut res, &mut file).expect("failed to write file"); + let mut result = reqwest::get(url).expect("failed to download url"); + let mut file = File::create(out_path.as_path()).expect("failed to open file"); + copy(&mut result, &mut file).expect("failed to write file"); } out_path