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

Clippy subtree update #129531

Merged
merged 91 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
760c3fa
Fix case where `doc_markdown` is triggered on words ending with "ified"
GuillaumeGomez Jul 26, 2024
88506a9
Add regression test for #13097
GuillaumeGomez Jul 26, 2024
855a9d1
Add new `too_long_first_doc_paragraph` first paragraph lint
GuillaumeGomez Jun 24, 2024
f455587
Set the limit of characters to 200 and don't run the lint on private …
GuillaumeGomez Jul 9, 2024
4969960
Fix dogfood lints
GuillaumeGomez Jul 9, 2024
3c6e5ef
Add comment explaining what the matching items are for `TOO_LONG_FIRS…
GuillaumeGomez Jul 21, 2024
b7e7975
Move style into its file
GuillaumeGomez Jul 30, 2024
7c52091
Add new settings menu
GuillaumeGomez Jul 30, 2024
8bf5a83
Fix example
alex-semenyuk Jul 30, 2024
5364cbe
Respect allow inconsistent_struct_constructor on the type definition
rzvxa Aug 3, 2024
234a1d3
recognize metavariables in tail expressions
y21 Aug 5, 2024
5e25e7c
add a test for ice-3717.rs
kyoto7250 Aug 7, 2024
6ce7e6d
Rename struct_tail_erasing_lifetimes to struct_tail_for_codegen
compiler-errors Aug 8, 2024
1ac76a2
Merge commit 'cb806113e0f83a8f9b47d35b453b676543bcc40e' into clippy-s…
flip1995 Aug 8, 2024
9948b42
Fix confusing message in double_must_use lint
alex-semenyuk Aug 8, 2024
e785219
Shrink `TyKind::FnPtr`.
nnethercote Aug 8, 2024
d85cf0b
use `fulfill_or_allowed` over `is_lint_allowed`.
rzvxa Aug 9, 2024
7591ec4
Auto merge of #128703 - compiler-errors:normalizing-tails, r=lcnr
bors Aug 9, 2024
1c81105
Auto merge of #13211 - rzvxa:respect_allow_inconsistent_struct_constr…
bors Aug 9, 2024
b32a017
Replace `rustc_semver` with `rustc_session::RustcVersion`
Alexendoo Aug 9, 2024
9afab36
Rename `get_source_text` to `get_source_range`. Add new `get_source_t…
Jarcho Aug 9, 2024
dda9eb9
Paper over the clippy ICE
saethlin Jul 11, 2024
f9509d3
Refactor `absolute_paths`:
Jarcho Jul 4, 2024
780c61f
Auto merge of #13041 - Jarcho:path, r=y21
bors Aug 10, 2024
917ad03
Fixes in various places
Nadrieril Mar 20, 2024
4231e93
Remove `find_format_arg_expr` AST fallback
Alexendoo Aug 10, 2024
37f98ff
Auto merge of #13220 - y21:issue13219, r=dswij
bors Aug 10, 2024
c8b0923
Auto merge of #13163 - GuillaumeGomez:fix-13097, r=Alexendoo
bors Aug 10, 2024
6de27a0
lintcheck: key lints on line start rather than byte start/end
Alexendoo Aug 10, 2024
837d904
Link `std` statically in `rustc_driver`
Zoxc Mar 12, 2024
94099f4
Auto merge of #13250 - Alexendoo:lintcheck-diff-key, r=xFrednet
bors Aug 11, 2024
f93fb9a
Clarify message for unwrap lint
alex-semenyuk Aug 11, 2024
934e98d
Unify theme and settings menus
GuillaumeGomez Aug 6, 2024
2ae6a49
Move themes directly into HTML
GuillaumeGomez Aug 11, 2024
c7c8724
Auto merge of #13187 - GuillaumeGomez:settings-menu, r=Alexendoo
bors Aug 11, 2024
ddf2ba5
Remove more instances of `snippet_opt`.
Jarcho Aug 11, 2024
e36c2a4
Auto merge of #126793 - saethlin:mono-rawvec, r=scottmcm
bors Aug 12, 2024
52192aa
Auto merge of #13243 - Alexendoo:rustcversion, r=flip1995
bors Aug 12, 2024
d7f1252
fix code blocks in doc comments inconsistently using 3 or 4 spaces of…
antonilol Aug 12, 2024
1984752
Auto merge of #13255 - Jarcho:get_src_display2, r=Manishearth
bors Aug 12, 2024
e070784
Auto merge of #13261 - antonilol:fix-doc-code-blocks, r=xFrednet
bors Aug 12, 2024
8827107
Auto merge of #13230 - kyoto7250:fix_issue_13099, r=flip1995
bors Aug 12, 2024
182cd5f
Replace the metadata collector with tests
Alexendoo Aug 5, 2024
a22ce2d
Remove `HashSet`s from `Conf`
Alexendoo Aug 12, 2024
61a252f
Auto merge of #13221 - Alexendoo:farewell-metadata-collector, r=xFrednet
bors Aug 13, 2024
5fee840
fix indentation in docs
antonilol Aug 13, 2024
819fa6f
fix source location github link
antonilol Aug 13, 2024
84e98eb
Auto merge of #13265 - antonilol:lint-source-location, r=Alexendoo
bors Aug 13, 2024
70457f6
Auto merge of #13253 - alex-semenyuk:fix_message_unnecessary_unwrap, …
bors Aug 13, 2024
6d08b08
Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-e…
bors Aug 14, 2024
f72b3db
Use `impl PartialEq<TokenKind> for Token` more.
nnethercote Aug 9, 2024
7381944
Auto merge of #13193 - alex-semenyuk:fix_doc_unused_io_amount, r=xFre…
bors Aug 14, 2024
dde0dca
Rollup merge of #129065 - nnethercote:PartialEq-TokenKind, r=spastorino
matthiaskrgr Aug 15, 2024
f3e0033
flip1995: 2 week vacation
flip1995 Aug 15, 2024
5da97d0
Auto merge of #13272 - flip1995:vacation, r=flip1995
bors Aug 15, 2024
953c7ed
Disable assigning_clones for tests
alex-semenyuk Aug 16, 2024
c037361
Fix code snippet in from_str_radix_10 docs
Alexendoo Aug 16, 2024
68b222e
Auto merge of #13274 - Alexendoo:from-str-radix-10-docs, r=xFrednet
bors Aug 16, 2024
4f66130
Replace `span_suggestion_with_style` with `_verbose`
Alexendoo Aug 17, 2024
ed46141
Remove duplicate `type_diagnostic_name` function
Alexendoo Aug 17, 2024
9aa656d
Remove redundant doc comments
Alexendoo Aug 17, 2024
6993752
Replace some iteration with `get_[type_]diagnostic_name`
Alexendoo Aug 17, 2024
233b5f2
Auto merge of #13273 - alex-semenyuk:assigning_clones_disable_for_tes…
bors Aug 18, 2024
bfe7f07
Auto merge of #13248 - Alexendoo:format-arg-ast-fallback, r=xFrednet
bors Aug 18, 2024
a203342
Do not emit `TOO_LONG_FIRST_DOC_PARAGRAPH` lint if item is generated …
GuillaumeGomez Aug 18, 2024
4e6fc6f
Improve `collapsible_match` error message syntax
sobolevn Aug 18, 2024
43e1145
rename AddressOf -> RawBorrow inside the compiler
RalfJung Aug 12, 2024
45720b7
Auto merge of #13284 - sobolevn:issue-13283, r=y21
bors Aug 18, 2024
1958e1a
fix false position in explicit_iter_loop with msrv
kyoto7250 Aug 19, 2024
ba6bc81
Auto merge of #13278 - Alexendoo:misc-cleanup, r=y21
bors Aug 19, 2024
7b7cf44
string_slice should detect on Cow
alex-semenyuk Aug 18, 2024
e7d9fcf
Auto merge of #13288 - kyoto7250:fix-13184, r=y21
bors Aug 19, 2024
d0e637d
Auto merge of #13281 - alex-semenyuk:string_slice_fix, r=y21
bors Aug 19, 2024
fc8a025
fix(cfg_not_test): lint description typo
mrnossiom Aug 20, 2024
2c0f318
Auto merge of #13289 - mrnossiom:master, r=y21
bors Aug 20, 2024
70650de
Auto merge of #13241 - alex-semenyuk:fix_double_must_use, r=xFrednet
bors Aug 20, 2024
687d4e3
`declare_interior_mutable_const`: Ignore pointer types.
Jarcho Aug 20, 2024
e5a1ef0
Auto merge of #13290 - Jarcho:interior_mut_quick, r=Alexendoo
bors Aug 20, 2024
3f97261
Fix a couple of typos.
waywardmonkeys Aug 21, 2024
a83146a
Auto merge of #13295 - waywardmonkeys:fix-2-typos, r=xFrednet
bors Aug 21, 2024
8a4c34a
Start removing `snippet_opt`
Jarcho Aug 9, 2024
ecfc7d9
Auto merge of #13244 - Jarcho:get_src_display, r=Alexendoo
bors Aug 21, 2024
9450b4a
Replace more uses of `snippet_opt`.
Jarcho Aug 21, 2024
f4fc385
Fix suggestion unwrap_or_else
alex-semenyuk Aug 24, 2024
301f2c4
Auto merge of #13299 - alex-semenyuk:unwrap_or_else_suggestion, r=Ale…
bors Aug 24, 2024
497177f
Auto merge of #13296 - Jarcho:get_src_display3, r=Alexendoo
bors Aug 24, 2024
30e0b69
Auto merge of #12993 - GuillaumeGomez:too_long_first_doc_paragraph, r…
bors Aug 24, 2024
e348fe2
Merge branch 'master' into rustup
Jarcho Aug 24, 2024
0196e2d
Bump nightly version -> 2024-08-23
Jarcho Aug 24, 2024
0f8eabd
Auto merge of #13302 - Jarcho:rustup, r=Jarcho
bors Aug 24, 2024
6c3f43d
Merge commit '0f8eabd6231366bfc1bb1464601297c2d48f8f68' into clippyup
Jarcho Aug 24, 2024
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
11 changes: 2 additions & 9 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ name = "clippy"
version = "0.1.82"
dependencies = [
"anstream",
"cargo_metadata 0.18.1",
"clippy_config",
"clippy_lints",
"clippy_utils",
Expand All @@ -552,6 +553,7 @@ dependencies = [
"regex",
"rustc_tools_util",
"serde",
"serde_json",
"syn 2.0.75",
"tempfile",
"termize",
Expand All @@ -566,7 +568,6 @@ name = "clippy_config"
version = "0.1.82"
dependencies = [
"itertools",
"rustc-semver",
"serde",
"toml 0.7.8",
"walkdir",
Expand Down Expand Up @@ -598,7 +599,6 @@ dependencies = [
"quine-mc_cluskey",
"regex",
"regex-syntax 0.8.4",
"rustc-semver",
"semver",
"serde",
"serde_json",
Expand All @@ -617,7 +617,6 @@ dependencies = [
"arrayvec",
"clippy_config",
"itertools",
"rustc-semver",
"rustc_apfloat",
]

Expand Down Expand Up @@ -3202,12 +3201,6 @@ dependencies = [
"num_cpus",
]

[[package]]
name = "rustc-semver"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be1bdc7edf596692617627bbfeaba522131b18e06ca4df2b6b689e3c5d5ce84"

[[package]]
name = "rustc-stable-hash"
version = "0.1.0"
Expand Down
6 changes: 3 additions & 3 deletions src/tools/clippy/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[alias]
bless = "test --config env.RUSTC_BLESS='1'"
uitest = "test --test compile-test"
uibless = "test --test compile-test -- -- --bless"
bless = "test -- -- --bless"
uibless = "bless --test compile-test"
dev = "run --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
lintcheck = "run --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
collect-metadata = "test --test dogfood --features internal -- collect_metadata"
collect-metadata = "test --test compile-test --config env.COLLECT_METADATA='1'"

[build]
# -Zbinary-dep-depinfo allows us to track which rlib files to use for compiling UI tests
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/.github/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mkdir out/master/
cp util/gh-pages/index.html out/master
cp util/gh-pages/script.js out/master
cp util/gh-pages/lints.json out/master
cp util/gh-pages/style.css out/master

if [[ -n $TAG_NAME ]]; then
echo "Save the doc for the current tag ($TAG_NAME) and point stable/ to it"
Expand Down
5 changes: 0 additions & 5 deletions src/tools/clippy/.github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ jobs:
- name: Test metadata collection
run: cargo collect-metadata

- name: Test lint_configuration.md is up-to-date
run: |
echo "run \`cargo collect-metadata\` if this fails"
git update-index --refresh

integration_build:
needs: changelog
runs-on: ubuntu-latest
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 @@ -5914,6 +5914,7 @@ Released 2018-09-13
[`to_string_in_format_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
[`to_string_trait_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_trait_impl
[`todo`]: https://rust-lang.github.io/rust-clippy/master/index.html#todo
[`too_long_first_doc_paragraph`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
[`too_many_arguments`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
[`too_many_lines`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
[`toplevel_ref_arg`]: https://rust-lang.github.io/rust-clippy/master/index.html#toplevel_ref_arg
Expand Down
4 changes: 3 additions & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ color-print = "0.3.4"
anstream = "0.6.0"

[dev-dependencies]
cargo_metadata = "0.18.1"
ui_test = "0.25"
regex = "1.5.5"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.122"
toml = "0.7.3"
walkdir = "2.3"
filetime = "0.2.9"
Expand All @@ -41,7 +44,6 @@ itertools = "0.12"
clippy_utils = { path = "clippy_utils" }
if_chain = "1.0"
quote = "1.0.25"
serde = { version = "1.0.145", features = ["derive"] }
syn = { version = "2.0", features = ["full"] }
futures = "0.3"
parking_lot = "0.12"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/development/adding_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ for some users. Adding a configuration is done in the following steps:

5. Update [Lint Configuration](../lint_configuration.md)

Run `cargo collect-metadata` to generate documentation changes for the book.
Run `cargo bless --test config-metadata` to generate documentation changes for the book.

[`clippy_config::conf`]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_config/src/conf.rs
[`clippy_lints` lib file]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/lib.rs
Expand Down
8 changes: 3 additions & 5 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
This file is generated by `cargo collect-metadata`.
This file is generated by `cargo bless --test config-metadata`.
Please use that command to update the file and do not edit it by hand.
-->

Expand Down Expand Up @@ -199,7 +199,7 @@ Allowed names below the minimum allowed characters. The value `".."` can be used
the list to indicate, that the configured values should be appended to the default
configuration of Clippy. By default, any configuration will replace the default value.

**Default Value:** `["j", "z", "i", "y", "n", "x", "w"]`
**Default Value:** `["i", "j", "x", "y", "z", "w", "n"]`

---
**Affected lints:**
Expand Down Expand Up @@ -455,7 +455,7 @@ default configuration of Clippy. By default, any configuration will replace the
* `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
* `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.

**Default Value:** `["TiB", "CoreGraphics", "CoffeeScript", "TeX", "Direct2D", "PiB", "DirectX", "NetBSD", "OAuth", "NaN", "OpenType", "WebGL2", "WebTransport", "JavaScript", "OpenSSL", "OpenSSH", "EiB", "PureScript", "OpenAL", "MiB", "WebAssembly", "MinGW", "CoreFoundation", "WebGPU", "ClojureScript", "CamelCase", "OpenDNS", "NaNs", "OpenMP", "GitLab", "KiB", "sRGB", "CoreText", "macOS", "TypeScript", "GiB", "OpenExr", "YCbCr", "OpenTelemetry", "OpenBSD", "FreeBSD", "GPLv2", "PostScript", "WebP", "LaTeX", "TensorFlow", "AccessKit", "TrueType", "OpenStreetMap", "OpenGL", "DevOps", "OCaml", "WebRTC", "WebGL", "BibLaTeX", "GitHub", "GraphQL", "iOS", "Direct3D", "BibTeX", "DirectWrite", "GPLv3", "IPv6", "WebSocket", "IPv4", "ECMAScript"]`
**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "AccessKit", "CoreFoundation", "CoreGraphics", "CoreText", "DevOps", "Direct2D", "Direct3D", "DirectWrite", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PostScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenAL", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "OpenType", "WebGL", "WebGL2", "WebGPU", "WebRTC", "WebSocket", "WebTransport", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`

---
**Affected lints:**
Expand Down Expand Up @@ -949,5 +949,3 @@ Whether to also emit warnings for unsafe blocks with metavariable expansions in
---
**Affected lints:**
* [`macro_metavars_in_unsafe`](https://rust-lang.github.io/rust-clippy/master/index.html#macro_metavars_in_unsafe)


1 change: 0 additions & 1 deletion src/tools/clippy/clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"

[dependencies]
itertools = "0.12"
rustc-semver = "1.1"
serde = { version = "1.0", features = ["derive"] }
toml = "0.7.3"

Expand Down
23 changes: 11 additions & 12 deletions src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::msrvs::Msrv;
use crate::types::{DisallowedPath, MacroMatcher, MatchLintBehaviour, PubUnderscoreFieldsBehaviour, Rename};
use crate::ClippyConfiguration;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::Applicability;
use rustc_session::Session;
use rustc_span::edit_distance::edit_distance;
Expand Down Expand Up @@ -218,7 +217,7 @@ macro_rules! define_Conf {
define_Conf! {
/// Which crates to allow absolute paths from
#[lints(absolute_paths)]
absolute_paths_allowed_crates: FxHashSet<String> = FxHashSet::default(),
absolute_paths_allowed_crates: Vec<String> = Vec::new(),
/// The maximum number of segments a path can have before being linted, anything above this will
/// be linted.
#[lints(absolute_paths)]
Expand Down Expand Up @@ -280,12 +279,12 @@ define_Conf! {
allowed_dotfiles: Vec<String> = Vec::default(),
/// A list of crate names to allow duplicates of
#[lints(multiple_crate_versions)]
allowed_duplicate_crates: FxHashSet<String> = FxHashSet::default(),
allowed_duplicate_crates: Vec<String> = Vec::new(),
/// Allowed names below the minimum allowed characters. The value `".."` can be used as part of
/// the list to indicate, that the configured values should be appended to the default
/// configuration of Clippy. By default, any configuration will replace the default value.
#[lints(min_ident_chars)]
allowed_idents_below_min_chars: FxHashSet<String> =
allowed_idents_below_min_chars: Vec<String> =
DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS.iter().map(ToString::to_string).collect(),
/// List of prefixes to allow when determining whether an item's name ends with the module's name.
/// If the rest of an item's name is an allowed prefix (e.g. item `ToFoo` or `to_foo` in module `foo`),
Expand Down Expand Up @@ -323,7 +322,7 @@ define_Conf! {
/// 2. Paths with any segment that containing the word 'prelude'
/// are already allowed by default.
#[lints(wildcard_imports)]
allowed_wildcard_imports: FxHashSet<String> = FxHashSet::default(),
allowed_wildcard_imports: Vec<String> = Vec::new(),
/// Suppress checking of the passed type names in all types of operations.
///
/// If a specific operation is desired, consider using `arithmetic_side_effects_allowed_binary` or `arithmetic_side_effects_allowed_unary` instead.
Expand Down Expand Up @@ -355,7 +354,7 @@ define_Conf! {
/// arithmetic-side-effects-allowed-binary = [["SomeType" , "f32"], ["AnotherType", "*"]]
/// ```
#[lints(arithmetic_side_effects)]
arithmetic_side_effects_allowed_binary: Vec<[String; 2]> = <_>::default(),
arithmetic_side_effects_allowed_binary: Vec<(String, String)> = <_>::default(),
/// Suppress checking of the passed type names in unary operations like "negation" (`-`).
///
/// #### Example
Expand Down Expand Up @@ -431,7 +430,7 @@ define_Conf! {
/// * `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
/// * `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.
#[lints(doc_markdown)]
doc_valid_idents: FxHashSet<String> = DEFAULT_DOC_VALID_IDENTS.iter().map(ToString::to_string).collect(),
doc_valid_idents: Vec<String> = DEFAULT_DOC_VALID_IDENTS.iter().map(ToString::to_string).collect(),
/// Whether to apply the raw pointer heuristic to determine if a type is `Send`.
#[lints(non_send_fields_in_send_ty)]
enable_raw_pointer_heuristic_for_send: bool = true,
Expand Down Expand Up @@ -706,12 +705,12 @@ fn deserialize(file: &SourceFile) -> TryConf {
DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS,
);
// TODO: THIS SHOULD BE TESTED, this comment will be gone soon
if conf.conf.allowed_idents_below_min_chars.contains("..") {
if conf.conf.allowed_idents_below_min_chars.iter().any(|e| e == "..") {
conf.conf
.allowed_idents_below_min_chars
.extend(DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS.iter().map(ToString::to_string));
}
if conf.conf.doc_valid_idents.contains("..") {
if conf.conf.doc_valid_idents.iter().any(|e| e == "..") {
conf.conf
.doc_valid_idents
.extend(DEFAULT_DOC_VALID_IDENTS.iter().map(ToString::to_string));
Expand Down Expand Up @@ -890,14 +889,14 @@ fn calculate_dimensions(fields: &[&str]) -> (usize, Vec<usize>) {

#[cfg(test)]
mod tests {
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use serde::de::IgnoredAny;
use std::collections::{HashMap, HashSet};
use std::fs;
use walkdir::WalkDir;

#[test]
fn configs_are_tested() {
let mut names: FxHashSet<String> = crate::get_configuration_metadata()
let mut names: HashSet<String> = crate::get_configuration_metadata()
.into_iter()
.map(|meta| meta.name.replace('_', "-"))
.collect();
Expand All @@ -910,7 +909,7 @@ mod tests {
for entry in toml_files {
let file = fs::read_to_string(entry.path()).unwrap();
#[allow(clippy::zero_sized_map_values)]
if let Ok(map) = toml::from_str::<FxHashMap<String, IgnoredAny>>(&file) {
if let Ok(map) = toml::from_str::<HashMap<String, IgnoredAny>>(&file) {
for name in map.keys() {
names.remove(name.as_str());
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)]

extern crate rustc_ast;
extern crate rustc_data_structures;
extern crate rustc_attr;
#[allow(unused_extern_crates)]
extern crate rustc_driver;
extern crate rustc_errors;
Expand Down
17 changes: 9 additions & 8 deletions src/tools/clippy/clippy_config/src/msrvs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc_ast::Attribute;
use rustc_semver::RustcVersion;
use rustc_session::Session;
use rustc_attr::parse_version;
use rustc_session::{RustcVersion, Session};
use rustc_span::{sym, Symbol};
use serde::Deserialize;
use std::fmt;
Expand All @@ -10,14 +10,15 @@ macro_rules! msrv_aliases {
$($name:ident),* $(,)?
})*) => {
$($(
pub const $name: RustcVersion = RustcVersion::new($major, $minor, $patch);
pub const $name: RustcVersion = RustcVersion { major: $major, minor :$minor, patch: $patch };
)*)*
};
}

// names may refer to stabilized feature flags or library items
msrv_aliases! {
1,81,0 { LINT_REASONS_STABILIZATION }
1,80,0 { BOX_INTO_ITER}
1,77,0 { C_STR_LITERALS }
1,76,0 { PTR_FROM_REF, OPTION_RESULT_INSPECT }
1,71,0 { TUPLE_ARRAY_CONVERSIONS, BUILD_HASHER_HASH_ONE }
Expand Down Expand Up @@ -81,9 +82,9 @@ impl<'de> Deserialize<'de> for Msrv {
D: serde::Deserializer<'de>,
{
let v = String::deserialize(deserializer)?;
RustcVersion::parse(&v)
parse_version(Symbol::intern(&v))
.map(|v| Msrv { stack: vec![v] })
.map_err(|_| serde::de::Error::custom("not a valid Rust version"))
.ok_or_else(|| serde::de::Error::custom("not a valid Rust version"))
}
}

Expand All @@ -95,7 +96,7 @@ impl Msrv {
pub fn read_cargo(&mut self, sess: &Session) {
let cargo_msrv = std::env::var("CARGO_PKG_RUST_VERSION")
.ok()
.and_then(|v| RustcVersion::parse(&v).ok());
.and_then(|v| parse_version(Symbol::intern(&v)));

match (self.current(), cargo_msrv) {
(None, Some(cargo_msrv)) => self.stack = vec![cargo_msrv],
Expand All @@ -115,7 +116,7 @@ impl Msrv {
}

pub fn meets(&self, required: RustcVersion) -> bool {
self.current().map_or(true, |version| version.meets(required))
self.current().map_or(true, |msrv| msrv >= required)
}

fn parse_attr(sess: &Session, attrs: &[Attribute]) -> Option<RustcVersion> {
Expand All @@ -131,7 +132,7 @@ impl Msrv {
}

if let Some(msrv) = msrv_attr.value_str() {
if let Ok(version) = RustcVersion::parse(msrv.as_str()) {
if let Some(version) = parse_version(msrv) {
return Some(version);
}

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(rustc_private)]
// warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)]

Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/update_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ fn gen_declared_lints<'a>(
details.sort_unstable();

let mut output = GENERATED_FILE_COMMENT.to_string();
output.push_str("pub(crate) static LINTS: &[&crate::LintInfo] = &[\n");
output.push_str("pub static LINTS: &[&crate::LintInfo] = &[\n");

for (is_public, module_name, lint_name) in details {
if !is_public {
Expand Down
1 change: 0 additions & 1 deletion src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ regex = { version = "1.5", optional = true }
unicode-normalization = "0.1"
unicode-script = { version = "0.5", default-features = false }
semver = "1.0"
rustc-semver = "1.1"
url = "2.2"

[dev-dependencies]
Expand Down
Loading
Loading