Browse Source

Reformat using rustfmt

timvisee 6 years ago
parent
commit
44cf283f97
7 changed files with 26 additions and 24 deletions
  1. 14 9
      src/action/debug.rs
  2. 7 10
      src/action/history.rs
  3. 1 1
      src/action/info.rs
  4. 1 1
      src/action/password.rs
  5. 1 1
      src/action/upload.rs
  6. 1 1
      src/cmd/handler.rs
  7. 1 1
      src/main.rs

+ 14 - 9
src/action/debug.rs

@@ -1,7 +1,7 @@
 use chrono::Duration;
 use clap::ArgMatches;
 use ffsend_api::config::SEND_DEFAULT_EXPIRE_TIME;
-use prettytable::{Cell, format::FormatBuilder, Row, Table};
+use prettytable::{format::FormatBuilder, Cell, Row, Table};
 
 use client::to_duration;
 use cmd::matcher::{debug::DebugMatcher, main::MainMatcher, Matcher};
@@ -48,20 +48,25 @@ impl<'a> Debug<'a> {
             Cell::new("Timeout:"),
             Cell::new(
                 &to_duration(matcher_main.timeout())
-                    .map(|t| format_duration(
-                        Duration::from_std(t).expect("failed to convert timeout duration"),
-                    ))
-                    .unwrap_or("disabled".into())
+                    .map(|t| {
+                        format_duration(
+                            Duration::from_std(t).expect("failed to convert timeout duration"),
+                        )
+                    })
+                    .unwrap_or("disabled".into()),
             ),
         ]));
         table.add_row(Row::new(vec![
             Cell::new("Transfer timeout:"),
             Cell::new(
                 &to_duration(matcher_main.transfer_timeout())
-                    .map(|t| format_duration(
-                        Duration::from_std(t).expect("failed to convert transfer timeout duration"),
-                    ))
-                    .unwrap_or("disabled".into())
+                    .map(|t| {
+                        format_duration(
+                            Duration::from_std(t)
+                                .expect("failed to convert transfer timeout duration"),
+                        )
+                    })
+                    .unwrap_or("disabled".into()),
             ),
         ]));
 

+ 7 - 10
src/action/history.rs

@@ -1,5 +1,5 @@
 use clap::ArgMatches;
-use prettytable::{Cell, format::FormatBuilder, Row, Table};
+use prettytable::{format::FormatBuilder, Cell, Row, Table};
 
 use cmd::matcher::{main::MainMatcher, Matcher};
 use error::ActionError;
@@ -58,9 +58,7 @@ impl<'a> History<'a> {
             // Create a new table
             let mut table = Table::new();
             table.set_format(FormatBuilder::new().padding(0, 2).build());
-            table.add_row(Row::new(
-                columns.into_iter().map(Cell::new).collect(),
-            ));
+            table.add_row(Row::new(columns.into_iter().map(Cell::new).collect()));
 
             // Add an entry for each file
             for (i, file) in files.iter().enumerate() {
@@ -77,7 +75,7 @@ impl<'a> History<'a> {
                 };
 
                 // Define the cell values
-                let mut cells: Vec<String>= vec![
+                let mut cells: Vec<String> = vec![
                     format!("{}", i + 1),
                     file.download_url(true).into_string(),
                     expiry,
@@ -87,16 +85,15 @@ impl<'a> History<'a> {
                 }
 
                 // Add the row
-                table.add_row(Row::new(
-                    cells.into_iter().map(|c| Cell::new(&c)).collect(),
-                ));
+                table.add_row(Row::new(cells.into_iter().map(|c| Cell::new(&c)).collect()));
             }
 
             // Print the table
             table.printstd();
-
         } else {
-            files.iter().for_each(|f| println!("{}", f.download_url(true)));
+            files
+                .iter()
+                .for_each(|f| println!("{}", f.download_url(true)));
         }
 
         Ok(())

+ 1 - 1
src/action/info.rs

@@ -5,7 +5,7 @@ use ffsend_api::action::exists::{Error as ExistsError, Exists as ApiExists};
 use ffsend_api::action::info::{Error as InfoError, Info as ApiInfo};
 use ffsend_api::action::metadata::Metadata as ApiMetadata;
 use ffsend_api::file::remote_file::{FileParseError, RemoteFile};
-use prettytable::{Cell, format::FormatBuilder, Row, Table};
+use prettytable::{format::FormatBuilder, Cell, Row, Table};
 
 use client::create_client;
 use cmd::matcher::{info::InfoMatcher, main::MainMatcher, Matcher};

+ 1 - 1
src/action/password.rs

@@ -1,7 +1,7 @@
 use clap::ArgMatches;
 use ffsend_api::action::password::{Error as PasswordError, Password as ApiPassword};
 use ffsend_api::file::remote_file::RemoteFile;
-use prettytable::{Cell, format::FormatBuilder, Row, Table};
+use prettytable::{format::FormatBuilder, Cell, Row, Table};
 
 use client::create_client;
 use cmd::matcher::{main::MainMatcher, password::PasswordMatcher, Matcher};

+ 1 - 1
src/action/upload.rs

@@ -10,7 +10,7 @@ use ffsend_api::action::params::ParamsDataBuilder;
 use ffsend_api::action::upload::{Error as UploadError, Upload as ApiUpload};
 use ffsend_api::config::{UPLOAD_SIZE_MAX, UPLOAD_SIZE_MAX_RECOMMENDED};
 use ffsend_api::reader::ProgressReporter;
-use prettytable::{Cell, format::FormatBuilder, Row, Table};
+use prettytable::{format::FormatBuilder, Cell, Row, Table};
 #[cfg(feature = "archive")]
 use tempfile::{Builder as TempBuilder, NamedTempFile};
 

+ 1 - 1
src/cmd/handler.rs

@@ -2,7 +2,6 @@ extern crate directories;
 
 use clap::{App, AppSettings, Arg, ArgMatches};
 
-use config::{CLIENT_TIMEOUT, CLIENT_TRANSFER_TIMEOUT};
 #[cfg(feature = "history")]
 use super::matcher::HistoryMatcher;
 use super::matcher::{
@@ -14,6 +13,7 @@ use super::subcmd::CmdHistory;
 use super::subcmd::{
     CmdDebug, CmdDelete, CmdDownload, CmdExists, CmdInfo, CmdParams, CmdPassword, CmdUpload,
 };
+use config::{CLIENT_TIMEOUT, CLIENT_TRANSFER_TIMEOUT};
 #[cfg(feature = "history")]
 use util::app_history_file_path_string;
 

+ 1 - 1
src/main.rs

@@ -44,8 +44,8 @@ use action::params::Params;
 use action::password::Password;
 use action::upload::Upload;
 use cmd::{
-    Handler,
     matcher::{MainMatcher, Matcher},
+    Handler,
 };
 use error::Error;
 use util::{bin_name, highlight, quit_error, ErrorHints};