Auto merge of #8872 - hellow554:dependency_update, r=llogiq

update dependencies

changelog: none

Updating some dependencies, but the biggest one is clap to v3, but without using the derive struct thingy.
This commit is contained in:
bors 2022-05-24 06:52:41 +00:00
commit 050cdd6689
6 changed files with 89 additions and 107 deletions

View file

@ -28,7 +28,7 @@ tempfile = { version = "3.2", optional = true }
termize = "0.1" termize = "0.1"
[dev-dependencies] [dev-dependencies]
compiletest_rs = { version = "0.7.1", features = ["tmp"] } compiletest_rs = { version = "0.8", features = ["tmp"] }
tester = "0.9" tester = "0.9"
regex = "1.5" regex = "1.5"
# This is used by the `collect-metadata` alias. # This is used by the `collect-metadata` alias.
@ -48,7 +48,7 @@ quote = "1.0"
serde = { version = "1.0.125", features = ["derive"] } serde = { version = "1.0.125", features = ["derive"] }
syn = { version = "1.0", features = ["full"] } syn = { version = "1.0", features = ["full"] }
futures = "0.3" futures = "0.3"
parking_lot = "0.11.2" parking_lot = "0.12"
tokio = { version = "1", features = ["io-util"] } tokio = { version = "1", features = ["io-util"] }
rustc-semver = "1.1" rustc-semver = "1.1"

View file

@ -5,7 +5,7 @@ edition = "2021"
[dependencies] [dependencies]
aho-corasick = "0.7" aho-corasick = "0.7"
clap = "2.33" clap = "3.1"
indoc = "1.0" indoc = "1.0"
itertools = "0.10.1" itertools = "0.10.1"
opener = "0.5" opener = "0.5"

View file

