Deprecate util/dev in favor of cargo alias

If you've been using `./util/dev` before, this now becomes `cargo dev`.

The key part of this change is found in `.cargo/config`.

This means one less shell script and a bit more cross-platform support
for contributors.
This commit is contained in:
Philipp Hansch
2020-01-30 08:33:48 +01:00
parent f69835bab7
commit 4d1a11d354
11 changed files with 41 additions and 28 deletions

View File

@@ -2,6 +2,7 @@
use clap::{App, Arg, SubCommand};
use clippy_dev::*;
use std::path::Path;
mod fmt;
mod new_lint;
@@ -49,12 +50,12 @@ fn main() {
.arg(
Arg::with_name("check")
.long("check")
.help("Checks that util/dev update_lints has been run. Used on CI."),
.help("Checks that `cargo dev update_lints` has been run. Used on CI."),
),
)
.subcommand(
SubCommand::with_name("new_lint")
.about("Create new lint and run util/dev update_lints")
.about("Create new lint and run `cargo dev update_lints`")
.arg(
Arg::with_name("pass")
.short("p")
@@ -170,7 +171,7 @@ fn update_lints(update_mode: &UpdateMode) {
sorted_usable_lints.sort_by_key(|lint| lint.name.clone());
let mut file_change = replace_region_in_file(
"../src/lintlist/mod.rs",
Path::new("src/lintlist/mod.rs"),
"begin lint list",
"end lint list",
false,
@@ -189,7 +190,7 @@ fn update_lints(update_mode: &UpdateMode) {
.changed;
file_change |= replace_region_in_file(
"../README.md",
Path::new("README.md"),
r#"\[There are \d+ lints included in this crate!\]\(https://rust-lang.github.io/rust-clippy/master/index.html\)"#,
"",
true,
@@ -202,7 +203,7 @@ fn update_lints(update_mode: &UpdateMode) {
).changed;
file_change |= replace_region_in_file(
"../CHANGELOG.md",
Path::new("CHANGELOG.md"),
"<!-- begin autogenerated links to lint list -->",
"<!-- end autogenerated links to lint list -->",
false,
@@ -212,7 +213,7 @@ fn update_lints(update_mode: &UpdateMode) {
.changed;
file_change |= replace_region_in_file(
"../clippy_lints/src/lib.rs",
Path::new("clippy_lints/src/lib.rs"),
"begin deprecated lints",
"end deprecated lints",
false,
@@ -222,7 +223,7 @@ fn update_lints(update_mode: &UpdateMode) {
.changed;
file_change |= replace_region_in_file(
"../clippy_lints/src/lib.rs",
Path::new("clippy_lints/src/lib.rs"),
"begin register lints",
"end register lints",
false,
@@ -232,7 +233,7 @@ fn update_lints(update_mode: &UpdateMode) {
.changed;
file_change |= replace_region_in_file(
"../clippy_lints/src/lib.rs",
Path::new("clippy_lints/src/lib.rs"),
"begin lints modules",
"end lints modules",
false,
@@ -243,7 +244,7 @@ fn update_lints(update_mode: &UpdateMode) {
// Generate lists of lints in the clippy::all lint group
file_change |= replace_region_in_file(
"../clippy_lints/src/lib.rs",
Path::new("clippy_lints/src/lib.rs"),
r#"store.register_group\(true, "clippy::all""#,
r#"\]\);"#,
false,
@@ -266,7 +267,7 @@ fn update_lints(update_mode: &UpdateMode) {
// Generate the list of lints for all other lint groups
for (lint_group, lints) in Lint::by_lint_group(&usable_lints) {
file_change |= replace_region_in_file(
"../clippy_lints/src/lib.rs",
Path::new("clippy_lints/src/lib.rs"),
&format!("store.register_group\\(true, \"clippy::{}\"", lint_group),
r#"\]\);"#,
false,
@@ -279,7 +280,7 @@ fn update_lints(update_mode: &UpdateMode) {
if update_mode == &UpdateMode::Check && file_change {
println!(
"Not all lints defined properly. \
Please run `util/dev update_lints` to make sure all lints are defined properly."
Please run `cargo dev update_lints` to make sure all lints are defined properly."
);
std::process::exit(1);
}