Skip to content

Update Clippy #83480

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

Merged
merged 140 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
9dba6a9
upper_case_acronyms: don't warn on public items
matthiaskrgr Feb 26, 2021
a672d33
Implement new lint: if_then_some_else_none
magurotuna Mar 6, 2021
f2a85cb
Set 1.50 as msrv of if_then_some_else_none
magurotuna Mar 8, 2021
0327c2e
Output help instead of suggestion in `if_then_some_else_none` diagnose
magurotuna Mar 8, 2021
7406c12
Deprecate items that accidentally weren't deprecated
bstrie Feb 14, 2021
2547edb
wrong_self_convention: fix lint in case of `to_*_mut` method
mgacek8 Mar 12, 2021
11d2af7
Improve suggestion and make it work for macros
magurotuna Mar 12, 2021
f2f2a00
Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup
flip1995 Mar 12, 2021
a189df1
Clippy: HACK! Fix bootstrap error
flip1995 Mar 12, 2021
93ee80a
Use sym::Iterator instead of paths::ITERATOR
Y-Nak Mar 12, 2021
6bc5fe4
inconsistent_struct_constructor: try to make message and lint descrip…
matthiaskrgr Mar 12, 2021
c86ba7f
mem_replace_with_default: recognize some std library ctors
mgacek8 Mar 1, 2021
41be515
mem_replace_with_default: use diagnostic items intead of paths
mgacek8 Mar 12, 2021
d219888
Auto merge of #6891 - Y-Nak:use-iterator-sym, r=Manishearth
bors Mar 12, 2021
65d046c
Auto merge of #6892 - matthiaskrgr:inc_struct_ctor, r=Y-Nak
bors Mar 13, 2021
6d2236f
replace span_lint with span_lint_and_sugg along with error message
iobtl Mar 13, 2021
a261bc5
Make `explicit_deref_methods` check for multiple deref calls
Jarcho Mar 2, 2021
1666e43
Remove unneeded code.
Jarcho Mar 9, 2021
704f7a8
Keep track of whether `deref` or `deref_mut` was called
Jarcho Mar 13, 2021
2713ad4
Properly lint macro arguments for `explicit_deref_methods`
Jarcho Mar 13, 2021
28759b2
Auto merge of #6865 - Jarcho:explicit_deref_methods, r=llogiq
bors Mar 13, 2021
92b9677
Auto merge of #6820 - mgacek8:issue_6562_enhance_mem_replace_with_def…
bors Mar 13, 2021
781de34
Auto merge of #6859 - magurotuna:if_then_some_else_none, r=giraffate
bors Mar 13, 2021
1054eb0
use lint_unnecessary_cast for literals, suggest `_` if not present
iobtl Mar 14, 2021
52c25e9
Auto merge of #6895 - iobtl:reformat_unnecessary_cast, r=llogiq
bors Mar 14, 2021
ecf0c76
Fix suspicious_map false positives
mathstuf Mar 26, 2020
0ab2bcd
Add fake_read() to clippy
roxelo Feb 25, 2021
f7c5742
Do not show docs link when lint doesn't start with "clippy::"
smoelius Mar 15, 2021
1d57c3e
Use `rustc_interface::interface::Config::parse_sess_created` in Clippy
Mar 15, 2021
59dba04
Improve `find_binding_init` docs
camsteffen Mar 15, 2021
0e042d2
Auto merge of #6831 - camsteffen:suspicious-map, r=Y-Nak,flip1995
bors Mar 15, 2021
7926664
Add comments with examples and tests
roxelo Feb 25, 2021
9d5daa6
Fix error after rebase
roxelo Mar 15, 2021
eb7f8d6
Move some utils to ty_utils
camsteffen Mar 13, 2021
6fc52a6
Move some utils to clippy_utils::source module
camsteffen Mar 14, 2021
09a9ea6
Update clippy tests
petrochenkov Mar 15, 2021
9cd0f50
Auto merge of #6907 - camsteffen:ty-utils, r=flip1995
bors Mar 15, 2021
0929a24
Auto merge of #6828 - mgacek8:issue_6758_enhance_wrong_self_conventio…
bors Mar 15, 2021
d7a2311
Auto merge of #6914 - camsteffen:source-utils, r=Manishearth
bors Mar 16, 2021
1c3a3e7
Don't re-export clippy_utils::diagnostics::*
camsteffen Mar 16, 2021
99ecb61
Auto merge of #6916 - camsteffen:diagnostics-util, r=Manishearth
bors Mar 16, 2021
ecbef77
Extract lints of unit_types group from types group
Y-Nak Mar 12, 2021
37bffb7
Extract utility functions to utils.rs
Y-Nak Mar 12, 2021
d17f545
Move let_unit_value to its own module
Y-Nak Mar 12, 2021
1bb2212
Move unit_cmp to its own module
Y-Nak Mar 12, 2021
6211b49
Move unit_arg to its own module
Y-Nak Mar 12, 2021
5a439f5
Remove unit_types::utils::is_unit
Y-Nak Mar 16, 2021
c701c30
Auto merge of #6889 - Y-Nak:refactor-unit-types, r=flip1995
bors Mar 16, 2021
1a206fc
Auto merge of #6915 - smoelius:docs-link, r=llogiq
bors Mar 16, 2021
35e8be7
ast/hir: Rename field-related structures
petrochenkov Mar 15, 2021
e72d283
ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`
petrochenkov Mar 16, 2021
c5b3a71
Fix FP of `manual_unwrap_or` in const fn
MysteryJump Mar 16, 2021
aa5f1f9
Fix typo
MysteryJump Mar 16, 2021
bdf2dce
Get rid of some unused dependecies
flip1995 Mar 15, 2021
5b3e61d
Auto merge of #6912 - flip1995:dep-cleanup, r=Manishearth
bors Mar 16, 2021
02ceeb5
Use in_constant instead of is_const
MysteryJump Mar 16, 2021
4450c21
Keep track of spans in format strings
Jarcho Mar 1, 2021
4c10471
More specific spans for `use_debug` lint
Jarcho Mar 1, 2021
a7fa2a6
Add suggestion to `write_literal` and `print_literal`
Jarcho Mar 1, 2021
d45873b
Remove SmallVec
Jarcho Mar 16, 2021
846d4f0
Auto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomats…
bors Mar 16, 2021
56161b2
Auto merge of #6917 - MysteryJump:fix-manual-unwrap-or-const-fn, r=gi…
bors Mar 17, 2021
5476382
Rollup merge of #83092 - petrochenkov:qspan, r=estebank
JohnTitor Mar 17, 2021
3d7a84c
CONTRIBUTING: update section explaining how to get ra to work inside …
matthiaskrgr Mar 12, 2021
a62e426
rename `cargo dev ra_setup` to `cargo dev ide_setup`
matthiaskrgr Mar 17, 2021
6546285
Rename the last ra_setup mention to ide_setup
flip1995 Mar 17, 2021
a2ee849
Auto merge of #6888 - matthiaskrgr:rip_ra_setup, r=flip1995
bors Mar 17, 2021
d695bfc
Auto merge of #6821 - Jarcho:write_literal_suggestion, r=flip1995
bors Mar 17, 2021
8af2884
Auto merge of #6805 - matthiaskrgr:uca_nopub_6803, r=flip1995
bors Mar 17, 2021
0743e84
Don't re-export clippy_utils::*
camsteffen Mar 16, 2021
565400d
Add clippy_utils::paths imports
camsteffen Mar 17, 2021
6595d55
Auto merge of #6918 - camsteffen:utils-re-export, r=flip1995
bors Mar 17, 2021
94fb2b5
move chars_cmp and chars_next_cmp to its own modules
TaKO8Ki Mar 13, 2021
058d8c8
move chars_cmp_with_unwrap, chars_last_cmp and chars_next_cmp_with_un…
TaKO8Ki Mar 13, 2021
c07c046
refactor string_extend_chars: return when obj type is not string
TaKO8Ki Mar 13, 2021
e578a53
move derefs_to_slice to methods/utils.rs
TaKO8Ki Mar 13, 2021
1bec8b6
use derefs_to_slice in methods/utils.rs
TaKO8Ki Mar 13, 2021
f0a101d
remove a needless variable
TaKO8Ki Mar 13, 2021
0c81311
extract a condition into a function.
TaKO8Ki Mar 13, 2021
b6597ee
remove unused arguments
TaKO8Ki Mar 13, 2021
f0f7871
fmt
TaKO8Ki Mar 17, 2021
4843084
use clippy_utils::ty::is_type_diagnostic_item
TaKO8Ki Mar 17, 2021
3d9b45d
move single_char_add_str to its own module
TaKO8Ki Mar 17, 2021
62490c4
extract conditions into modules
TaKO8Ki Mar 17, 2021
d380769
extract conditions for `from_iter_instead_of_collect` into its own m…
TaKO8Ki Mar 17, 2021
7a7fcc0
extract condition for into_iter_on_ref to its own module
TaKO8Ki Mar 17, 2021
4d1f2bc
extract conditions for single_char_pattern into its own module
TaKO8Ki Mar 17, 2021
27963c8
move chars_last_cmp_with_unwrap to its own module
TaKO8Ki Mar 17, 2021
602bcf3
move get_hint_if_single_char_arg to methods/utils.rs
TaKO8Ki Mar 17, 2021
0b7ab90
Improvements to `match_wildcard_for_single_variants` and `wildcard_en…
Jarcho Mar 7, 2021
6cc9cac
Add test for `#[non_exhaustive]` enum in `match_wildcard_for_single-v…
Jarcho Mar 8, 2021
0edd5f8
remove the use of paths
TaKO8Ki Mar 17, 2021
b6a2757
replace crate::methods::utils with super::utils
TaKO8Ki Mar 17, 2021
d5a7941
Fix message for `match_wildcard_for_single_variant`
Jarcho Mar 16, 2021
56138ad
Auto merge of #83188 - petrochenkov:field, r=lcnr
bors Mar 17, 2021
f468d82
Fix `manual_map` suggestion for `if let.. else ... if let.. else` chain
Jarcho Mar 5, 2021
ba13311
Auto merge of #6856 - Jarcho:manual_map_if_let, r=Manishearth
bors Mar 17, 2021
b62694b
Auto merge of #82122 - bstrie:dep4real, r=dtolnay
bors Mar 17, 2021
ea15fb2
wrong_self_convention: `to_` respects `Copy` types
mgacek8 Mar 17, 2021
2c4570c
hir: Preserve used syntax in `TyKind::TraitObject`
petrochenkov Mar 13, 2021
b1f89ee
or_fun_call: trigger on unsafe blocks
mgacek8 Mar 17, 2021
032cdfe
Adjust use_self uitest to proper self convention
mgacek8 Mar 18, 2021
4d68619
Auto merge of #6863 - Jarcho:wild_enum_match, r=llogiq
bors Mar 18, 2021
36aee1c
Auto merge of #6928 - mgacek8:issue6675_or_fun_call_unsafe_blocks, r=…
bors Mar 18, 2021
b42ec5e
needless_question_mark: don't lint if Some(..) is inside a macro def …
matthiaskrgr Mar 18, 2021
0d2e2b5
Auto merge of #6935 - matthiaskrgr:qmark_marco, r=flip1995
bors Mar 19, 2021
1f2d016
wrong_self_convention: Enhance lint message
mgacek8 Mar 18, 2021
d2f0b27
clippy: stabilize or_patterns lint
mark-i-m Nov 21, 2020
1d3c539
Auto merge of #6924 - mgacek8:issue6727_copy_types, r=llogiq
bors Mar 20, 2021
296751f
Fix bad suggestion for generics in `new_without_default` lint
ThibsG Mar 20, 2021
00a2d7a
Fix bad suggestion that needs curly braces for `match_single_binding`…
ThibsG Mar 20, 2021
7d45d8a
Split `match_single_binding` tests in 2 files (too many lines for CI)
ThibsG Mar 20, 2021
731c98b
update `const_eval_resolve`
lcnr Mar 13, 2021
478f258
Auto merge of #6939 - ThibsG:suggNewWithoutDefault, r=llogiq
bors Mar 20, 2021
0bdaa77
Auto merge of #6941 - ThibsG:suggMatchSingleBinding, r=llogiq
bors Mar 20, 2021
3ddaabc
Fix suggestion with generics for `field_reassign_with_default` lint
ThibsG Mar 21, 2021
f3de78e
Auto merge of #6945 - ThibsG:BadSuggestionGenericsForReassignDefault,…
bors Mar 21, 2021
2ffee89
search_is_some: check also when search is none
mgacek8 Mar 20, 2021
aca95aa
Auto merge of #6942 - mgacek8:issue_6815_search_is_none, r=llogiq
bors Mar 22, 2021
45e7756
Ignore str::len() in or_fun_call lint.
Sciencentistguy Mar 22, 2021
029777f
Auto merge of #6896 - TaKO8Ki:refactor-lints-in-methods-module, r=pha…
bors Mar 22, 2021
2bc180e
Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis
bors Mar 22, 2021
b80903b
Auto merge of #6950 - Sciencentistguy:master, r=phansch
bors Mar 22, 2021
9132dbd
Factor out eq_ty_kind
camsteffen Mar 23, 2021
919a1a4
Auto merge of #6957 - camsteffen:eq-ty-kind, r=flip1995
bors Mar 23, 2021
e06731b
Add has_default to GenericParamDefKind::Const
JulianKnodt Aug 11, 2020
3b8e85a
fix false positive in manual_flatten
TaKO8Ki Mar 24, 2021
2f8d71b
merge imports
TaKO8Ki Mar 24, 2021
917b538
Auto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r…
bors Mar 24, 2021
99b8a67
Fix false positive with `new_ret_no_self` when returning `Self` with …
Jarcho Mar 23, 2021
6e88900
Rename `contains_adt` to `contains_adt_constructor`
Jarcho Mar 24, 2021
4a1825a
Auto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth
bors Mar 24, 2021
e9ebc27
check for `.to_string().into_bytes()` in string_lit_to_bytes
ebobrow Mar 24, 2021
981ffa7
Auto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen
bors Mar 25, 2021
1f5f184
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Mar 25, 2021
06940fd
Bump nightly version -> 2021-03-25
flip1995 Mar 25, 2021
40e68e5
Bump Clippy Version -> 0.1.53
flip1995 Mar 25, 2021
0e87918
Auto merge of #6971 - flip1995:rustup, r=flip1995
bors Mar 25, 2021
ab72b5e
Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup
flip1995 Mar 25, 2021
0f1ff45
Update Cargo.lock
flip1995 Mar 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 5 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -557,18 +557,20 @@ dependencies = [

[[package]]
name = "clippy"
version = "0.1.52"
version = "0.1.53"
dependencies = [
"cargo_metadata 0.12.0",
"clippy-mini-macro-test",
"clippy_lints",
"compiletest_rs 0.6.0",
"derive-new",
"quote",
"regex",
"rustc-workspace-hack",
"rustc_tools_util 0.2.0",
"semver 0.11.0",
"serde",
"syn",
"tempfile",
"tester 0.9.0",
]
Expand All @@ -579,37 +581,32 @@ version = "0.2.0"

[[package]]
name = "clippy_lints"
version = "0.1.52"
version = "0.1.53"
dependencies = [
"cargo_metadata 0.12.0",
"clippy_utils",
"if_chain",
"itertools 0.9.0",
"pulldown-cmark 0.8.0",
"quine-mc_cluskey",
"quote",
"regex-syntax",
"rustc-semver",
"semver 0.11.0",
"serde",
"smallvec 1.6.1",
"syn",
"toml",
"unicode-normalization",
"url 2.1.1",
]

[[package]]
name = "clippy_utils"
version = "0.1.52"
version = "0.1.53"
dependencies = [
"if_chain",
"itertools 0.9.0",
"regex-syntax",
"rustc-semver",
"serde",
"smallvec 1.6.1",
"toml",
"unicode-normalization",
]

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2103,6 +2103,7 @@ Released 2018-09-13
[`if_let_some_result`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_let_some_result
[`if_not_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
[`if_same_then_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
[`if_then_some_else_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_then_some_else_none
[`ifs_same_cond`]: https://rust-lang.github.io/rust-clippy/master/index.html#ifs_same_cond
[`implicit_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
[`implicit_hasher`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_hasher
Expand Down
36 changes: 29 additions & 7 deletions src/tools/clippy/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ All contributors are expected to follow the [Rust Code of Conduct].
- [Finding something to fix/improve](#finding-something-to-fiximprove)
- [Writing code](#writing-code)
- [Getting code-completion for rustc internals to work](#getting-code-completion-for-rustc-internals-to-work)
- [IntelliJ Rust](#intellij-rust)
- [Rust Analyzer](#rust-analyzer)
- [How Clippy works](#how-clippy-works)
- [Syncing changes between Clippy and `rust-lang/rust`](#syncing-changes-between-clippy-and-rust-langrust)
- [Syncing changes between Clippy and [`rust-lang/rust`]](#syncing-changes-between-clippy-and-rust-langrust)
- [Patching git-subtree to work with big repos](#patching-git-subtree-to-work-with-big-repos)
- [Performing the sync from `rust-lang/rust` to Clippy](#performing-the-sync-from-rust-langrust-to-clippy)
- [Performing the sync from Clippy to `rust-lang/rust`](#performing-the-sync-from-clippy-to-rust-langrust)
- [Performing the sync from [`rust-lang/rust`] to Clippy](#performing-the-sync-from-rust-langrust-to-clippy)
- [Performing the sync from Clippy to [`rust-lang/rust`]](#performing-the-sync-from-clippy-to-rust-langrust)
- [Defining remotes](#defining-remotes)
- [Issue and PR triage](#issue-and-pr-triage)
- [Bors and Homu](#bors-and-homu)
Expand Down Expand Up @@ -105,21 +107,41 @@ quick read.

## Getting code-completion for rustc internals to work

Unfortunately, [`rust-analyzer`][ra_homepage] does not (yet?) understand how Clippy uses compiler-internals
### IntelliJ Rust
Unfortunately, [`IntelliJ Rust`][IntelliJ_rust_homepage] does not (yet?) understand how Clippy uses compiler-internals
using `extern crate` and it also needs to be able to read the source files of the rustc-compiler which are not
available via a `rustup` component at the time of writing.
To work around this, you need to have a copy of the [rustc-repo][rustc_repo] available which can be obtained via
`git clone https://github.com/rust-lang/rust/`.
Then you can run a `cargo dev` command to automatically make Clippy use the rustc-repo via path-dependencies
which rust-analyzer will be able to understand.
Run `cargo dev ra_setup --repo-path <repo-path>` where `<repo-path>` is an absolute path to the rustc repo
which `IntelliJ Rust` will be able to understand.
Run `cargo dev ide_setup --repo-path <repo-path>` where `<repo-path>` is a path to the rustc repo
you just cloned.
The command will add path-dependencies pointing towards rustc-crates inside the rustc repo to
Clippys `Cargo.toml`s and should allow rust-analyzer to understand most of the types that Clippy uses.
Just make sure to remove the dependencies again before finally making a pull request!

[ra_homepage]: https://rust-analyzer.github.io/
[rustc_repo]: https://github.com/rust-lang/rust/
[IntelliJ_rust_homepage]: https://intellij-rust.github.io/

### Rust Analyzer
As of [#6869][6869], [`rust-analyzer`][ra_homepage] can understand that Clippy uses compiler-internals
using `extern crate` when `package.metadata.rust-analyzer.rustc_private` is set to `true` in Clippys `Cargo.toml.`
You will required a `nightly` toolchain with the `rustc-dev` component installed.
Make sure that in the `rust-analyzer` configuration, you set
```
{ "rust-analyzer.rustcSource": "discover" }
```
and
```
{ "rust-analyzer.updates.channel": "nightly" }
```
You should be able to see information on things like `Expr` or `EarlyContext` now if you hover them, also
a lot more type hints.
This will work with `rust-analyzer 2021-03-15` shipped in nightly `1.52.0-nightly (107896c32 2021-03-15)` or later.

[ra_homepage]: https://rust-analyzer.github.io/
[6869]: https://github.com/rust-lang/rust-clippy/pull/6869

## How Clippy works

Expand Down
4 changes: 3 additions & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.52"
version = "0.1.53"
authors = ["The Rust Clippy Developers"]
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
Expand Down Expand Up @@ -37,6 +37,8 @@ clippy-mini-macro-test = { version = "0.2", path = "mini-macro" }
serde = { version = "1.0", features = ["derive"] }
derive-new = "0.5"
regex = "1.4"
quote = "1"
syn = { version = "1", features = ["full"] }

# A noop dependency that changes in the Rust repository, it's a bit of a hack.
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn run(check: bool, verbose: bool) {
},
CliError::RaSetupActive => {
eprintln!(
"error: a local rustc repo is enabled as path dependency via `cargo dev ra_setup`.
"error: a local rustc repo is enabled as path dependency via `cargo dev ide_setup`.
Not formatting because that would format the local repo as well!
Please revert the changes to Cargo.tomls first."
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn inject_deps_into_manifest(
// do not inject deps if we have aleady done so
if cargo_toml.contains("[target.'cfg(NOT_A_PLATFORM)'.dependencies]") {
eprintln!(
"cargo dev ra_setup: warning: deps already found inside {}, doing nothing.",
"cargo dev ide_setup: warning: deps already found inside {}, doing nothing.",
manifest_path
);
return Ok(());
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use walkdir::WalkDir;

pub mod bless;
pub mod fmt;
pub mod ide_setup;
pub mod new_lint;
pub mod ra_setup;
pub mod serve;
pub mod stderr_length_check;
pub mod update_lints;
Expand Down
8 changes: 4 additions & 4 deletions src/tools/clippy/clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]

use clap::{App, Arg, ArgMatches, SubCommand};
use clippy_dev::{bless, fmt, new_lint, ra_setup, serve, stderr_length_check, update_lints};
use clippy_dev::{bless, fmt, ide_setup, new_lint, serve, stderr_length_check, update_lints};
fn main() {
let matches = get_clap_config();

Expand Down Expand Up @@ -34,7 +34,7 @@ fn main() {
("limit_stderr_length", _) => {
stderr_length_check::check();
},
("ra_setup", Some(matches)) => ra_setup::run(matches.value_of("rustc-repo-path")),
("ide_setup", Some(matches)) => ide_setup::run(matches.value_of("rustc-repo-path")),
("serve", Some(matches)) => {
let port = matches.value_of("port").unwrap().parse().unwrap();
let lint = matches.value_of("lint");
Expand Down Expand Up @@ -138,8 +138,8 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
.about("Ensures that stderr files do not grow longer than a certain amount of lines."),
)
.subcommand(
SubCommand::with_name("ra_setup")
.about("Alter dependencies so rust-analyzer can find rustc internals")
SubCommand::with_name("ide_setup")
.about("Alter dependencies so Intellij Rust can find rustc internals")
.arg(
Arg::with_name("rustc-repo-path")
.long("repo-path")
Expand Down
5 changes: 1 addition & 4 deletions src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "clippy_lints"
# begin automatic update
version = "0.1.52"
version = "0.1.53"
# end automatic update
authors = ["The Rust Clippy Developers"]
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
Expand All @@ -20,16 +20,13 @@ pulldown-cmark = { version = "0.8", default-features = false }
quine-mc_cluskey = "0.2.2"
regex-syntax = "0.6"
serde = { version = "1.0", features = ["derive"] }
smallvec = { version = "1", features = ["union"] }
toml = "0.5.3"
unicode-normalization = "0.1"
semver = "0.11"
rustc-semver = "1.1.0"
# NOTE: cargo requires serde feat in its url dep
# see <https://github.com/rust-lang/rust/pull/63587#issuecomment-522343864>
url = { version = "2.1.0", features = ["serde"] }
quote = "1"
syn = { version = "1", features = ["full"] }

[features]
deny-warnings = []
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::span_lint;
use clippy_utils::diagnostics::span_lint;
use rustc_ast::ast::{FloatTy, LitFloatType, LitKind};
use rustc_hir::{Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/arithmetic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::consts::constant_simple;
use crate::utils::span_lint;
use clippy_utils::diagnostics::span_lint;
use rustc_hir as hir;
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_tool_lint, impl_lint_pass};
Expand Down
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_lints/src/as_conversions.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use clippy_utils::diagnostics::span_lint_and_help;
use rustc_ast::ast::{Expr, ExprKind};
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};

use crate::utils::span_lint_and_help;

declare_clippy_lint! {
/// **What it does:** Checks for usage of `as` conversions.
///
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/asm_syntax.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt;

use crate::utils::span_lint_and_help;
use clippy_utils::diagnostics::span_lint_and_help;
use rustc_ast::ast::{Expr, ExprKind, InlineAsmOptions};
use rustc_lint::{EarlyContext, EarlyLintPass, Lint};
use rustc_session::{declare_lint_pass, declare_tool_lint};
Expand Down
4 changes: 3 additions & 1 deletion src/tools/clippy/clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::consts::{constant, Constant};
use crate::utils::{is_direct_expn_of, is_expn_of, match_panic_call, snippet_opt, span_lint_and_help};
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::source::snippet_opt;
use clippy_utils::{is_direct_expn_of, is_expn_of, match_panic_call};
use if_chain::if_chain;
use rustc_hir::{Expr, ExprKind, UnOp};
use rustc_lint::{LateContext, LateLintPass};
Expand Down
11 changes: 6 additions & 5 deletions src/tools/clippy/clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::utils::{
eq_expr_value, get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, trait_ref_of_method,
};
use crate::utils::{higher, sugg};
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::source::snippet_opt;
use clippy_utils::ty::implements_trait;
use clippy_utils::{eq_expr_value, get_trait_def_id, trait_ref_of_method};
use clippy_utils::{higher, paths, sugg};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir as hir;
Expand Down Expand Up @@ -92,7 +93,7 @@ impl<'tcx> LateLintPass<'tcx> for AssignOps {
$($trait_name:ident),+) => {
match $op {
$(hir::BinOpKind::$trait_name => {
let [krate, module] = crate::utils::paths::OPS_MODULE;
let [krate, module] = paths::OPS_MODULE;
let path: [&str; 3] = [krate, module, concat!(stringify!($trait_name), "Assign")];
let trait_id = if let Some(trait_id) = get_trait_def_id($cx, &path) {
trait_id
Expand Down
4 changes: 3 additions & 1 deletion src/tools/clippy/clippy_lints/src/async_yields_async.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::utils::{implements_trait, snippet, span_lint_and_then};
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::source::snippet;
use clippy_utils::ty::implements_trait;
use rustc_errors::Applicability;
use rustc_hir::{AsyncGeneratorKind, Body, BodyId, ExprKind, GeneratorKind, QPath};
use rustc_lint::{LateContext, LateLintPass};
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/clippy_lints/src/atomic_ordering.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::utils::{match_def_path, span_lint_and_help};
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::match_def_path;
use if_chain::if_chain;
use rustc_hir::def_id::DefId;
use rustc_hir::{Expr, ExprKind};
Expand Down
13 changes: 6 additions & 7 deletions src/tools/clippy/clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//! checks for attributes

use crate::utils::{
first_line_of_span, is_present_in_source, match_panic_def_id, snippet_opt, span_lint, span_lint_and_help,
span_lint_and_sugg, span_lint_and_then, without_block_comments,
};
use clippy_utils::diagnostics::{span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then};
use clippy_utils::match_panic_def_id;
use clippy_utils::source::{first_line_of_span, is_present_in_source, snippet_opt, without_block_comments};
use if_chain::if_chain;
use rustc_ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem};
use rustc_errors::Applicability;
Expand Down Expand Up @@ -431,7 +430,7 @@ fn is_relevant_block(cx: &LateContext<'_>, typeck_results: &ty::TypeckResults<'_
|stmt| match &stmt.kind {
StmtKind::Local(_) => true,
StmtKind::Expr(expr) | StmtKind::Semi(expr) => is_relevant_expr(cx, typeck_results, expr),
_ => false,
StmtKind::Item(_) => false,
},
)
}
Expand Down Expand Up @@ -565,7 +564,7 @@ fn check_deprecated_cfg_attr(cx: &EarlyContext<'_>, attr: &Attribute) {
// check for `rustfmt_skip` and `rustfmt::skip`
if let Some(skip_item) = &items[1].meta_item();
if skip_item.has_name(sym!(rustfmt_skip)) ||
skip_item.path.segments.last().expect("empty path in attribute").ident.name == sym!(skip);
skip_item.path.segments.last().expect("empty path in attribute").ident.name == sym::skip;
// Only lint outer attributes, because custom inner attributes are unstable
// Tracking issue: https://github.com/rust-lang/rust/issues/54726
if let AttrStyle::Outer = attr.style;
Expand Down Expand Up @@ -614,7 +613,7 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
}
}
},
_ => {},
MetaItemKind::NameValue(..) => {},
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/clippy_lints/src/await_holding_invalid.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::utils::{match_def_path, paths, span_lint_and_note};
use clippy_utils::diagnostics::span_lint_and_note;
use clippy_utils::{match_def_path, paths};
use rustc_hir::def_id::DefId;
use rustc_hir::{AsyncGeneratorKind, Body, BodyId, GeneratorKind};
use rustc_lint::{LateContext, LateLintPass};
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/bit_mask.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::consts::{constant, Constant};
use crate::utils::sugg::Sugg;
use crate::utils::{span_lint, span_lint_and_then};
use clippy_utils::diagnostics::{span_lint, span_lint_and_then};
use clippy_utils::sugg::Sugg;
use if_chain::if_chain;
use rustc_ast::ast::LitKind;
use rustc_errors::Applicability;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/blacklisted_name.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::span_lint;
use clippy_utils::diagnostics::span_lint;
use rustc_data_structures::fx::FxHashSet;
use rustc_hir::{Pat, PatKind};
use rustc_lint::{LateContext, LateLintPass};
Expand Down
Loading