Skip to content

Commit 95ee06c

Browse files
committed
Auto merge of #128193 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update r? `@Manishearth` Updates Cargo.lock due to the Clippy version update and the ui_test bump to v0.24
2 parents 36214e9 + 4e6851e commit 95ee06c

File tree

291 files changed

+4846
-5161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

291 files changed

+4846
-5161
lines changed

.cargo/config.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ uibless = "test --test compile-test -- -- --bless"
44
bless = "test -- -- --bless"
55
dev = "run --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
66
lintcheck = "run --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
7-
collect-metadata = "test --test dogfood --features internal -- run_metadata_collection_lint --ignored"
7+
collect-metadata = "test --test dogfood --features internal -- collect_metadata"
88

99
[build]
1010
# -Zbinary-dep-depinfo allows us to track which rlib files to use for compiling UI tests

.github/workflows/lintcheck.yml

+22-6
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ jobs:
5353
id: cache-json
5454
uses: actions/cache@v4
5555
with:
56-
path: lintcheck-logs/lintcheck_crates_logs.json
56+
path: lintcheck-logs/ci_crates_logs.json
5757
key: ${{ steps.key.outputs.key }}
5858

5959
- name: Run lintcheck
6060
if: steps.cache-json.outputs.cache-hit != 'true'
61-
run: ./target/debug/lintcheck --format json --warn-all
61+
run: ./target/debug/lintcheck --format json --warn-all --crates-toml ./lintcheck/ci_crates.toml
6262

6363
- name: Upload base JSON
6464
uses: actions/upload-artifact@v4
6565
with:
6666
name: base
67-
path: lintcheck-logs/lintcheck_crates_logs.json
67+
path: lintcheck-logs/ci_crates_logs.json
6868

6969
# Runs lintcheck on the PR and stores the results as an artifact
7070
head:
@@ -86,13 +86,13 @@ jobs:
8686
run: cargo build --manifest-path=lintcheck/Cargo.toml
8787

8888
- name: Run lintcheck
89-
run: ./target/debug/lintcheck --format json --warn-all
89+
run: ./target/debug/lintcheck --format json --warn-all --crates-toml ./lintcheck/ci_crates.toml
9090

9191
- name: Upload head JSON
9292
uses: actions/upload-artifact@v4
9393
with:
9494
name: head
95-
path: lintcheck-logs/lintcheck_crates_logs.json
95+
path: lintcheck-logs/ci_crates_logs.json
9696

9797
# Retrieves the head and base JSON results and prints the diff to the GH actions step summary
9898
diff:
@@ -115,4 +115,20 @@ jobs:
115115
uses: actions/download-artifact@v4
116116

117117
- name: Diff results
118-
run: ./target/debug/lintcheck diff {base,head}/lintcheck_crates_logs.json >> $GITHUB_STEP_SUMMARY
118+
# GH's summery has a maximum size of 1024k:
119+
# https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary
120+
# That's why we first log to file and then to the summary and logs
121+
run: |
122+
./target/debug/lintcheck diff {base,head}/ci_crates_logs.json --truncate >> truncated_diff.md
123+
head -c 1024000 truncated_diff.md >> $GITHUB_STEP_SUMMARY
124+
cat truncated_diff.md
125+
./target/debug/lintcheck diff {base,head}/ci_crates_logs.json >> full_diff.md
126+
127+
- name: Upload full diff
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: diff
131+
if-no-files-found: ignore
132+
path: |
133+
full_diff.md
134+
truncated_diff.md

CHANGELOG.md

