Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Clippy #97730

Merged
merged 126 commits into from
Jun 6, 2022
Merged
Changes from 2 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
cb29e3e
add doc_link_with_quotes lint
cameron1024 Feb 1, 2022
ee8fae3
identity_op: add parenthesis to suggestions where required
Alexendoo May 4, 2022
5ad1b35
Update clippy to new rake_read signature
eholk May 10, 2022
569505c
Auto-detect preferred colorscheme
Serial-ATA May 19, 2022
8d04a32
Auto merge of #96923 - eholk:fix-fake-read, r=nikomatsakis
bors May 21, 2022
4587b66
Merge 'rust-clippy/master' into clippyup
xFrednet May 21, 2022
fc965c7
Fix lint registration
xFrednet May 21, 2022
91644d1
Auto merge of #8848 - Serial-ATA:auto-detect-theme, r=xFrednet
bors May 21, 2022
cbe6607
Remove feature: `crate` visibility modifier
jhpratt May 21, 2022
8558490
get_last_with_len: lint VecDeque and any deref to slice
Alexendoo May 20, 2022
a319937
Merge crate and restricted visibilities
jhpratt May 21, 2022
e885157
factor out the rvalue lifetime rule
dingxiangfei2009 Apr 1, 2022
5cf07c6
Set correct `ParamEnv` for `derive_partial_eq_without_eq`
Jarcho May 22, 2022
0fd03a8
Strip `clippy::` prefix from search strings
Serial-ATA May 22, 2022
8ec9e5e
Fix clippy explicit_write lint for new writeln implementation
dtolnay May 23, 2022
77d2b10
Rollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillot
Dylan-DPC May 23, 2022
9b55ea7
update dependencies
hellow554 May 23, 2022
a342f52
cast_abs_to_unsigned: do not remove cast if it's required
Alexendoo May 23, 2022
0ad3a0a
Lifetime variance fixes for clippy
compiler-errors May 23, 2022
3642e33
Auto merge of #8870 - Serial-ATA:issue-8865, r=xFrednet
bors May 23, 2022
0684d62
Refactor call terminator to always hold a destination place
JakobDegen Apr 16, 2022
1f3116f
Rollup merge of #97289 - compiler-errors:tcxify-clippy, r=Mark-Simula…
JohnTitor May 24, 2022
050cdd6
Auto merge of #8872 - hellow554:dependency_update, r=llogiq
bors May 24, 2022
286b717
Auto merge of #96098 - JakobDegen:always-return-place, r=oli-obk
bors May 24, 2022
ea62347
New lint `no_effect_replace`
guerinoni Apr 25, 2022
22673bc
add testcase for #8878
hellow554 May 24, 2022
04297de
prepare test for 8734
hellow554 May 24, 2022
21d9493
Fix imports for "Checking if a type defines a specific method"
May 24, 2022
78f7e37
Fix `manual_range_contains` with equal precedence
May 24, 2022
fbb9e56
Auto merge of #8754 - guerinoni:no_effect_replace, r=llogiq
bors May 24, 2022
6269ab1
Auto merge of #8881 - dmarcoux:update-outdated-doc, r=llogiq
bors May 24, 2022
257f097
Fix issue with mismatched parens in suggestion
May 24, 2022
c41c410
Auto merge of #8786 - Alexendoo:identity-op-suggestions, r=dswij,xFre…
bors May 24, 2022
67a0891
Auto merge of #8880 - hellow554:rustfix_update, r=Manishearth
bors May 24, 2022
b97784f
Auto merge of #8862 - Alexendoo:get-last-with-len, r=Jarcho,xFrednet
bors May 24, 2022
1dd0266
feat(lint): impl lint about use first() instead of get(0)
kyoto7250 May 24, 2022
b531eb1
suggest first() instead of get(0)
kyoto7250 May 24, 2022
e47c5b0
ignore clippy::get_first
kyoto7250 May 24, 2022
d0f93c1
refactor: get the required variables with MethodCall
kyoto7250 May 25, 2022
3cc50a4
Auto merge of #8882 - kyoto7250:get_first, r=llogiq
bors May 25, 2022
d8a281e
Added an unused_rounding lint
botahamec May 21, 2022
4de301e
Fixed the test to not use an epsilon
botahamec May 22, 2022
f489954
Changed the lint description
botahamec May 22, 2022
2f25078
try to cache region_scope_tree as a query
dingxiangfei2009 May 25, 2022
45be175
Collect renamed lints
Serial-ATA May 19, 2022
1c573c7
Remove newlines in [`match_str_case_mismatch`] example
Serial-ATA May 25, 2022
45785fe
Auto merge of #8889 - Serial-ATA:remove-newlines, r=xFrednet
bors May 25, 2022
9ee211a
Fix `empty_line_after_outer_attribute` false positive
smoelius May 25, 2022
bc4d39e
Auto merge of #8866 - botahamec:unused-rounding, r=llogiq
bors May 26, 2022
17f7047
Only return DefIds to Fn-like definitions in clippy_utils::fn_def_id
Alexendoo May 26, 2022
ea06a41
fix
tamaroning May 26, 2022
6553b98
Auto merge of #8896 - Alexendoo:fn_sig_ice, r=llogiq
bors May 26, 2022
fc28f6a
Support `Weak` in [`rc_clone_in_vec_init`]
Serial-ATA May 25, 2022
a5ece81
Auto merge of #8885 - Serial-ATA:rc-clone-in-vec-init-weak, r=llogiq
bors May 27, 2022
e33d87d
When setting suggestion, add suggestion for MoveAndClone for non-ref
PrestonFrom May 24, 2022
911eb1f
Check `.fixed` paths' existence in `run_ui`
smoelius May 19, 2022
c91a7f0
Address review comments
smoelius May 24, 2022
8f49e41
Fix `assert!` message
smoelius May 25, 2022
461a661
Auto merge of #8897 - tamaroning:improve_dbg, r=Alexendoo
bors May 27, 2022
1dd5547
Auto merge of #8892 - smoelius:fix-empty-line-false-positive, r=Manis…
bors May 27, 2022
6027255
Ignore `crashes` dir
smoelius May 27, 2022
4fc0ee6
[1/N] Implement Arithmetic lint
c410-f3r May 27, 2022
19f94d5
remove `large_enum_variant` suggestion for `Copy` types
llogiq May 27, 2022
c9be57d
Merge branch 'master' into doc_link_with_quotes
llogiq May 28, 2022
5920fa3
Auto merge of #8844 - smoelius:fixed-paths, r=Alexendoo
bors May 28, 2022
cfd0f55
Make docs more consistent
Serial-ATA May 28, 2022
adafb6c
Update lint creation docs
Serial-ATA May 28, 2022
39231b4
Auto merge of #8385 - cameron1024:doc_link_with_quotes, r=llogiq
bors May 28, 2022
722f7d2
needless_late_init: fix ICE when all branches return the never type
Alexendoo May 29, 2022
c541015
needless_deref
lengyijun May 29, 2022
8430fa2
run-rustfix
lengyijun May 30, 2022
2aa4569
Triggered the lint on tuple struct and struct patterns
botahamec May 26, 2022
0a7f19b
Fix #8748
b-NC May 29, 2022
d9f4978
Auto merge of #8899 - botahamec:use-self-tuple-struct-variants, r=Ale…
bors May 30, 2022
4e45960
Add a pointer to address cast kind
tmiasko May 31, 2022
588e198
Auto merge of #8913 - InfRandomness:ICE-#8748, r=giraffate
bors May 31, 2022
e1607e9
Auto merge of #8912 - Alexendoo:needless-late-init-ice, r=giraffate
bors May 31, 2022
eb2908b
Add lint `almost_complete_letter_range`
Jarcho May 31, 2022
2466a05
Auto merge of #8918 - Jarcho:almost_complete_letter_range, r=llogiq
bors May 31, 2022
9c9cca3
Don't lint `useless_transmute` on types with erased regions
Jarcho Mar 18, 2022
0c6ebf1
Move `useless_transmute` back to `complexity`
Jarcho Mar 18, 2022
9add456
Auto merge of #8876 - Alexendoo:cast-abs-to-different-uint, r=dswij,x…
bors May 31, 2022
7000e75
Auto merge of #8564 - Jarcho:transmute_erase_regions, r=Alexendoo
bors May 31, 2022
5b1a4c0
Auto merge of #8884 - evantypanski:manual_range_contains_multiple, r=…
bors May 31, 2022
ca78e24
Add lint `swap_ptr_to_ref`
Jarcho May 30, 2022
f0bf200
Auto merge of #8916 - Jarcho:swap_ptr_to_ref, r=Manishearth
bors May 31, 2022
11d22ae
Lazify `SourceFile::lines`.
nnethercote May 30, 2022
202fdb9
split into borrow_deref_ref.rs and borrow_deref_ref_unfixable.rs
lengyijun Jun 1, 2022
c4c413b
Auto merge of #7930 - lengyijun:needless_deref_new, r=Jarcho
bors Jun 1, 2022
86092a7
rename PointerAddress → PointerExposeAddress
RalfJung Jun 1, 2022
7572b6b
Auto merge of #8869 - Jarcho:derive_partial_eq_without_eq, r=flip1995
bors Jun 1, 2022
b20f95c
Combine doc examples
Serial-ATA Jun 1, 2022
0d5ace3
Auto merge of #8908 - Serial-ATA:doc-comment-issues, r=xFrednet
bors Jun 2, 2022
bc5a8e9
Lint message correctly identifies match vs for loop
PrestonFrom Jun 2, 2022
756caf7
account for generics
llogiq May 31, 2022
9428e2e
Auto merge of #8905 - c410-f3r:arith, r=llogiq
bors Jun 2, 2022
b885035
`needless_return` checks for macro expr in return stmts
dswij Jun 2, 2022
678dcdd
Apply `needless_return` suggestions
dswij Jun 2, 2022
0600de4
add cast kind of from_exposed_addr (int-to-ptr casts)
RalfJung Jun 2, 2022
e32b66c
Auto merge of #8906 - rust-lang:copy-large-enum-variants, r=Jarcho
bors Jun 2, 2022
97e5449
Auto merge of #8902 - PrestonFrom:add_suggestion_for_move_and_clone_w…
bors Jun 2, 2022
2a18d12
Auto merge of #97575 - nnethercote:lazify-SourceFile-lines, r=Mark-Si…
bors Jun 2, 2022
1194c63
Auto merge of #8932 - dswij:pr-8879, r=giraffate
bors Jun 3, 2022
58cd01c
Add new lint mismatching_type_param_order
arieluy May 14, 2022
baacbfd
Rollup merge of #97653 - RalfJung:int-to-ptr, r=oli-obk
Dylan-DPC Jun 3, 2022
1e86cc5
Manipulate lifetimes by LocalDefId for region resolution.
cjgillot Apr 27, 2022
7c0d649
Auto merge of #8831 - arieluy:type_params, r=dswij
bors Jun 3, 2022
5730482
Rollup merge of #97415 - cjgillot:is-late-bound-solo, r=estebank
Dylan-DPC Jun 3, 2022
64fe4e3
add as_underscore lint
DevAccentor Jun 3, 2022
81e4450
Merge `CollapsibleMatch` into `Matches` lint pass
Jarcho Jun 3, 2022
ebd357e
Auto merge of #8934 - DevAccentor:as_underscore, r=Manishearth
bors Jun 3, 2022
b337f9e
Merge `ManualUnwrapOr` into `Matches` lint pass
Jarcho Jun 3, 2022
3d8d734
Move `MatchOnVecItems` into `Matches` lint pass
Jarcho Jun 3, 2022
8c8a52e
Move `MatchStrCaseMismatch` into `Matches` lint pass
Jarcho Jun 3, 2022
dbc7753
Merge `SignificantDropInScrutinee` into `Matches` lint pass
Jarcho Jun 3, 2022
67cb5ec
Move `TryErr` into `Matches` lint pass
Jarcho Jun 3, 2022
68c411f
Move `ManualMap` into `Matches` lint pass
Jarcho Jun 3, 2022
b1a3e7e
Auto merge of #8937 - Jarcho:merge_match_passes, r=llogiq
bors Jun 4, 2022
8ef4908
Auto merge of #8843 - Serial-ATA:collect-renamed, r=xFrednet
bors Jun 4, 2022
7f402b1
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jun 4, 2022
36b1892
Bump nightly version -> 2022-06-04
flip1995 Jun 4, 2022
d9ddce8
Auto merge of #8942 - flip1995:rustup, r=flip1995
bors Jun 4, 2022
d55c373
Merge commit 'd9ddce8a223cb9916389c039777b6966ea448dc8' into clippyup
flip1995 Jun 4, 2022
c22d4e6
Remove unnecessary clap_derive dependency added in 9ee211af
flip1995 Jun 4, 2022
586cbd0
Update Cargo.lock
flip1995 Jun 4, 2022
9525e0c
Add winnt feature to winapi in rustc-workspace-hack
flip1995 Jun 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ tempfile = { version = "3.2", optional = true }
termize = "0.1"

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

