Skip to content

Commit

Permalink
Update dependencies & fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tversteeg committed Nov 14, 2021
1 parent 075b78b commit 6873705
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 111 deletions.
186 changes: 101 additions & 85 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ is-it-maintained-open-issues = { repository = "tversteeg/emplace" }
[dependencies]
anyhow = { version = "1.0.45", features = ["backtrace"] }
bugreport = "0.4.1"
clap = { version = "=3.0.0-beta.2", features = ["suggestions", "color", "wrap_help"] }
clap_generate = "=3.0.0-beta.2"
clap = { version = "3.0.0-beta.5", features = ["suggestions", "color", "wrap_help"] }
clap_generate = "3.0.0-beta.5"
colored = "2.0.0"
console = "0.14.1"
dialoguer = "0.8.0"
console = "0.15.0"
dialoguer = "0.9.0"
dirs = "4.0.0"
enum_dispatch = "0.3.7"
itertools = "0.10.1"
log = "0.4.14"
ron = "0.6.5"
ron = "0.7.0"
run_script = "0.9.0"
serde = { version = "1.0.130", features = ["derive"] }
simplelog = "0.11.0"
Expand Down
1 change: 0 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ impl Config {
let chosen_in = dialoguer::Select::with_theme(&*theme)
.with_prompt(prompt)
.items(choices_in)
.paged(true)
.clear(true)
.interact_on(&term)?;
if chosen_in == 0 {
Expand Down
1 change: 0 additions & 1 deletion src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ where
MultiSelect::new()
.items(&colored_selection)
.with_prompt("Select packages to sync")
.paged(true)
.interact()?
};

Expand Down
10 changes: 4 additions & 6 deletions src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ where
.as_ref()
.canonicalize()
// When canonicalizing path failed use the default path
.unwrap_or(Config::default_path())
.unwrap_or_else(|_| Config::default_path())
.to_str()
.ok_or_else(|| {
anyhow!(
Expand All @@ -47,13 +47,11 @@ where
// Print the completions
match shell_name {
"bash" => {
clap_generate::generate::<Bash, _>(&mut public_clap_app(), "emplace", &mut io::stdout())
}
"zsh" => {
clap_generate::generate::<Zsh, _>(&mut public_clap_app(), "emplace", &mut io::stdout())
clap_generate::generate(Bash, &mut public_clap_app(), "emplace", &mut io::stdout())
}
"zsh" => clap_generate::generate(Zsh, &mut public_clap_app(), "emplace", &mut io::stdout()),
"fish" => {
clap_generate::generate::<Fish, _>(&mut public_clap_app(), "emplace", &mut io::stdout())
clap_generate::generate(Fish, &mut public_clap_app(), "emplace", &mut io::stdout())
}
_ => (),
};
Expand Down
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ use bugreport::{
},
format::Markdown,
};
use clap::{App, AppSettings, Arg};
use clap::{App, AppSettings, Arg, ColorChoice};
use log::error;
use simplelog::{ColorChoice, LevelFilter, TermLogger, TerminalMode};
use simplelog::{ColorChoice as LogColorChoice, LevelFilter, TermLogger, TerminalMode};
use std::path::PathBuf;

fn public_clap_app<'a>() -> App<'a> {
Expand All @@ -35,8 +35,7 @@ fn public_clap_app<'a>() -> App<'a> {
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandRequiredElseHelp)
// Print the help in colors if the terminal allows it
.global_setting(AppSettings::ColorAuto)
.global_setting(AppSettings::ColoredHelp)
.color(ColorChoice::Auto)
.subcommand(
App::new("install")
.about("Install the packages that have been mirrored from other machines")
Expand All @@ -63,7 +62,7 @@ fn safe_main() -> Result<()> {
LevelFilter::Info,
simplelog::Config::default(),
TerminalMode::Mixed,
ColorChoice::Auto,
LogColorChoice::Auto,
)
.context("no interactive terminal")?;

Expand Down
2 changes: 1 addition & 1 deletion src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Package {

/// Check if this package is already installed.
pub fn is_installed(&self) -> Result<bool> {
self.source.package_is_installed(&self)
self.source.package_is_installed(self)
}

/// Check if the package manager can be found.
Expand Down
7 changes: 3 additions & 4 deletions src/package_manager_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl PackageManager {
// Loop over the arguments handling flags in a special way
while let Some(arg) = args_iter.next() {
// Stop when a flag is found that invalidate the command
if self.has_invalidating_flag(&arg) {
if self.has_invalidating_flag(arg) {
return vec![];
}

Expand All @@ -140,7 +140,7 @@ impl PackageManager {
.expect("Arg string is suddenly zero bytes");

if first_char == '-' || first_char == '+' {
self.handle_capture_flags(&arg, &mut args_iter, &mut catched_flags);
self.handle_capture_flags(arg, &mut args_iter, &mut catched_flags);

// If it's a flag containing an extra arguments besides it skip one
if self.known_flags_with_values().contains(&arg) {
Expand Down Expand Up @@ -195,8 +195,7 @@ impl PackageManager {
fn has_invalidating_flag(self, arg: &str) -> bool {
self.invalidating_flags()
.iter()
.find(|capture| *capture == &arg)
.is_some()
.any(|capture| capture == &arg)
}

/// Handle the iterator's flags using the different options as defined in the package managers.
Expand Down
4 changes: 1 addition & 3 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ impl Repo {
}

fn pretty_config() -> PrettyConfig {
PrettyConfig::new()
.with_depth_limit(2)
.with_indentor("".into())
PrettyConfig::new().depth_limit(2).indentor("".into())
}
}

0 comments on commit 6873705

Please sign in to comment.