Update to Rust edition 2018

This commit is contained in:
timvisee 2019-01-12 23:34:38 +01:00
parent 26bdcebe00
commit 3ceff500cf
No known key found for this signature in database
GPG key ID: 109CBA0BF74036C2
40 changed files with 105 additions and 102 deletions

View file

@ -21,6 +21,7 @@ categories = [
exclude = [
"res/*",
]
edition = "2018"
[package.metadata.deb]
section = "utility"

View file

@ -146,7 +146,7 @@ all available subcommands.
Because `ffsend` is still in alpha, only limited installation options are
available right now.
### Arch AUR package
#### Arch AUR package
`ffsend` on `aur.archlinux.org`][aur-ffsend]
```bash

View file

@ -3,10 +3,10 @@ use clap::ArgMatches;
use ffsend_api::config::SEND_DEFAULT_EXPIRE_TIME;
use prettytable::{format::FormatBuilder, Cell, Row, Table};
use client::to_duration;
use cmd::matcher::{debug::DebugMatcher, main::MainMatcher, Matcher};
use error::ActionError;
use util::{features_list, format_bool, format_duration};
use crate::client::to_duration;
use crate::cmd::matcher::{debug::DebugMatcher, main::MainMatcher, Matcher};
use crate::error::ActionError;
use crate::util::{features_list, format_bool, format_duration};
/// A file debug action.
pub struct Debug<'a> {

View file

@ -2,12 +2,12 @@ use clap::ArgMatches;
use ffsend_api::action::delete::{Delete as ApiDelete, Error as DeleteError};
use ffsend_api::file::remote_file::{FileParseError, RemoteFile};
use client::create_client;
use cmd::matcher::{delete::DeleteMatcher, main::MainMatcher, Matcher};
use error::ActionError;
use crate::client::create_client;
use crate::cmd::matcher::{delete::DeleteMatcher, main::MainMatcher, Matcher};
use crate::error::ActionError;
#[cfg(feature = "history")]
use history_tool;
use util::{ensure_owner_token, print_success};
use crate::history_tool;
use crate::util::{ensure_owner_token, print_success};
/// A file delete action.
pub struct Delete<'a> {

View file

@ -16,13 +16,13 @@ use ffsend_api::reader::ProgressReporter;
use tempfile::{Builder as TempBuilder, NamedTempFile};
#[cfg(feature = "archive")]
use archive::archive::Archive;
use client::create_transfer_client;
use cmd::matcher::{download::DownloadMatcher, main::MainMatcher, Matcher};
use crate::archive::archive::Archive;
use crate::client::create_transfer_client;
use crate::cmd::matcher::{download::DownloadMatcher, main::MainMatcher, Matcher};
#[cfg(feature = "history")]
use history_tool;
use progress::ProgressBar;
use util::{
use crate::history_tool;
use crate::progress::ProgressBar;
use crate::util::{
ensure_enough_space, ensure_password, prompt_yes, quit, quit_error, quit_error_msg, ErrorHints,
};

View file

@ -2,12 +2,12 @@ use clap::ArgMatches;
use ffsend_api::action::exists::{Error as ExistsError, Exists as ApiExists};
use ffsend_api::file::remote_file::{FileParseError, RemoteFile};
use client::create_client;
use cmd::matcher::main::MainMatcher;
use cmd::matcher::{exists::ExistsMatcher, Matcher};
use error::ActionError;
use crate::client::create_client;
use crate::cmd::matcher::main::MainMatcher;
use crate::cmd::matcher::{exists::ExistsMatcher, Matcher};
use crate::error::ActionError;
#[cfg(feature = "history")]
use history_tool;
use crate::history_tool;
/// A file exists action.
pub struct Exists<'a> {

View file

@ -1,10 +1,10 @@
use clap::ArgMatches;
use prettytable::{format::FormatBuilder, Cell, Row, Table};
use cmd::matcher::{main::MainMatcher, Matcher};
use error::ActionError;
use history::{History as HistoryManager, LoadError as HistoryLoadError};
use util::format_duration;
use crate::cmd::matcher::{main::MainMatcher, Matcher};
use crate::error::ActionError;
use crate::history::{History as HistoryManager, LoadError as HistoryLoadError};
use crate::util::format_duration;
/// A history action.
pub struct History<'a> {

View file

@ -7,11 +7,13 @@ use ffsend_api::action::metadata::Metadata as ApiMetadata;
use ffsend_api::file::remote_file::{FileParseError, RemoteFile};
use prettytable::{format::FormatBuilder, Cell, Row, Table};
use client::create_client;
use cmd::matcher::{info::InfoMatcher, main::MainMatcher, Matcher};
use crate::client::create_client;
use crate::cmd::matcher::{info::InfoMatcher, main::MainMatcher, Matcher};
#[cfg(feature = "history")]
use history_tool;
use util::{ensure_owner_token, ensure_password, format_bytes, format_duration, print_error};
use crate::history_tool;
use crate::util::{
ensure_owner_token, ensure_password, format_bytes, format_duration, print_error,
};
/// A file info action.
pub struct Info<'a> {

View file

@ -2,12 +2,12 @@ use clap::ArgMatches;
use ffsend_api::action::params::{Error as ParamsError, Params as ApiParams, ParamsDataBuilder};
use ffsend_api::file::remote_file::RemoteFile;
use client::create_client;
use cmd::matcher::{main::MainMatcher, params::ParamsMatcher, Matcher};
use error::ActionError;
use crate::client::create_client;
use crate::cmd::matcher::{main::MainMatcher, params::ParamsMatcher, Matcher};
use crate::error::ActionError;
#[cfg(feature = "history")]
use history_tool;
use util::{ensure_owner_token, print_success};
use crate::history_tool;
use crate::util::{ensure_owner_token, print_success};
/// A file parameters action.
pub struct Params<'a> {

View file

@ -3,12 +3,12 @@ use ffsend_api::action::password::{Error as PasswordError, Password as ApiPasswo
use ffsend_api::file::remote_file::RemoteFile;
use prettytable::{format::FormatBuilder, Cell, Row, Table};
use client::create_client;
use cmd::matcher::{main::MainMatcher, password::PasswordMatcher, Matcher};
use error::ActionError;
use crate::client::create_client;
use crate::cmd::matcher::{main::MainMatcher, password::PasswordMatcher, Matcher};
use crate::error::ActionError;
#[cfg(feature = "history")]
use history_tool;
use util::{ensure_owner_token, print_success};
use crate::history_tool;
use crate::util::{ensure_owner_token, print_success};
/// A file password action.
pub struct Password<'a> {

View file

@ -15,15 +15,15 @@ use prettytable::{format::FormatBuilder, Cell, Row, Table};
use tempfile::{Builder as TempBuilder, NamedTempFile};
#[cfg(feature = "archive")]
use archive::archiver::Archiver;
use client::create_transfer_client;
use cmd::matcher::{MainMatcher, Matcher, UploadMatcher};
use crate::archive::archiver::Archiver;
use crate::client::create_transfer_client;
use crate::cmd::matcher::{MainMatcher, Matcher, UploadMatcher};
#[cfg(feature = "history")]
use history_tool;
use progress::ProgressBar;
use crate::history_tool;
use crate::progress::ProgressBar;
#[cfg(feature = "clipboard")]
use util::set_clipboard;
use util::{
use crate::util::set_clipboard;
use crate::util::{
format_bytes, open_url, print_error, print_error_msg, prompt_yes, quit, quit_error_msg,
ErrorHintsBuilder,
};

View file

@ -2,7 +2,7 @@ use std::time::Duration;
use ffsend_api::reqwest::{Client, ClientBuilder};
use cmd::matcher::MainMatcher;
use crate::cmd::matcher::MainMatcher;
/// Create the default client, which is used for generic Send requests.
///

View file

@ -5,7 +5,7 @@ use ffsend_api::action::params::{
use super::{CmdArg, CmdArgFlag, CmdArgOption};
use util::{quit_error_msg, ErrorHintsBuilder};
use crate::util::{quit_error_msg, ErrorHintsBuilder};
/// The download limit argument.
pub struct ArgDownloadLimit {}

View file

@ -4,8 +4,8 @@ use ffsend_api::config::SEND_DEFAULT_HOST;
use ffsend_api::url::Url;
use super::{CmdArg, CmdArgOption};
use host::parse_host;
use util::{quit_error, ErrorHints};
use crate::host::parse_host;
use crate::util::{quit_error, ErrorHints};
/// The host argument.
pub struct ArgHost {}

View file

@ -1,8 +1,8 @@
use clap::{Arg, ArgMatches};
use super::{CmdArg, CmdArgFlag, CmdArgOption};
use cmd::matcher::{MainMatcher, Matcher};
use util::prompt_owner_token;
use crate::cmd::matcher::{MainMatcher, Matcher};
use crate::util::prompt_owner_token;
/// The owner argument.
pub struct ArgOwner {}

View file

@ -1,8 +1,8 @@
use clap::{Arg, ArgMatches};
use super::{CmdArg, CmdArgFlag, CmdArgOption};
use cmd::matcher::{MainMatcher, Matcher};
use util::{check_empty_password, prompt_password};
use crate::cmd::matcher::{MainMatcher, Matcher};
use crate::util::{check_empty_password, prompt_password};
/// The password argument.
pub struct ArgPassword {}

View file

@ -3,8 +3,8 @@ use failure::Fail;
use ffsend_api::url::Url;
use super::{CmdArg, CmdArgOption};
use host::parse_host;
use util::{quit_error, ErrorHints};
use crate::host::parse_host;
use crate::util::{quit_error, ErrorHints};
/// The URL argument.
pub struct ArgUrl {}

View file

@ -13,9 +13,9 @@ use super::subcmd::CmdHistory;
use super::subcmd::{
CmdDebug, CmdDelete, CmdDownload, CmdExists, CmdInfo, CmdParams, CmdPassword, CmdUpload,
};
use config::{CLIENT_TIMEOUT, CLIENT_TRANSFER_TIMEOUT};
use crate::config::{CLIENT_TIMEOUT, CLIENT_TRANSFER_TIMEOUT};
#[cfg(feature = "history")]
use util::app_history_file_path_string;
use crate::util::app_history_file_path_string;
#[cfg(feature = "history")]
lazy_static! {

View file

@ -2,7 +2,7 @@ use clap::ArgMatches;
use ffsend_api::url::Url;
use super::Matcher;
use cmd::arg::{ArgHost, CmdArgOption};
use crate::cmd::arg::{ArgHost, CmdArgOption};
/// The debug command matcher.
pub struct DebugMatcher<'a> {

View file

@ -2,7 +2,7 @@ use clap::ArgMatches;
use ffsend_api::url::Url;
use super::Matcher;
use cmd::arg::{ArgOwner, ArgUrl, CmdArgOption};
use crate::cmd::arg::{ArgOwner, ArgUrl, CmdArgOption};
/// The delete command matcher.
pub struct DeleteMatcher<'a> {

View file

@ -4,9 +4,9 @@ use clap::ArgMatches;
use ffsend_api::url::Url;
use super::Matcher;
use cmd::arg::{ArgPassword, ArgUrl, CmdArgOption};
use crate::cmd::arg::{ArgPassword, ArgUrl, CmdArgOption};
#[cfg(feature = "archive")]
use util::env_var_present;
use crate::util::env_var_present;
/// The download command matcher.
pub struct DownloadMatcher<'a> {

View file

@ -3,7 +3,7 @@ use ffsend_api::url::Url;
use clap::ArgMatches;
use super::Matcher;
use cmd::arg::{ArgUrl, CmdArgOption};
use crate::cmd::arg::{ArgUrl, CmdArgOption};
/// The exists command matcher.
pub struct ExistsMatcher<'a> {

View file

@ -3,7 +3,7 @@ use ffsend_api::url::Url;
use clap::ArgMatches;
use super::Matcher;
use cmd::arg::{ArgOwner, ArgPassword, ArgUrl, CmdArgOption};
use crate::cmd::arg::{ArgOwner, ArgPassword, ArgUrl, CmdArgOption};
/// The info command matcher.
pub struct InfoMatcher<'a> {

View file

@ -4,9 +4,9 @@ use std::path::PathBuf;
use clap::ArgMatches;
use super::Matcher;
use util::env_var_present;
use crate::util::env_var_present;
#[cfg(feature = "history")]
use util::{quit_error_msg, ErrorHintsBuilder};
use crate::util::{quit_error_msg, ErrorHintsBuilder};
/// The main command matcher.
pub struct MainMatcher<'a> {

View file

@ -2,7 +2,7 @@ use clap::ArgMatches;
use ffsend_api::url::Url;
use super::Matcher;
use cmd::arg::{ArgDownloadLimit, ArgOwner, ArgUrl, CmdArgOption};
use crate::cmd::arg::{ArgDownloadLimit, ArgOwner, ArgUrl, CmdArgOption};
/// The params command matcher.
pub struct ParamsMatcher<'a> {

View file

@ -2,9 +2,9 @@ use clap::ArgMatches;
use ffsend_api::url::Url;
use rpassword::prompt_password_stderr;
use cmd::arg::{ArgGenPassphrase, ArgOwner, ArgPassword, ArgUrl, CmdArgFlag, CmdArgOption};
use cmd::matcher::{MainMatcher, Matcher};
use util::check_empty_password;
use crate::cmd::arg::{ArgGenPassphrase, ArgOwner, ArgPassword, ArgUrl, CmdArgFlag, CmdArgOption};
use crate::cmd::matcher::{MainMatcher, Matcher};
use crate::util::check_empty_password;
/// The password command matcher.
pub struct PasswordMatcher<'a> {

View file

@ -3,10 +3,10 @@ use ffsend_api::action::params::PARAMS_DEFAULT_DOWNLOAD as DOWNLOAD_DEFAULT;
use ffsend_api::url::Url;
use super::Matcher;
use cmd::arg::{
use crate::cmd::arg::{
ArgDownloadLimit, ArgGenPassphrase, ArgHost, ArgPassword, CmdArgFlag, CmdArgOption,
};
use util::{env_var_present, quit_error_msg, ErrorHintsBuilder};
use crate::util::{env_var_present, quit_error_msg, ErrorHintsBuilder};
/// The upload command matcher.
pub struct UploadMatcher<'a> {

View file

@ -1,6 +1,6 @@
use clap::{App, SubCommand};
use cmd::arg::{ArgHost, CmdArg};
use crate::cmd::arg::{ArgHost, CmdArg};
/// The debug command definition.
pub struct CmdDebug;

View file

@ -1,6 +1,6 @@
use clap::{App, SubCommand};
use cmd::arg::{ArgOwner, ArgUrl, CmdArg};
use crate::cmd::arg::{ArgOwner, ArgUrl, CmdArg};
/// The delete command definition.
pub struct CmdDelete;

View file

@ -1,6 +1,6 @@
use clap::{App, Arg, SubCommand};
use cmd::arg::{ArgPassword, ArgUrl, CmdArg};
use crate::cmd::arg::{ArgPassword, ArgUrl, CmdArg};
/// The download command definition.
pub struct CmdDownload;

View file

@ -1,6 +1,6 @@
use clap::{App, SubCommand};
use cmd::arg::{ArgUrl, CmdArg};
use crate::cmd::arg::{ArgUrl, CmdArg};
/// The exists command definition.
pub struct CmdExists;

View file

@ -1,6 +1,6 @@
use clap::{App, SubCommand};
use cmd::arg::{ArgOwner, ArgPassword, ArgUrl, CmdArg};
use crate::cmd::arg::{ArgOwner, ArgPassword, ArgUrl, CmdArg};
/// The info command definition.
pub struct CmdInfo;

View file

@ -1,6 +1,6 @@
use clap::{App, SubCommand};
use cmd::arg::{ArgDownloadLimit, ArgOwner, ArgUrl, CmdArg};
use crate::cmd::arg::{ArgDownloadLimit, ArgOwner, ArgUrl, CmdArg};
/// The params command definition.
pub struct CmdParams;

View file

@ -1,6 +1,6 @@
use clap::{App, SubCommand};
use cmd::arg::{ArgGenPassphrase, ArgOwner, ArgPassword, ArgUrl, CmdArg};
use crate::cmd::arg::{ArgGenPassphrase, ArgOwner, ArgPassword, ArgUrl, CmdArg};
/// The password command definition.
pub struct CmdPassword;

View file

@ -1,7 +1,7 @@
use clap::{App, Arg, SubCommand};
use ffsend_api::action::params::PARAMS_DEFAULT_DOWNLOAD_STR as DOWNLOAD_DEFAULT;
use cmd::arg::{ArgDownloadLimit, ArgGenPassphrase, ArgHost, ArgPassword, CmdArg};
use crate::cmd::arg::{ArgDownloadLimit, ArgGenPassphrase, ArgHost, ArgPassword, CmdArg};
/// The upload command definition.
pub struct CmdUpload;

View file

@ -4,11 +4,11 @@ use ffsend_api::action::params::Error as ParamsError;
use ffsend_api::action::password::Error as PasswordError;
use ffsend_api::file::remote_file::FileParseError;
use action::download::Error as CliDownloadError;
use crate::action::download::Error as CliDownloadError;
#[cfg(feature = "history")]
use action::history::Error as CliHistoryError;
use action::info::Error as CliInfoError;
use action::upload::Error as CliUploadError;
use crate::action::history::Error as CliHistoryError;
use crate::action::info::Error as CliInfoError;
use crate::action::upload::Error as CliUploadError;
#[derive(Fail, Debug)]
pub enum Error {

View file

@ -11,7 +11,7 @@ use self::version_compare::{CompOp, VersionCompare};
use failure::Fail;
use ffsend_api::file::remote_file::RemoteFile;
use util::{print_error, print_warning};
use crate::util::{print_error, print_warning};
/// The minimum supported history file version.
const VERSION_MIN: &str = "0.0.1";

View file

@ -1,9 +1,9 @@
use failure::Fail;
use ffsend_api::file::remote_file::RemoteFile;
use cmd::matcher::MainMatcher;
use history::{Error as HistoryError, History};
use util::print_error;
use crate::cmd::matcher::MainMatcher;
use crate::history::{Error as HistoryError, History};
use crate::util::print_error;
/// Load the history from the given path, add the given file, and save it
/// again.

View file

@ -33,22 +33,22 @@ mod host;
mod progress;
mod util;
use action::debug::Debug;
use action::delete::Delete;
use action::download::Download;
use action::exists::Exists;
use crate::action::debug::Debug;
use crate::action::delete::Delete;
use crate::action::download::Download;
use crate::action::exists::Exists;
#[cfg(feature = "history")]
use action::history::History;
use action::info::Info;
use action::params::Params;
use action::password::Password;
use action::upload::Upload;
use cmd::{
use crate::action::history::History;
use crate::action::info::Info;
use crate::action::params::Params;
use crate::action::password::Password;
use crate::action::upload::Upload;
use crate::cmd::{
matcher::{MainMatcher, Matcher},
Handler,
};
use error::Error;
use util::{bin_name, highlight, quit_error, ErrorHints};
use crate::error::Error;
use crate::util::{bin_name, highlight, quit_error, ErrorHints};
/// Application entrypoint.
fn main() {

View file

@ -32,7 +32,7 @@ use failure::{Compat, Error};
use ffsend_api::url::Url;
use rpassword::prompt_password_stderr;
use cmd::matcher::MainMatcher;
use crate::cmd::matcher::MainMatcher;
/// Print a success message.
pub fn print_success(msg: &str) {
@ -297,7 +297,7 @@ pub fn set_clipboard(content: String) -> Result<(), ClipboardError> {
return Err(match err.kind() {
IoErrorKind::NotFound => ClipboardError::NoXclip,
_ => ClipboardError::Xclip(err),
})
});
}
};