@ -2,20 +2,20 @@
// warn on lints, that are included in `rust-lang/rust`s bootstrap // warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)] #![warn(rust_2018_idioms, unused_lifetimes)]
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; use clap::{Arg, ArgMatches, Command};
use clippy_dev::{bless, fmt, lint, new_lint, serve, setup, update_lints}; use clippy_dev::{bless, fmt, lint, new_lint, serve, setup, update_lints};
use indoc::indoc; use indoc::indoc;
fn main() { fn main() {
let matches = get_clap_config(); let matches = get_clap_config();
match matches.subcommand() { match matches.subcommand() {
("bless", Some(matches)) => { Some(("bless", matches)) => {
bless::bless(matches.is_present("ignore-timestamp")); bless::bless(matches.is_present("ignore-timestamp"));
}, },
("fmt", Some(matches)) => { Some(("fmt", matches)) => {
fmt::run(matches.is_present("check"), matches.is_present("verbose")); fmt::run(matches.is_present("check"), matches.is_present("verbose"));
}, },
("update_lints", Some(matches)) => { Some(("update_lints", matches)) => {
if matches.is_present("print-only") { if matches.is_present("print-only") {
update_lints::print_lints(); update_lints::print_lints();
} else if matches.is_present("check") { } else if matches.is_present("check") {
@ -24,7 +24,7 @@ fn main() {
update_lints::update(update_lints::UpdateMode::Change); update_lints::update(update_lints::UpdateMode::Change);
} }
}, },
("new_lint", Some(matches)) => { Some(("new_lint", matches)) => {
match new_lint::create( match new_lint::create(
matches.value_of("pass"), matches.value_of("pass"),
matches.value_of("name"), matches.value_of("name"),
@ -35,8 +35,8 @@ fn main() {
Err(e) => eprintln!("Unable to create lint: {}", e), Err(e) => eprintln!("Unable to create lint: {}", e),
} }
}, },
("setup", Some(sub_command)) => match sub_command.subcommand() { Some(("setup", sub_command)) => match sub_command.subcommand() {
("intellij", Some(matches)) => { Some(("intellij", matches)) => {
if matches.is_present("remove") { if matches.is_present("remove") {
setup::intellij::remove_rustc_src(); setup::intellij::remove_rustc_src();
} else { } else {
@ -47,14 +47,14 @@ fn main() {
); );
} }
}, },
("git-hook", Some(matches)) => { Some(("git-hook", matches)) => {
if matches.is_present("remove") { if matches.is_present("remove") {
setup::git_hook::remove_hook(); setup::git_hook::remove_hook();
} else { } else {
setup::git_hook::install_hook(matches.is_present("force-override")); setup::git_hook::install_hook(matches.is_present("force-override"));
} }
}, },
("vscode-tasks", Some(matches)) => { Some(("vscode-tasks", matches)) => {
if matches.is_present("remove") { if matches.is_present("remove") {
setup::vscode::remove_tasks(); setup::vscode::remove_tasks();
} else { } else {
@ -63,23 +63,23 @@ fn main() {
}, },
_ => {}, _ => {},
}, },
("remove", Some(sub_command)) => match sub_command.subcommand() { Some(("remove", sub_command)) => match sub_command.subcommand() {
("git-hook", Some(_)) => setup::git_hook::remove_hook(), Some(("git-hook", _)) => setup::git_hook::remove_hook(),
("intellij", Some(_)) => setup::intellij::remove_rustc_src(), Some(("intellij", _)) => setup::intellij::remove_rustc_src(),
("vscode-tasks", Some(_)) => setup::vscode::remove_tasks(), Some(("vscode-tasks", _)) => setup::vscode::remove_tasks(),
_ => {}, _ => {},
}, },
("serve", Some(matches)) => { Some(("serve", matches)) => {
let port = matches.value_of("port").unwrap().parse().unwrap(); let port = matches.value_of("port").unwrap().parse().unwrap();
let lint = matches.value_of("lint"); let lint = matches.value_of("lint");
serve::run(port, lint); serve::run(port, lint);
}, },
("lint", Some(matches)) => { Some(("lint", matches)) => {
let path = matches.value_of("path").unwrap(); let path = matches.value_of("path").unwrap();
let args = matches.values_of("args").into_iter().flatten(); let args = matches.values_of("args").into_iter().flatten();
lint::run(path, args); lint::run(path, args);
}, },
("rename_lint", Some(matches)) => { Some(("rename_lint", matches)) => {
let old_name = matches.value_of("old_name").unwrap(); let old_name = matches.value_of("old_name").unwrap();
let new_name = matches.value_of("new_name").unwrap_or(old_name); let new_name = matches.value_of("new_name").unwrap_or(old_name);
let uplift = matches.is_present("uplift"); let uplift = matches.is_present("uplift");
@ -89,35 +89,24 @@ fn main() {
} }
} }
fn get_clap_config<'a>() -> ArgMatches<'a> { fn get_clap_config() -> ArgMatches {
App::new("Clippy developer tooling") Command::new("Clippy developer tooling")
.setting(AppSettings::ArgRequiredElseHelp) .arg_required_else_help(true)
.subcommand( .subcommand(
SubCommand::with_name("bless") Command::new("bless").about("bless the test output changes").arg(
.about("bless the test output changes") Arg::new("ignore-timestamp")
.arg(
Arg::with_name("ignore-timestamp")
.long("ignore-timestamp") .long("ignore-timestamp")
.help("Include files updated before clippy was built"), .help("Include files updated before clippy was built"),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("fmt") Command::new("fmt")
.about("Run rustfmt on all projects and tests") .about("Run rustfmt on all projects and tests")
.arg( .arg(Arg::new("check").long("check").help("Use the rustfmt --check option"))
Arg::with_name("check") .arg(Arg::new("verbose").short('v').long("verbose").help("Echo commands run")),
.long("check")
.help("Use the rustfmt --check option"),
)
.arg(
Arg::with_name("verbose")
.short("v")
.long("verbose")
.help("Echo commands run"),
),
) )
.subcommand( .subcommand(
SubCommand::with_name("update_lints") Command::new("update_lints")
.about("Updates lint registration and information from the source code") .about("Updates lint registration and information from the source code")
.long_about( .long_about(
"Makes sure that:\n \ "Makes sure that:\n \
@ -127,23 +116,23 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
* lint modules in `clippy_lints/*` are visible in `src/lib.rs` via `pub mod`\n \ * lint modules in `clippy_lints/*` are visible in `src/lib.rs` via `pub mod`\n \
* all lints are registered in the lint store", * all lints are registered in the lint store",
) )
.arg(Arg::with_name("print-only").long("print-only").help( .arg(Arg::new("print-only").long("print-only").help(
"Print a table of lints to STDOUT. \ "Print a table of lints to STDOUT. \
This does not include deprecated and internal lints. \ This does not include deprecated and internal lints. \
(Does not modify any files)", (Does not modify any files)",
)) ))
.arg( .arg(
Arg::with_name("check") Arg::new("check")
.long("check") .long("check")
.help("Checks that `cargo dev update_lints` has been run. Used on CI."), .help("Checks that `cargo dev update_lints` has been run. Used on CI."),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("new_lint") Command::new("new_lint")
.about("Create new lint and run `cargo dev update_lints`") .about("Create new lint and run `cargo dev update_lints`")
.arg( .arg(
Arg::with_name("pass") Arg::new("pass")
.short("p") .short('p')
.long("pass") .long("pass")
.help("Specify whether the lint runs during the early or late pass") .help("Specify whether the lint runs during the early or late pass")
.takes_value(true) .takes_value(true)
@ -151,16 +140,16 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
.required(true), .required(true),
) )
.arg( .arg(
Arg::with_name("name") Arg::new("name")
.short("n") .short('n')
.long("name") .long("name")
.help("Name of the new lint in snake case, ex: fn_too_long") .help("Name of the new lint in snake case, ex: fn_too_long")
.takes_value(true) .takes_value(true)
.required(true), .required(true),
) )
.arg( .arg(
Arg::with_name("category") Arg::new("category")
.short("c") .short('c')
.long("category") .long("category")
.help("What category the lint belongs to") .help("What category the lint belongs to")
.default_value("nursery") .default_value("nursery")
@ -179,29 +168,25 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
]) ])
.takes_value(true), .takes_value(true),
) )
.arg( .arg(Arg::new("msrv").long("msrv").help("Add MSRV config code to the lint")),
Arg::with_name("msrv")
.long("msrv")
.help("Add MSRV config code to the lint"),
),
) )
.subcommand( .subcommand(
SubCommand::with_name("setup") Command::new("setup")
.about("Support for setting up your personal development environment") .about("Support for setting up your personal development environment")
.setting(AppSettings::ArgRequiredElseHelp) .arg_required_else_help(true)
.subcommand( .subcommand(
SubCommand::with_name("intellij") Command::new("intellij")
.about("Alter dependencies so Intellij Rust can find rustc internals") .about("Alter dependencies so Intellij Rust can find rustc internals")
.arg( .arg(
Arg::with_name("remove") Arg::new("remove")
.long("remove") .long("remove")
.help("Remove the dependencies added with 'cargo dev setup intellij'") .help("Remove the dependencies added with 'cargo dev setup intellij'")
.required(false), .required(false),
) )
.arg( .arg(
Arg::with_name("rustc-repo-path") Arg::new("rustc-repo-path")
.long("repo-path") .long("repo-path")
.short("r") .short('r')
.help("The path to a rustc repo that will be used for setting the dependencies") .help("The path to a rustc repo that will be used for setting the dependencies")
.takes_value(true) .takes_value(true)
.value_name("path") .value_name("path")
@ -210,66 +195,65 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("git-hook") Command::new("git-hook")
.about("Add a pre-commit git hook that formats your code to make it look pretty") .about("Add a pre-commit git hook that formats your code to make it look pretty")
.arg( .arg(
Arg::with_name("remove") Arg::new("remove")
.long("remove") .long("remove")
.help("Remove the pre-commit hook added with 'cargo dev setup git-hook'") .help("Remove the pre-commit hook added with 'cargo dev setup git-hook'")
.required(false), .required(false),
) )
.arg( .arg(
Arg::with_name("force-override") Arg::new("force-override")
.long("force-override") .long("force-override")
.short("f") .short('f')
.help("Forces the override of an existing git pre-commit hook") .help("Forces the override of an existing git pre-commit hook")
.required(false), .required(false),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("vscode-tasks") Command::new("vscode-tasks")
.about("Add several tasks to vscode for formatting, validation and testing") .about("Add several tasks to vscode for formatting, validation and testing")
.arg( .arg(
Arg::with_name("remove") Arg::new("remove")
.long("remove") .long("remove")
.help("Remove the tasks added with 'cargo dev setup vscode-tasks'") .help("Remove the tasks added with 'cargo dev setup vscode-tasks'")
.required(false), .required(false),
) )
.arg( .arg(
Arg::with_name("force-override") Arg::new("force-override")
.long("force-override") .long("force-override")
.short("f") .short('f')
.help("Forces the override of existing vscode tasks") .help("Forces the override of existing vscode tasks")
.required(false), .required(false),
), ),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("remove") Command::new("remove")
.about("Support for undoing changes done by the setup command") .about("Support for undoing changes done by the setup command")
.setting(AppSettings::ArgRequiredElseHelp) .arg_required_else_help(true)
.subcommand(SubCommand::with_name("git-hook").about("Remove any existing pre-commit git hook")) .subcommand(Command::new("git-hook").about("Remove any existing pre-commit git hook"))
.subcommand(SubCommand::with_name("vscode-tasks").about("Remove any existing vscode tasks")) .subcommand(Command::new("vscode-tasks").about("Remove any existing vscode tasks"))
.subcommand( .subcommand(
SubCommand::with_name("intellij") Command::new("intellij").about("Removes rustc source paths added via `cargo dev setup intellij`"),
.about("Removes rustc source paths added via `cargo dev setup intellij`"),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("serve") Command::new("serve")
.about("Launch a local 'ALL the Clippy Lints' website in a browser") .about("Launch a local 'ALL the Clippy Lints' website in a browser")
.arg( .arg(
Arg::with_name("port") Arg::new("port")
.long("port") .long("port")
.short("p") .short('p')
.help("Local port for the http server") .help("Local port for the http server")
.default_value("8000") .default_value("8000")
.validator_os(serve::validate_port), .validator_os(serve::validate_port),
) )
.arg(Arg::with_name("lint").help("Which lint's page to load initially (optional)")), .arg(Arg::new("lint").help("Which lint's page to load initially (optional)")),
) )
.subcommand( .subcommand(
SubCommand::with_name("lint") Command::new("lint")
.about("Manually run clippy on a file or package") .about("Manually run clippy on a file or package")
.after_help(indoc! {" .after_help(indoc! {"
EXAMPLES EXAMPLES
@ -288,33 +272,33 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
cargo dev lint ~/my-project -- -- -W clippy::pedantic cargo dev lint ~/my-project -- -- -W clippy::pedantic
"}) "})
.arg( .arg(
Arg::with_name("path") Arg::new("path")
.required(true) .required(true)
.help("The path to a file or package directory to lint"), .help("The path to a file or package directory to lint"),
) )
.arg( .arg(
Arg::with_name("args") Arg::new("args")
.multiple(true) .multiple_occurrences(true)
.help("Pass extra arguments to cargo/clippy-driver"), .help("Pass extra arguments to cargo/clippy-driver"),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("rename_lint") Command::new("rename_lint")
.about("Renames the given lint") .about("Renames the given lint")
.arg( .arg(
Arg::with_name("old_name") Arg::new("old_name")
.index(1) .index(1)
.required(true) .required(true)
.help("The name of the lint to rename"), .help("The name of the lint to rename"),
) )
.arg( .arg(
Arg::with_name("new_name") Arg::new("new_name")
.index(2) .index(2)
.required_unless("uplift") .required_unless_present("uplift")
.help("The new name of the lint"), .help("The new name of the lint"),
) )
.arg( .arg(
Arg::with_name("uplift") Arg::new("uplift")
.long("uplift") .long("uplift")
.help("This lint will be uplifted into rustc"), .help("This lint will be uplifted into rustc"),
), ),

View file

@ -1,4 +1,5 @@
use std::ffi::{OsStr, OsString}; use std::ffi::OsStr;
use std::num::ParseIntError;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use std::thread; use std::thread;
@ -59,9 +60,6 @@ fn mtime(path: impl AsRef<Path>) -> SystemTime {
} }
#[allow(clippy::missing_errors_doc)] #[allow(clippy::missing_errors_doc)]
pub fn validate_port(arg: &OsStr) -> Result<(), OsString> { pub fn validate_port(arg: &OsStr) -> Result<(), ParseIntError> {
match arg.to_string_lossy().parse::<u16>() { arg.to_string_lossy().parse::<u16>().map(|_| ())
Ok(_port) => Ok(()),
Err(err) => Err(OsString::from(err.to_string())),
}
} }

View file

@ -11,7 +11,7 @@ publish = false
[dependencies] [dependencies]
cargo_metadata = "0.14" cargo_metadata = "0.14"
clap = "2.33" clap = "3.1"
flate2 = "1.0" flate2 = "1.0"
rayon = "1.5.1" rayon = "1.5.1"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -1,47 +1,47 @@
use clap::{App, Arg, ArgMatches}; use clap::{Arg, ArgMatches, Command};
use std::env; use std::env;
use std::path::PathBuf; use std::path::PathBuf;
fn get_clap_config<'a>() -> ArgMatches<'a> { fn get_clap_config() -> ArgMatches {
App::new("lintcheck") Command::new("lintcheck")
.about("run clippy on a set of crates and check output") .about("run clippy on a set of crates and check output")
.arg( .arg(
Arg::with_name("only") Arg::new("only")
.takes_value(true) .takes_value(true)
.value_name("CRATE") .value_name("CRATE")
.long("only") .long("only")
.help("Only process a single crate of the list"), .help("Only process a single crate of the list"),
) )
.arg( .arg(
Arg::with_name("crates-toml") Arg::new("crates-toml")
.takes_value(true) .takes_value(true)
.value_name("CRATES-SOURCES-TOML-PATH") .value_name("CRATES-SOURCES-TOML-PATH")
.long("crates-toml") .long("crates-toml")
.help("Set the path for a crates.toml where lintcheck should read the sources from"), .help("Set the path for a crates.toml where lintcheck should read the sources from"),
) )
.arg( .arg(
Arg::with_name("threads") Arg::new("threads")
.takes_value(true) .takes_value(true)
.value_name("N") .value_name("N")
.short("j") .short('j')
.long("jobs") .long("jobs")
.help("Number of threads to use, 0 automatic choice"), .help("Number of threads to use, 0 automatic choice"),
) )
.arg( .arg(
Arg::with_name("fix") Arg::new("fix")
.long("--fix") .long("--fix")
.help("Runs cargo clippy --fix and checks if all suggestions apply"), .help("Runs cargo clippy --fix and checks if all suggestions apply"),
) )
.arg( .arg(
Arg::with_name("filter") Arg::new("filter")
.long("--filter") .long("--filter")
.takes_value(true) .takes_value(true)
.multiple(true) .multiple_occurrences(true)
.value_name("clippy_lint_name") .value_name("clippy_lint_name")
.help("Apply a filter to only collect specified lints, this also overrides `allow` attributes"), .help("Apply a filter to only collect specified lints, this also overrides `allow` attributes"),
) )
.arg( .arg(
Arg::with_name("markdown") Arg::new("markdown")
.long("--markdown") .long("--markdown")
.help("Change the reports table to use markdown links"), .help("Change the reports table to use markdown links"),
) )