Skip to content

Commit

Permalink
Reformat using rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
timvisee committed Nov 21, 2018
1 parent 5b8120e commit 44cf283
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
23 changes: 14 additions & 9 deletions src/action/debug.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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()),
),
]));

Expand Down
17 changes: 7 additions & 10 deletions src/action/history.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -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,
Expand All @@ -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(())
Expand Down
2 changes: 1 addition & 1 deletion src/action/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/action/password.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/action/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 44cf283

Please sign in to comment.