Browse code

Rustfmt

Julio Biason authored on 17/05/2019 09:09:41
Showing 1 changed files

... ...
@@ -1,19 +1,20 @@
1
-use std::path::Path;
2
-use std::path::PathBuf;
3 1
 use std::fs::File;
4 2
 use std::io::prelude::*;
3
+use std::path::Path;
4
+use std::path::PathBuf;
5 5
 
6
-use elefren::prelude::*;
6
+use elefren::entities::attachment::Attachment;
7
+use elefren::entities::status::Status;
7 8
 use elefren::helpers::cli;
8 9
 use elefren::helpers::toml;
9
-use elefren::entities::status::Status;
10
-use elefren::entities::attachment::Attachment;
10
+use elefren::prelude::*;
11 11
 
12 12
 use reqwest;
13 13
 
14 14
 use hyper::Uri;
15 15
 
16
-#[macro_use] use log;
16
+#[macro_use]
17
+use log;
17 18
 use env_logger;
18 19
 
19 20
 fn main() {
... ...
@@ -33,7 +34,8 @@ fn main() {
33 34
 
34 35
     info!("Starting up...");
35 36
     client
36
-        .favourites().unwrap()
37
+        .favourites()
38
+        .unwrap()
37 39
         .items_iter()
38 40
         .take(2)
39 41
         .for_each(move |record| dump_record(record));
... ...
@@ -53,8 +55,7 @@ fn toot_dir(record: &Status) -> PathBuf {
53 55
 }
54 56
 
55 57
 fn create_structure(record: &Status) -> () {
56
-    std::fs::create_dir_all(toot_dir(record))
57
-        .expect("Failed to create the storage path");
58
+    std::fs::create_dir_all(toot_dir(record)).expect("Failed to create the storage path");
58 59
 }
59 60
 
60 61
 fn save_content(record: &Status) -> () {
... ...
@@ -68,16 +69,19 @@ fn save_content(record: &Status) -> () {
68 69
 fn save_attachments(record: &Status) -> () {
69 70
     debug!("Saving attachments of {}...", record.id);
70 71
     let base_path = toot_dir(&record);
71
-    record.media_attachments
72
+    record
73
+        .media_attachments
72 74
         .iter()
73 75
         .for_each(move |x| save_attachment(&x, &base_path));
74 76
 }
75 77
 
76
-fn save_attachment(attachment: &Attachment, base_path: &PathBuf) -> (){
78
+fn save_attachment(attachment: &Attachment, base_path: &PathBuf) -> () {
77 79
     debug!("Saving attachment {}", attachment.url);
78
-    let uri:Uri = attachment.url.parse().expect("Invalid URL");
79
-    let body = reqwest::get(&attachment.url).expect("Failed to connect to server")
80
-        .text().expect("Failed to retrieve attachment");
80
+    let uri: Uri = attachment.url.parse().expect("Invalid URL");
81
+    let body = reqwest::get(&attachment.url)
82
+        .expect("Failed to connect to server")
83
+        .text()
84
+        .expect("Failed to retrieve attachment");
81 85
 
82 86
     if let Ok(mut fp) = File::create(base_path.join(uri.path())) {
83 87
         fp.write_all(body.as_bytes())