+45-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,53 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[ca3b3937...master](https://github.com/rust-lang/rust-clippy/compare/ca3b3937...master)
9+
[c9139bd5...master](https://github.com/rust-lang/rust-clippy/compare/c9139bd5...master)
10+
11+
## Rust 1.80
12+
13+
Current stable, released 2024-07-25
14+
15+
[View all 68 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-04-18T22%3A50%3A22Z..2024-05-30T08%3A26%3A18Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`while_float`] to `nursery`
20+
[#12765](https://github.com/rust-lang/rust-clippy/pull/12765)
21+
* Added [`macro_metavars_in_unsafe`] to `suspicious`
22+
[#12107](https://github.com/rust-lang/rust-clippy/pull/12107)
23+
* Added [`renamed_function_params`] to `restriction`
24+
[#11540](https://github.com/rust-lang/rust-clippy/pull/11540)
25+
* Added [`doc_lazy_continuation`] to `style`
26+
[#12770](https://github.com/rust-lang/rust-clippy/pull/12770)
27+
28+
### Moves and Deprecations
29+
30+
* Moved [`assigning_clones`] to `pedantic` (From `perf` now allow-by-default)
31+
[#12779](https://github.com/rust-lang/rust-clippy/pull/12779)
32+
* Moved [`single_char_pattern`] to `pedantic` (From `perf` now allow-by-default)
33+
[#11852](https://github.com/rust-lang/rust-clippy/pull/11852)
34+
35+
### Enhancements
36+
37+
* [`panic`]: Added [`allow-panic-in-tests`] configuration to allow the lint in tests
38+
[#12803](https://github.com/rust-lang/rust-clippy/pull/12803)
39+
* [`missing_const_for_fn`]: Now respects the [`msrv`] configuration
40+
[#12713](https://github.com/rust-lang/rust-clippy/pull/12713)
41+
* [`missing_panics_doc`]: No longer lints on compile-time panics
42+
[#12790](https://github.com/rust-lang/rust-clippy/pull/12790)
43+
* [`collapsible_match`]: Now considers the [`msrv`] configuration for the suggestion
44+
[#12745](https://github.com/rust-lang/rust-clippy/pull/12745)
45+
* [`useless_vec`]: Added [`allow-useless-vec-in-tests`] configuration to allow the lint in tests
46+
[#12725](https://github.com/rust-lang/rust-clippy/pull/12725)
47+
48+
### Suggestion Fixes/Improvements
49+
50+
* [`single_match`], [`single_match_else`]: Suggestions are now machine-applicable
51+
[#12726](https://github.com/rust-lang/rust-clippy/pull/12726)
1052

1153
## Rust 1.79
1254

13-
Current stable, released 2024-06-13
55+
Released 2024-06-13
1456

1557
[View all 102 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-03-08T11%3A13%3A58Z..2024-04-18T15%3A50%3A50Z+base%3Amaster)
1658

@@ -5712,6 +5754,7 @@ Released 2018-09-13
57125754
[`partialeq_to_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_to_none
57135755
[`path_buf_push_overwrite`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_buf_push_overwrite
57145756
[`path_ends_with_ext`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_ends_with_ext
5757+
[`pathbuf_init_then_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#pathbuf_init_then_push
57155758
[`pattern_type_mismatch`]: https://rust-lang.github.io/rust-clippy/master/index.html#pattern_type_mismatch
57165759
[`permissions_set_readonly_false`]: https://rust-lang.github.io/rust-clippy/master/index.html#permissions_set_readonly_false
57175760
[`positional_named_format_parameters`]: https://rust-lang.github.io/rust-clippy/master/index.html#positional_named_format_parameters

Cargo.toml

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.81"
3+
version = "0.1.82"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"
@@ -30,11 +30,10 @@ color-print = "0.3.4"
3030
anstream = "0.6.0"
3131

3232
[dev-dependencies]
33-
ui_test = "0.23"
33+
ui_test = "0.24"
3434
regex = "1.5.5"
3535
toml = "0.7.3"
3636
walkdir = "2.3"
37-
# This is used by the `collect-metadata` alias.
3837
filetime = "0.2.9"
3938
itertools = "0.12"
4039

@@ -63,3 +62,7 @@ rustc_private = true
6362
[[test]]
6463
name = "compile-test"
6564
harness = false
65+
66+
[[test]]
67+
name = "dogfood"
68+
harness = false

book/src/development/adding_lints.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,8 @@ pub struct ManualStrip {
458458
}
459459

460460
impl ManualStrip {
461-
#[must_use]
462-
pub fn new(msrv: Msrv) -> Self {
463-
Self { msrv }
461+
pub fn new(conf: &'static Conf) -> Self {
462+
Self { msrv: conf.msrv.clone() }
464463
}
465464
}
466465
```
@@ -689,7 +688,6 @@ for some users. Adding a configuration is done in the following steps:
689688
]);
690689

691690
// New manual definition struct
692-
#[derive(Copy, Clone)]
693691
pub struct StructName {}
694692

695693
impl_lint_pass!(StructName => [
@@ -700,17 +698,16 @@ for some users. Adding a configuration is done in the following steps:
700698
2. Next add the configuration value and a corresponding creation method like
701699
this:
702700
```rust
703-
#[derive(Copy, Clone)]
704701
pub struct StructName {
705702
configuration_ident: Type,
706703
}
707704

708705
// ...
709706

710707
impl StructName {
711-
pub fn new(configuration_ident: Type) -> Self {
708+
pub fn new(conf: &'static Conf) -> Self {
712709
Self {
713-
configuration_ident,
710+
configuration_ident: conf.configuration_ident,
714711
}
715712
}
716713
}
@@ -726,8 +723,7 @@ for some users. Adding a configuration is done in the following steps:
726723
store.register_*_pass(|| box module::StructName);
727724

728725
// New registration with configuration value
729-
let configuration_ident = conf.configuration_ident.clone();
730-
store.register_*_pass(move || box module::StructName::new(configuration_ident));
726+
store.register_*_pass(move || box module::StructName::new(conf));
731727
```
732728

733729
Congratulations the work is almost done. The configuration value can now be

book/src/lint_configuration.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ default configuration of Clippy. By default, any configuration will replace the
455455
* `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
456456
* `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.
457457

458-
**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "DevOps", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "WebGL", "WebGL2", "WebGPU", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`
458+
**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"]`
459459

460460
---
461461
**Affected lints:**
@@ -679,6 +679,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
679679
* [`cast_abs_to_unsigned`](https://rust-lang.github.io/rust-clippy/master/index.html#cast_abs_to_unsigned)
680680
* [`checked_conversions`](https://rust-lang.github.io/rust-clippy/master/index.html#checked_conversions)
681681
* [`cloned_instead_of_copied`](https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied)
682+
* [`collapsible_match`](https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match)
682683
* [`collapsible_str_replace`](https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_str_replace)
683684
* [`deprecated_cfg_attr`](https://rust-lang.github.io/rust-clippy/master/index.html#deprecated_cfg_attr)
684685
* [`derivable_impls`](https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls)

clippy.toml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ reason = "this function does not add a link to our documentation, please use the
88
path = "rustc_lint::context::LintContext::span_lint"
99
reason = "this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint*` functions instead"
1010

11-
1211
[[disallowed-methods]]
1312
path = "rustc_middle::ty::context::TyCtxt::node_span_lint"
1413
reason = "this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint_hir*` functions instead"

clippy_config/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_config"
3-
version = "0.1.81"
3+
version = "0.1.82"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

clippy_config/src/conf.rs

+18-11
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,26 @@ use std::{cmp, env, fmt, fs, io};
1818
#[rustfmt::skip]
1919
const DEFAULT_DOC_VALID_IDENTS: &[&str] = &[
2020
"KiB", "MiB", "GiB", "TiB", "PiB", "EiB",
21+
"AccessKit",
22+
"CoreFoundation", "CoreGraphics", "CoreText",
2123
"DevOps",
22-
"DirectX",
24+
"Direct2D", "Direct3D", "DirectWrite", "DirectX",
2325
"ECMAScript",
2426
"GPLv2", "GPLv3",
2527
"GitHub", "GitLab",
2628
"IPv4", "IPv6",
27-
"ClojureScript", "CoffeeScript", "JavaScript", "PureScript", "TypeScript",
29+
"ClojureScript", "CoffeeScript", "JavaScript", "PostScript", "PureScript", "TypeScript",
2830
"WebAssembly",
2931
"NaN", "NaNs",
3032
"OAuth", "GraphQL",
3133
"OCaml",
32-
"OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry",
33-
"WebGL", "WebGL2", "WebGPU",
34+
"OpenAL", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry",
35+
"OpenType",
36+
"WebGL", "WebGL2", "WebGPU", "WebRTC", "WebSocket", "WebTransport",
3437
"WebP", "OpenExr", "YCbCr", "sRGB",
3538
"TensorFlow",
3639
"TrueType",
37-
"iOS", "macOS", "FreeBSD",
40+
"iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD",
3841
"TeX", "LaTeX", "BibTeX", "BibLaTeX",
3942
"MinGW",
4043
"CamelCase",
@@ -235,7 +238,7 @@ define_Conf! {
235238
///
236239
/// A type, say `SomeType`, listed in this configuration has the same behavior of
237240
/// `["SomeType" , "*"], ["*", "SomeType"]` in `arithmetic_side_effects_allowed_binary`.
238-
(arithmetic_side_effects_allowed: FxHashSet<String> = <_>::default()),
241+
(arithmetic_side_effects_allowed: Vec<String> = <_>::default()),
239242
/// Lint: ARITHMETIC_SIDE_EFFECTS.
240243
///
241244
/// Suppress checking of the passed type pair names in binary operations like addition or
@@ -262,12 +265,12 @@ define_Conf! {
262265
/// ```toml
263266
/// arithmetic-side-effects-allowed-unary = ["SomeType", "AnotherType"]
264267
/// ```
265-
(arithmetic_side_effects_allowed_unary: FxHashSet<String> = <_>::default()),
268+
(arithmetic_side_effects_allowed_unary: Vec<String> = <_>::default()),
266269
/// Lint: ENUM_VARIANT_NAMES, LARGE_TYPES_PASSED_BY_VALUE, TRIVIALLY_COPY_PASS_BY_REF, UNNECESSARY_WRAPS, UNUSED_SELF, UPPER_CASE_ACRONYMS, WRONG_SELF_CONVENTION, BOX_COLLECTION, REDUNDANT_ALLOCATION, RC_BUFFER, VEC_BOX, OPTION_OPTION, LINKEDLIST, RC_MUTEX, UNNECESSARY_BOX_RETURNS, SINGLE_CALL_FN, NEEDLESS_PASS_BY_REF_MUT.
267270
///
268271
/// Suppress lints whenever the suggested change would cause breakage for other crates.
269272
(avoid_breaking_exported_api: bool = true),
270-
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS, MANUAL_PATTERN_CHAR_COMPARISON, ALLOW_ATTRIBUTES, ALLOW_ATTRIBUTES_WITHOUT_REASON.
273+
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS, MANUAL_PATTERN_CHAR_COMPARISON, ALLOW_ATTRIBUTES, ALLOW_ATTRIBUTES_WITHOUT_REASON, COLLAPSIBLE_MATCH.
271274
///
272275
/// The minimum rust version that the project supports. Defaults to the `rust-version` field in `Cargo.toml`
273276
#[default_text = ""]
@@ -311,7 +314,7 @@ define_Conf! {
311314
/// default configuration of Clippy. By default, any configuration will replace the default value. For example:
312315
/// * `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
313316
/// * `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.
314-
(doc_valid_idents: Vec<String> = DEFAULT_DOC_VALID_IDENTS.iter().map(ToString::to_string).collect()),
317+
(doc_valid_idents: FxHashSet<String> = DEFAULT_DOC_VALID_IDENTS.iter().map(ToString::to_string).collect()),
315318
/// Lint: TOO_MANY_ARGUMENTS.
316319
///
317320
/// The maximum number of argument a function or method can have
@@ -547,7 +550,7 @@ define_Conf! {
547550
/// Lint: PATH_ENDS_WITH_EXT.
548551
///
549552
/// Additional dotfiles (files or directories starting with a dot) to allow
550-
(allowed_dotfiles: FxHashSet<String> = FxHashSet::default()),
553+
(allowed_dotfiles: Vec<String> = Vec::default()),
551554
/// Lint: MULTIPLE_CRATE_VERSIONS.
552555
///
553556
/// A list of crate names to allow duplicates of
@@ -700,7 +703,6 @@ pub fn lookup_conf_file() -> io::Result<(Option<PathBuf>, Vec<String>)> {
700703
fn deserialize(file: &SourceFile) -> TryConf {
701704
match toml::de::Deserializer::new(file.src.as_ref().unwrap()).deserialize_map(ConfVisitor(file)) {
702705
Ok(mut conf) => {
703-
extend_vec_if_indicator_present(&mut conf.conf.doc_valid_idents, DEFAULT_DOC_VALID_IDENTS);
704706
extend_vec_if_indicator_present(&mut conf.conf.disallowed_names, DEFAULT_DISALLOWED_NAMES);
705707
extend_vec_if_indicator_present(&mut conf.conf.allowed_prefixes, DEFAULT_ALLOWED_PREFIXES);
706708
extend_vec_if_indicator_present(
@@ -713,6 +715,11 @@ fn deserialize(file: &SourceFile) -> TryConf {
713715
.allowed_idents_below_min_chars
714716
.extend(DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS.iter().map(ToString::to_string));
715717
}
718+
if conf.conf.doc_valid_idents.contains("..") {
719+
conf.conf
720+
.doc_valid_idents
721+
.extend(DEFAULT_DOC_VALID_IDENTS.iter().map(ToString::to_string));
722+
}
716723

717724
conf
718725
},

clippy_config/src/types.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ use serde::de::{self, Deserializer, Visitor};
22
use serde::{ser, Deserialize, Serialize};
33
use std::fmt;
44

5-
#[derive(Clone, Debug, Deserialize)]
5+
#[derive(Debug, Deserialize)]
66
pub struct Rename {
77
pub path: String,
88
pub rename: String,
99
}
1010

11-
#[derive(Clone, Debug, Deserialize)]
11+
#[derive(Debug, Deserialize)]
1212
#[serde(untagged)]
1313
pub enum DisallowedPath {
1414
Simple(String),
@@ -22,12 +22,10 @@ impl DisallowedPath {
2222
path
2323
}
2424

25-
pub fn reason(&self) -> Option<String> {
26-
match self {
27-
Self::WithReason {
28-
reason: Some(reason), ..
29-
} => Some(format!("{reason} (from clippy.toml)")),
30-
_ => None,
25+
pub fn reason(&self) -> Option<&str> {
26+
match &self {
27+
Self::WithReason { reason, .. } => reason.as_deref(),
28+
Self::Simple(_) => None,
3129
}
3230
}
3331
}

0 commit comments

Comments
 (0)