2 changes: 1 addition & 1 deletion clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
aho-corasick = "0.7"
clap = "2.33"
clap = "3.1"
indoc = "1.0"
itertools = "0.10.1"
opener = "0.5"
156 changes: 70 additions & 86 deletions clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
@@ -2,20 +2,20 @@
// warn on lints, that are included in `rust-lang/rust`s bootstrap
#![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 indoc::indoc;
fn main() {
let matches = get_clap_config();

match matches.subcommand() {
("bless", Some(matches)) => {
Some(("bless", matches)) => {
bless::bless(matches.is_present("ignore-timestamp"));
},
("fmt", Some(matches)) => {
Some(("fmt", matches)) => {
fmt::run(matches.is_present("check"), matches.is_present("verbose"));
},
("update_lints", Some(matches)) => {
Some(("update_lints", matches)) => {
if matches.is_present("print-only") {
update_lints::print_lints();
} else if matches.is_present("check") {
@@ -24,7 +24,7 @@ fn main() {
update_lints::update(update_lints::UpdateMode::Change);
}
},
("new_lint", Some(matches)) => {
Some(("new_lint", matches)) => {
match new_lint::create(
matches.value_of("pass"),
matches.value_of("name"),
@@ -35,8 +35,8 @@ fn main() {
Err(e) => eprintln!("Unable to create lint: {}", e),
}
},
("setup", Some(sub_command)) => match sub_command.subcommand() {
("intellij", Some(matches)) => {
Some(("setup", sub_command)) => match sub_command.subcommand() {
Some(("intellij", matches)) => {
if matches.is_present("remove") {
setup::intellij::remove_rustc_src();
} else {
@@ -47,14 +47,14 @@ fn main() {
);
}
},
("git-hook", Some(matches)) => {
Some(("git-hook", matches)) => {
if matches.is_present("remove") {
setup::git_hook::remove_hook();
} else {
setup::git_hook::install_hook(matches.is_present("force-override"));
}
},
("vscode-tasks", Some(matches)) => {
Some(("vscode-tasks", matches)) => {
if matches.is_present("remove") {
setup::vscode::remove_tasks();
} else {
@@ -63,23 +63,23 @@ fn main() {
},
_ => {},
},
("remove", Some(sub_command)) => match sub_command.subcommand() {
("git-hook", Some(_)) => setup::git_hook::remove_hook(),
("intellij", Some(_)) => setup::intellij::remove_rustc_src(),
("vscode-tasks", Some(_)) => setup::vscode::remove_tasks(),
Some(("remove", sub_command)) => match sub_command.subcommand() {
Some(("git-hook", _)) => setup::git_hook::remove_hook(),
Some(("intellij", _)) => setup::intellij::remove_rustc_src(),
Some(("vscode-tasks", _)) => setup::vscode::remove_tasks(),
_ => {},
},
("serve", Some(matches)) => {
Some(("serve", matches)) => {
let port = matches.value_of("port").unwrap().parse().unwrap();
let lint = matches.value_of("lint");
serve::run(port, lint);
},
("lint", Some(matches)) => {
Some(("lint", matches)) => {
let path = matches.value_of("path").unwrap();
let args = matches.values_of("args").into_iter().flatten();
lint::run(path, args);
},
("rename_lint", Some(matches)) => {
Some(("rename_lint", matches)) => {
let old_name = matches.value_of("old_name").unwrap();
let new_name = matches.value_of("new_name").unwrap_or(old_name);
let uplift = matches.is_present("uplift");
@@ -89,35 +89,24 @@ fn main() {
}
}

fn get_clap_config<'a>() -> ArgMatches<'a> {
App::new("Clippy developer tooling")
.setting(AppSettings::ArgRequiredElseHelp)
fn get_clap_config() -> ArgMatches {
Command::new("Clippy developer tooling")
.arg_required_else_help(true)
.subcommand(
SubCommand::with_name("bless")
.about("bless the test output changes")
.arg(
Arg::with_name("ignore-timestamp")
.long("ignore-timestamp")
.help("Include files updated before clippy was built"),
),
Command::new("bless").about("bless the test output changes").arg(
Arg::new("ignore-timestamp")
.long("ignore-timestamp")
.help("Include files updated before clippy was built"),
),
)
.subcommand(
SubCommand::with_name("fmt")
Command::new("fmt")
.about("Run rustfmt on all projects and tests")
.arg(
Arg::with_name("check")
.long("check")
.help("Use the rustfmt --check option"),
)
.arg(
Arg::with_name("verbose")
.short("v")
.long("verbose")
.help("Echo commands run"),
),
.arg(Arg::new("check").long("check").help("Use the rustfmt --check option"))
.arg(Arg::new("verbose").short('v').long("verbose").help("Echo commands run")),
)
.subcommand(
SubCommand::with_name("update_lints")
Command::new("update_lints")
.about("Updates lint registration and information from the source code")
.long_about(
"Makes sure that:\n \
@@ -127,40 +116,40 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
* lint modules in `clippy_lints/*` are visible in `src/lib.rs` via `pub mod`\n \
* 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. \
This does not include deprecated and internal lints. \
(Does not modify any files)",
))
.arg(
Arg::with_name("check")
Arg::new("check")
.long("check")
.help("Checks that `cargo dev update_lints` has been run. Used on CI."),
),
)
.subcommand(
SubCommand::with_name("new_lint")
Command::new("new_lint")
.about("Create new lint and run `cargo dev update_lints`")
.arg(
Arg::with_name("pass")
.short("p")
Arg::new("pass")
.short('p')
.long("pass")
.help("Specify whether the lint runs during the early or late pass")
.takes_value(true)
.possible_values(&["early", "late"])
.required(true),
)
.arg(
Arg::with_name("name")
.short("n")
Arg::new("name")
.short('n')
.long("name")
.help("Name of the new lint in snake case, ex: fn_too_long")
.takes_value(true)
.required(true),
)
.arg(
Arg::with_name("category")
.short("c")
Arg::new("category")
.short('c')
.long("category")
.help("What category the lint belongs to")
.default_value("nursery")
@@ -179,29 +168,25 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
])
.takes_value(true),
)
.arg(
Arg::with_name("msrv")
.long("msrv")
.help("Add MSRV config code to the lint"),
),
.arg(Arg::new("msrv").long("msrv").help("Add MSRV config code to the lint")),
)
.subcommand(
SubCommand::with_name("setup")
Command::new("setup")
.about("Support for setting up your personal development environment")
.setting(AppSettings::ArgRequiredElseHelp)
.arg_required_else_help(true)
.subcommand(
SubCommand::with_name("intellij")
Command::new("intellij")
.about("Alter dependencies so Intellij Rust can find rustc internals")
.arg(
Arg::with_name("remove")
Arg::new("remove")
.long("remove")
.help("Remove the dependencies added with 'cargo dev setup intellij'")
.required(false),
)
.arg(
Arg::with_name("rustc-repo-path")
Arg::new("rustc-repo-path")
.long("repo-path")
.short("r")
.short('r')
.help("The path to a rustc repo that will be used for setting the dependencies")
.takes_value(true)
.value_name("path")
@@ -210,66 +195,65 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
),
)
.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")
.arg(
Arg::with_name("remove")
Arg::new("remove")
.long("remove")
.help("Remove the pre-commit hook added with 'cargo dev setup git-hook'")
.required(false),
)
.arg(
Arg::with_name("force-override")
Arg::new("force-override")
.long("force-override")
.short("f")
.short('f')
.help("Forces the override of an existing git pre-commit hook")
.required(false),
),
)
.subcommand(
SubCommand::with_name("vscode-tasks")
Command::new("vscode-tasks")
.about("Add several tasks to vscode for formatting, validation and testing")
.arg(
Arg::with_name("remove")
Arg::new("remove")
.long("remove")
.help("Remove the tasks added with 'cargo dev setup vscode-tasks'")
.required(false),
)
.arg(
Arg::with_name("force-override")
Arg::new("force-override")
.long("force-override")
.short("f")
.short('f')
.help("Forces the override of existing vscode tasks")
.required(false),
),
),
)
.subcommand(
SubCommand::with_name("remove")
Command::new("remove")
.about("Support for undoing changes done by the setup command")
.setting(AppSettings::ArgRequiredElseHelp)
.subcommand(SubCommand::with_name("git-hook").about("Remove any existing pre-commit git hook"))
.subcommand(SubCommand::with_name("vscode-tasks").about("Remove any existing vscode tasks"))
.arg_required_else_help(true)
.subcommand(Command::new("git-hook").about("Remove any existing pre-commit git hook"))
.subcommand(Command::new("vscode-tasks").about("Remove any existing vscode tasks"))
.subcommand(
SubCommand::with_name("intellij")
.about("Removes rustc source paths added via `cargo dev setup intellij`"),
Command::new("intellij").about("Removes rustc source paths added via `cargo dev setup intellij`"),
),
)
.subcommand(
SubCommand::with_name("serve")
Command::new("serve")
.about("Launch a local 'ALL the Clippy Lints' website in a browser")
.arg(
Arg::with_name("port")
Arg::new("port")
.long("port")
.short("p")
.short('p')
.help("Local port for the http server")
.default_value("8000")
.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::with_name("lint")
Command::new("lint")
.about("Manually run clippy on a file or package")
.after_help(indoc! {"
EXAMPLES
@@ -288,33 +272,33 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
cargo dev lint ~/my-project -- -- -W clippy::pedantic
"})
.arg(
Arg::with_name("path")
Arg::new("path")
.required(true)
.help("The path to a file or package directory to lint"),
)
.arg(
Arg::with_name("args")
.multiple(true)
Arg::new("args")
.multiple_occurrences(true)
.help("Pass extra arguments to cargo/clippy-driver"),
),
)
.subcommand(
SubCommand::with_name("rename_lint")
Command::new("rename_lint")
.about("Renames the given lint")
.arg(
Arg::with_name("old_name")
Arg::new("old_name")
.index(1)
.required(true)
.help("The name of the lint to rename"),
)
.arg(
Arg::with_name("new_name")
Arg::new("new_name")
.index(2)
.required_unless("uplift")
.required_unless_present("uplift")
.help("The new name of the lint"),
)
.arg(
Arg::with_name("uplift")
Arg::new("uplift")
.long("uplift")
.help("This lint will be uplifted into rustc"),
),
10 changes: 4 additions & 6 deletions clippy_dev/src/serve.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::ffi::{OsStr, OsString};
use std::ffi::OsStr;
use std::num::ParseIntError;
use std::path::Path;
use std::process::Command;
use std::thread;
@@ -59,9 +60,6 @@ fn mtime(path: impl AsRef<Path>) -> SystemTime {
}

#[allow(clippy::missing_errors_doc)]
pub fn validate_port(arg: &OsStr) -> Result<(), OsString> {
match arg.to_string_lossy().parse::<u16>() {
Ok(_port) => Ok(()),
Err(err) => Err(OsString::from(err.to_string())),
}
pub fn validate_port(arg: &OsStr) -> Result<(), ParseIntError> {
arg.to_string_lossy().parse::<u16>().map(|_| ())
}
2 changes: 1 addition & 1 deletion lintcheck/Cargo.toml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ publish = false

[dependencies]
cargo_metadata = "0.14"
clap = "2.33"
clap = "3.1"
flate2 = "1.0"
rayon = "1.5.1"
serde = { version = "1.0", features = ["derive"] }
22 changes: 11 additions & 11 deletions lintcheck/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
use clap::{App, Arg, ArgMatches};
use clap::{Arg, ArgMatches, Command};
use std::env;
use std::path::PathBuf;

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