Skip to content
/ rust Public
forked from rust-lang/rust

Commit c200dad

Browse files
committed
Merge remote-tracking branch 'upstream/master' into rustup
2 parents 2701a41 + caad063 commit c200dad

File tree

124 files changed

+3781
-1135
lines changed

Some content is hidden

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

124 files changed

+3781
-1135
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5249,6 +5249,7 @@ Released 2018-09-13
52495249
[`disallowed_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_type
52505250
[`disallowed_types`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
52515251
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
5252+
[`doc_lazy_continuation`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
52525253
[`doc_link_with_quotes`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes
52535254
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
52545255
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
@@ -5447,6 +5448,7 @@ Released 2018-09-13
54475448
[`little_endian_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#little_endian_bytes
54485449
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
54495450
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
5451+
[`macro_metavars_in_unsafe`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_metavars_in_unsafe
54505452
[`macro_use_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_use_imports
54515453
[`main_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#main_recursion
54525454
[`manual_assert`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
@@ -5702,6 +5704,7 @@ Released 2018-09-13
57025704
[`ref_option_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_option_ref
57035705
[`ref_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_patterns
57045706
[`regex_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_macro
5707+
[`renamed_function_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#renamed_function_params
57055708
[`repeat_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#repeat_once
57065709
[`repeat_vec_with_capacity`]: https://rust-lang.github.io/rust-clippy/master/index.html#repeat_vec_with_capacity
57075710
[`replace_consts`]: https://rust-lang.github.io/rust-clippy/master/index.html#replace_consts
@@ -5941,6 +5944,7 @@ Released 2018-09-13
59415944
[`allow-one-hash-in-raw-strings`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-one-hash-in-raw-strings
59425945
[`allow-print-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-print-in-tests
59435946
[`allow-private-module-inception`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-private-module-inception
5947+
[`allow-renamed-params-for`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-renamed-params-for
59445948
[`allow-unwrap-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-unwrap-in-tests
59455949
[`allow-useless-vec-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-useless-vec-in-tests
59465950
[`allowed-dotfiles`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-dotfiles
@@ -6002,4 +6006,5 @@ Released 2018-09-13
60026006
[`vec-box-size-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#vec-box-size-threshold
60036007
[`verbose-bit-mask-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#verbose-bit-mask-threshold
60046008
[`warn-on-all-wildcard-imports`]: https://doc.rust-lang.org/clippy/lint_configuration.html#warn-on-all-wildcard-imports
6009+
[`warn-unsafe-macro-metavars-in-private-macros`]: https://doc.rust-lang.org/clippy/lint_configuration.html#warn-unsafe-macro-metavars-in-private-macros
60056010
<!-- end autogenerated links to configuration documentation -->

book/src/lint_configuration.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,28 @@ Whether to allow module inception if it's not public.
122122
* [`module_inception`](https://rust-lang.github.io/rust-clippy/master/index.html#module_inception)
123123

124124

125+
## `allow-renamed-params-for`
126+
List of trait paths to ignore when checking renamed function parameters.
127+
128+
#### Example
129+
130+
```toml
131+
allow-renamed-params-for = [ "std::convert::From" ]
132+
```
133+
134+
#### Noteworthy
135+
136+
- By default, the following traits are ignored: `From`, `TryFrom`, `FromStr`
137+
- `".."` can be used as part of the list to indicate that the configured values should be appended to the
138+
default configuration of Clippy. By default, any configuration will replace the default value.
139+
140+
**Default Value:** `["core::convert::From", "core::convert::TryFrom", "core::str::FromStr"]`
141+
142+
---
143+
**Affected lints:**
144+
* [`renamed_function_params`](https://rust-lang.github.io/rust-clippy/master/index.html#renamed_function_params)
145+
146+
125147
## `allow-unwrap-in-tests`
126148
Whether `unwrap` should be allowed in test functions or `#[cfg(test)]`
127149

@@ -900,3 +922,13 @@ Whether to allow certain wildcard imports (prelude, super in tests).
900922
* [`wildcard_imports`](https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports)
901923

902924

925+
## `warn-unsafe-macro-metavars-in-private-macros`
926+
Whether to also emit warnings for unsafe blocks with metavariable expansions in **private** macros.
927+
928+
**Default Value:** `false`
929+
930+
---
931+
**Affected lints:**
932+
* [`macro_metavars_in_unsafe`](https://rust-lang.github.io/rust-clippy/master/index.html#macro_metavars_in_unsafe)
933+
934+

clippy_config/src/conf.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const DEFAULT_DOC_VALID_IDENTS: &[&str] = &[
4040
const DEFAULT_DISALLOWED_NAMES: &[&str] = &["foo", "baz", "quux"];
4141
const DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS: &[&str] = &["i", "j", "x", "y", "z", "w", "n"];
4242
const DEFAULT_ALLOWED_PREFIXES: &[&str] = &["to", "as", "into", "from", "try_into", "try_from"];
43+
const DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS: &[&str] =
44+
&["core::convert::From", "core::convert::TryFrom", "core::str::FromStr"];
4345

4446
/// Conf with parse errors
4547
#[derive(Default)]
@@ -613,6 +615,27 @@ define_Conf! {
613615
/// - Use `".."` as part of the list to indicate that the configured values should be appended to the
614616
/// default configuration of Clippy. By default, any configuration will replace the default value
615617
(allowed_prefixes: Vec<String> = DEFAULT_ALLOWED_PREFIXES.iter().map(ToString::to_string).collect()),
618+
/// Lint: RENAMED_FUNCTION_PARAMS.
619+
///
620+
/// List of trait paths to ignore when checking renamed function parameters.
621+
///
622+
/// #### Example
623+
///
624+
/// ```toml
625+
/// allow-renamed-params-for = [ "std::convert::From" ]
626+
/// ```
627+
///
628+
/// #### Noteworthy
629+
///
630+
/// - By default, the following traits are ignored: `From`, `TryFrom`, `FromStr`
631+
/// - `".."` can be used as part of the list to indicate that the configured values should be appended to the
632+
/// default configuration of Clippy. By default, any configuration will replace the default value.
633+
(allow_renamed_params_for: Vec<String> =
634+
DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS.iter().map(ToString::to_string).collect()),
635+
/// Lint: MACRO_METAVARS_IN_UNSAFE.
636+
///
637+
/// Whether to also emit warnings for unsafe blocks with metavariable expansions in **private** macros.
638+
(warn_unsafe_macro_metavars_in_private_macros: bool = false),
616639
}
617640

618641
/// Search for the configuration file.
@@ -674,6 +697,10 @@ fn deserialize(file: &SourceFile) -> TryConf {
674697
extend_vec_if_indicator_present(&mut conf.conf.doc_valid_idents, DEFAULT_DOC_VALID_IDENTS);
675698
extend_vec_if_indicator_present(&mut conf.conf.disallowed_names, DEFAULT_DISALLOWED_NAMES);
676699
extend_vec_if_indicator_present(&mut conf.conf.allowed_prefixes, DEFAULT_ALLOWED_PREFIXES);
700+
extend_vec_if_indicator_present(
701+
&mut conf.conf.allow_renamed_params_for,
702+
DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS,
703+
);
677704
// TODO: THIS SHOULD BE TESTED, this comment will be gone soon
678705
if conf.conf.allowed_idents_below_min_chars.contains("..") {
679706
conf.conf

clippy_config/src/msrvs.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ msrv_aliases! {
2626
1,63,0 { CLONE_INTO }
2727
1,62,0 { BOOL_THEN_SOME, DEFAULT_ENUM_ATTRIBUTE }
2828
1,59,0 { THREAD_LOCAL_INITIALIZER_CAN_BE_MADE_CONST }
29-
1,58,0 { FORMAT_ARGS_CAPTURE, PATTERN_TRAIT_CHAR_ARRAY }
29+
1,58,0 { FORMAT_ARGS_CAPTURE, PATTERN_TRAIT_CHAR_ARRAY, CONST_RAW_PTR_DEREF }
30+
1,56,0 { CONST_FN_UNION }
3031
1,55,0 { SEEK_REWIND }
3132
1,54,0 { INTO_KEYS }
3233
1,53,0 { OR_PATTERNS, MANUAL_BITS, BTREE_MAP_RETAIN, BTREE_SET_RETAIN, ARRAY_INTO_ITERATOR }

clippy_dev/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "clippy_dev"
3+
description = "Clippy developer tooling"
34
version = "0.0.1"
45
edition = "2021"
56

67
[dependencies]
78
aho-corasick = "1.0"
8-
clap = "4.1.4"
9+
clap = { version = "4.4", features = ["derive"] }
910
indoc = "1.0"
1011
itertools = "0.12"
1112
opener = "0.6"

0 commit comments

Comments
 (0)