From d58858a0aff918760f8d855b55a38c81287dbade Mon Sep 17 00:00:00 2001 From: Jurrian Fahner Date: Thu, 15 May 2025 12:40:16 +0200 Subject: [PATCH] Add `max-ident-chars-length` to config and is set to 100 by default. --- CHANGELOG.md | 2 + book/src/lint_configuration.md | 10 +++ clippy_config/src/conf.rs | 3 + clippy_lints/src/declared_lints.rs | 3 +- .../{min_ident_chars.rs => ident_chars.rs} | 86 +++++++++++++++++- clippy_lints/src/lib.rs | 4 +- .../auxiliary/extern_types.rs | 0 .../clippy.toml | 3 + tests/ui-toml/ident_chars/max_ident_chars.rs | 15 ++++ .../ident_chars/max_ident_chars.stderr | 17 ++++ .../min_ident_chars.rs | 0 .../min_ident_chars.stderr | 16 ++-- .../toml_unknown_key/conf_unknown_key.stderr | 3 + .../ui/{min_ident_chars.rs => ident_chars.rs} | 0 ..._ident_chars.stderr => ident_chars.stderr} | 90 +++++++++---------- 15 files changed, 195 insertions(+), 57 deletions(-) rename clippy_lints/src/{min_ident_chars.rs => ident_chars.rs} (74%) rename tests/ui-toml/{min_ident_chars => ident_chars}/auxiliary/extern_types.rs (100%) rename tests/ui-toml/{min_ident_chars => ident_chars}/clippy.toml (57%) create mode 100644 tests/ui-toml/ident_chars/max_ident_chars.rs create mode 100644 tests/ui-toml/ident_chars/max_ident_chars.stderr rename tests/ui-toml/{min_ident_chars => ident_chars}/min_ident_chars.rs (100%) rename tests/ui-toml/{min_ident_chars => ident_chars}/min_ident_chars.stderr (66%) rename tests/ui/{min_ident_chars.rs => ident_chars.rs} (100%) rename tests/ui/{min_ident_chars.stderr => ident_chars.stderr} (71%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a92fbdc767bd..4dcda1b039ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6109,6 +6109,7 @@ Released 2018-09-13 [`match_str_case_mismatch`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_str_case_mismatch [`match_wild_err_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_wild_err_arm [`match_wildcard_for_single_variants`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants +[`max_ident_chars`]: https://rust-lang.github.io/rust-clippy/master/index.html#max_ident_chars [`maybe_infinite_iter`]: https://rust-lang.github.io/rust-clippy/master/index.html#maybe_infinite_iter [`maybe_misused_cfg`]: https://rust-lang.github.io/rust-clippy/master/index.html#maybe_misused_cfg [`mem_discriminant_non_enum`]: https://rust-lang.github.io/rust-clippy/master/index.html#mem_discriminant_non_enum @@ -6626,6 +6627,7 @@ Released 2018-09-13 [`literal-representation-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#literal-representation-threshold [`matches-for-let-else`]: https://doc.rust-lang.org/clippy/lint_configuration.html#matches-for-let-else [`max-fn-params-bools`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-fn-params-bools +[`max-ident-chars-length`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-ident-chars-length [`max-include-file-size`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-include-file-size [`max-struct-bools`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-struct-bools [`max-suggested-slice-pattern-length`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-suggested-slice-pattern-length diff --git a/book/src/lint_configuration.md b/book/src/lint_configuration.md index 7f16f3a98105..34e0e58f3c16 100644 --- a/book/src/lint_configuration.md +++ b/book/src/lint_configuration.md @@ -714,6 +714,16 @@ The maximum number of bool parameters a function can have * [`fn_params_excessive_bools`](https://rust-lang.github.io/rust-clippy/master/index.html#fn_params_excessive_bools) +## `max-ident-chars-length` +The maximum length of an identifier + +**Default Value:** `100` + +--- +**Affected lints:** +* [`max_ident_chars`](https://rust-lang.github.io/rust-clippy/master/index.html#max_ident_chars) + + ## `max-include-file-size` The maximum size of a file included via `include_bytes!()` or `include_str!()`, in bytes diff --git a/clippy_config/src/conf.rs b/clippy_config/src/conf.rs index 8167d75583ee..7eb093b8e5fa 100644 --- a/clippy_config/src/conf.rs +++ b/clippy_config/src/conf.rs @@ -682,6 +682,9 @@ define_Conf! { /// The maximum number of bool parameters a function can have #[lints(fn_params_excessive_bools)] max_fn_params_bools: u64 = 3, + /// The maximum length of an identifier + #[lints(max_ident_chars)] + max_ident_chars_length: u32 = 100, /// The maximum size of a file included via `include_bytes!()` or `include_str!()`, in bytes #[lints(large_include_file)] max_include_file_size: u64 = 1_000_000, diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index c3f8e02b4c06..782975a7eddf 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -198,6 +198,8 @@ pub static LINTS: &[&::declare_clippy_lint::LintInfo] = &[ crate::functions::TOO_MANY_ARGUMENTS_INFO, crate::functions::TOO_MANY_LINES_INFO, crate::future_not_send::FUTURE_NOT_SEND_INFO, + crate::ident_chars::MAX_IDENT_CHARS_INFO, + crate::ident_chars::MIN_IDENT_CHARS_INFO, crate::if_let_mutex::IF_LET_MUTEX_INFO, crate::if_not_else::IF_NOT_ELSE_INFO, crate::if_then_some_else_none::IF_THEN_SOME_ELSE_NONE_INFO, @@ -497,7 +499,6 @@ pub static LINTS: &[&::declare_clippy_lint::LintInfo] = &[ crate::methods::WAKER_CLONE_WAKE_INFO, crate::methods::WRONG_SELF_CONVENTION_INFO, crate::methods::ZST_OFFSET_INFO, - crate::min_ident_chars::MIN_IDENT_CHARS_INFO, crate::minmax::MIN_MAX_INFO, crate::misc::SHORT_CIRCUIT_STATEMENT_INFO, crate::misc::TOPLEVEL_REF_ARG_INFO, diff --git a/clippy_lints/src/min_ident_chars.rs b/clippy_lints/src/ident_chars.rs similarity index 74% rename from clippy_lints/src/min_ident_chars.rs rename to clippy_lints/src/ident_chars.rs index dbce29a86318..b446821f5494 100644 --- a/clippy_lints/src/min_ident_chars.rs +++ b/clippy_lints/src/ident_chars.rs @@ -45,11 +45,46 @@ declare_clippy_lint! { restriction, "disallows idents that are too short" } -impl_lint_pass!(MinIdentChars => [MIN_IDENT_CHARS]); +declare_clippy_lint! { + /// ### What it does + /// Checks for identifiers which are too long (higher than the configured threshold). + /// Note: This lint can be very noisy when enabled; it may be desirable to only enable it + /// temporarily. + /// + /// ### Why restrict this? + /// To improve readability of code and make it possible to enforce this lint to align a code + /// style on this subject within a team. + /// + /// ### Example of long identifiers + /// ```rust,ignore + /// for from_a_long_list_of_movies_which_might_contain_ferris_or_not_you_never_know in movies { + /// let title = from_a_long_list_of_movies_which_might_contain_ferris_or_not_you_never_know.title; + /// } + /// ``` + /// Use instead: + /// ```rust,ignore + /// for movie in movies { + /// let title = movie.title; + /// } + /// ``` + /// + /// ### Limitations + /// Trait implementations which use the same function or parameter name as the trait declaration will + /// not be warned about, even if the name is longer than the configured limit. + #[clippy::version = "1.92.0"] + pub MAX_IDENT_CHARS, + restriction, + "disallows idents which exceeding the max ident length" +} + +impl_lint_pass!(MinIdentChars => [MIN_IDENT_CHARS, MAX_IDENT_CHARS]); + +#[allow(clippy::struct_field_names)] pub struct MinIdentChars { allowed_idents_below_min_chars: FxHashSet, min_ident_chars_threshold: u64, + max_variable_name_length: u32, } impl MinIdentChars { @@ -57,6 +92,7 @@ impl MinIdentChars { Self { allowed_idents_below_min_chars: conf.allowed_idents_below_min_chars.iter().cloned().collect(), min_ident_chars_threshold: conf.min_ident_chars_threshold, + max_variable_name_length: conf.max_ident_chars_length, } } @@ -68,6 +104,10 @@ impl MinIdentChars { && !str.is_empty() && !self.allowed_idents_below_min_chars.contains(str) } + + fn is_ident_too_long(&self, cx: &LateContext<'_>, str: &str, span: Span) -> bool { + !span.in_external_macro(cx.sess().source_map()) && str.len() > self.max_variable_name_length as usize + } } impl LateLintPass<'_> for MinIdentChars { @@ -108,6 +148,13 @@ impl LateLintPass<'_> for MinIdentChars { { emit_min_ident_chars(self, cx, str, ident.span); } + + if let PatKind::Binding(_, _, ident, ..) = pat.kind + && let str = ident.as_str() + && self.is_ident_too_long(cx, str, ident.span) + { + emit_max_ident_chars(self, cx, str, ident.span); + } } } @@ -199,6 +246,34 @@ impl Visitor<'_> for IdentVisitor<'_, '_> { emit_min_ident_chars(conf, cx, str, ident.span); } + + if conf.is_ident_too_long(cx, str, ident.span) { + // Check whether the node is part of a `use` statement. We don't want to emit a warning if the user + // has no control over the type. + let usenode = opt_as_use_node(node).or_else(|| { + cx.tcx + .hir_parent_iter(hir_id) + .find_map(|(_, node)| opt_as_use_node(node)) + }); + + // If the name of the identifier is the same as the one of the imported item, this means that we + // found a `use foo::bar`. We can early-return to not emit the warning. + // If however the identifier is different, this means it is an alias (`use foo::bar as baz`). In + // this case, we need to emit the warning for `baz`. + if let Some(imported_item_path) = usenode + // use `present_items` because it could be in any of type_ns, value_ns, macro_ns + && let Some(Res::Def(_, imported_item_defid)) = imported_item_path.res.value_ns + && cx.tcx.item_name(imported_item_defid).as_str() == str + { + return; + } + + if is_from_proc_macro(cx, &ident) { + return; + } + + emit_min_ident_chars(conf, cx, str, ident.span); + } } } @@ -215,6 +290,15 @@ fn emit_min_ident_chars(conf: &MinIdentChars, cx: &impl LintContext, ident: &str span_lint(cx, MIN_IDENT_CHARS, span, help); } +fn emit_max_ident_chars(conf: &MinIdentChars, cx: &impl LintContext, ident: &str, span: Span) { + let help = Cow::Owned(format!( + "this ident is too long ({} > {})", + ident.len(), + conf.max_variable_name_length, + )); + span_lint(cx, MAX_IDENT_CHARS, span, help); +} + /// Attempt to convert the node to an [`ItemKind::Use`] node. /// /// If it is, return the [`UsePath`] contained within. diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 792acec9e527..ddbd456463e4 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -155,6 +155,7 @@ mod from_raw_with_void_ptr; mod from_str_radix_10; mod functions; mod future_not_send; +mod ident_chars; mod if_let_mutex; mod if_not_else; mod if_then_some_else_none; @@ -232,7 +233,6 @@ mod match_result_ok; mod matches; mod mem_replace; mod methods; -mod min_ident_chars; mod minmax; mod misc; mod misc_early; @@ -761,7 +761,7 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co store.register_late_pass(|_| Box::new(redundant_type_annotations::RedundantTypeAnnotations)); store.register_late_pass(|_| Box::new(arc_with_non_send_sync::ArcWithNonSendSync)); store.register_late_pass(|_| Box::new(needless_if::NeedlessIf)); - store.register_late_pass(move |_| Box::new(min_ident_chars::MinIdentChars::new(conf))); + store.register_late_pass(move |_| Box::new(ident_chars::MinIdentChars::new(conf))); store.register_late_pass(move |_| Box::new(large_stack_frames::LargeStackFrames::new(conf))); store.register_late_pass(|_| Box::new(single_range_in_vec_init::SingleRangeInVecInit)); store.register_late_pass(move |_| Box::new(needless_pass_by_ref_mut::NeedlessPassByRefMut::new(conf))); diff --git a/tests/ui-toml/min_ident_chars/auxiliary/extern_types.rs b/tests/ui-toml/ident_chars/auxiliary/extern_types.rs similarity index 100% rename from tests/ui-toml/min_ident_chars/auxiliary/extern_types.rs rename to tests/ui-toml/ident_chars/auxiliary/extern_types.rs diff --git a/tests/ui-toml/min_ident_chars/clippy.toml b/tests/ui-toml/ident_chars/clippy.toml similarity index 57% rename from tests/ui-toml/min_ident_chars/clippy.toml rename to tests/ui-toml/ident_chars/clippy.toml index 0114ca750143..de5016b95e5b 100644 --- a/tests/ui-toml/min_ident_chars/clippy.toml +++ b/tests/ui-toml/ident_chars/clippy.toml @@ -1,2 +1,5 @@ allowed-idents-below-min-chars = ["Owo", "Uwu", "wha", "t_e", "lse", "_do", "_i_", "put", "her", "_e"] min-ident-chars-threshold = 3 + +# override the default length of variables to test the configuration +max-ident-chars-length = 50 diff --git a/tests/ui-toml/ident_chars/max_ident_chars.rs b/tests/ui-toml/ident_chars/max_ident_chars.rs new file mode 100644 index 000000000000..9c5960848c74 --- /dev/null +++ b/tests/ui-toml/ident_chars/max_ident_chars.rs @@ -0,0 +1,15 @@ +#![warn(clippy::max_ident_chars)] + +fn a_function(ferris_singlehandedly_refactored_the_monolith_while_juggling_crates_and_lifetimes: &str) { + //~^ max_ident_chars +} + +fn another_function(just_a_short_name: &str) { + // should not cause a problem +} + +fn main() { + // `ferris_singlehandedly_refactored_the_monolith_while_juggling_crates_and_lifetimes` is too long + let ferris_singlehandedly_refactored_the_monolith_while_juggling_crates_and_lifetimes = "very long indeed"; + //~^ max_ident_chars +} diff --git a/tests/ui-toml/ident_chars/max_ident_chars.stderr b/tests/ui-toml/ident_chars/max_ident_chars.stderr new file mode 100644 index 000000000000..06aacca84ada --- /dev/null +++ b/tests/ui-toml/ident_chars/max_ident_chars.stderr @@ -0,0 +1,17 @@ +error: this ident is too long (81 > 50) + --> tests/ui-toml/ident_chars/max_ident_chars.rs:3:15 + | +LL | fn a_function(ferris_singlehandedly_refactored_the_monolith_while_juggling_crates_and_lifetimes: &str) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::max-ident-chars` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::max_ident_chars)]` + +error: this ident is too long (81 > 50) + --> tests/ui-toml/ident_chars/max_ident_chars.rs:13:9 + | +LL | let ferris_singlehandedly_refactored_the_monolith_while_juggling_crates_and_lifetimes = "very long indeed"; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui-toml/min_ident_chars/min_ident_chars.rs b/tests/ui-toml/ident_chars/min_ident_chars.rs similarity index 100% rename from tests/ui-toml/min_ident_chars/min_ident_chars.rs rename to tests/ui-toml/ident_chars/min_ident_chars.rs diff --git a/tests/ui-toml/min_ident_chars/min_ident_chars.stderr b/tests/ui-toml/ident_chars/min_ident_chars.stderr similarity index 66% rename from tests/ui-toml/min_ident_chars/min_ident_chars.stderr rename to tests/ui-toml/ident_chars/min_ident_chars.stderr index be795f4daff2..629251770413 100644 --- a/tests/ui-toml/min_ident_chars/min_ident_chars.stderr +++ b/tests/ui-toml/ident_chars/min_ident_chars.stderr @@ -1,5 +1,5 @@ error: this ident is too short (1 <= 3) - --> tests/ui-toml/min_ident_chars/min_ident_chars.rs:6:41 + --> tests/ui-toml/ident_chars/min_ident_chars.rs:6:41 | LL | use extern_types::{Aaa, LONGER, M, N as W}; | ^ @@ -8,43 +8,43 @@ LL | use extern_types::{Aaa, LONGER, M, N as W}; = help: to override `-D warnings` add `#[allow(clippy::min_ident_chars)]` error: this ident is too short (1 <= 3) - --> tests/ui-toml/min_ident_chars/min_ident_chars.rs:9:11 + --> tests/ui-toml/ident_chars/min_ident_chars.rs:9:11 | LL | pub const N: u32 = 0; | ^ error: this ident is too short (3 <= 3) - --> tests/ui-toml/min_ident_chars/min_ident_chars.rs:15:5 + --> tests/ui-toml/ident_chars/min_ident_chars.rs:15:5 | LL | aaa: Aaa, | ^^^ error: this ident is too short (3 <= 3) - --> tests/ui-toml/min_ident_chars/min_ident_chars.rs:21:9 + --> tests/ui-toml/ident_chars/min_ident_chars.rs:21:9 | LL | let vvv = 1; | ^^^ error: this ident is too short (3 <= 3) - --> tests/ui-toml/min_ident_chars/min_ident_chars.rs:23:9 + --> tests/ui-toml/ident_chars/min_ident_chars.rs:23:9 | LL | let uuu = 1; | ^^^ error: this ident is too short (1 <= 3) - --> tests/ui-toml/min_ident_chars/min_ident_chars.rs:25:14 + --> tests/ui-toml/ident_chars/min_ident_chars.rs:25:14 | LL | let (mut a, mut b) = (1, 2); | ^ error: this ident is too short (1 <= 3) - --> tests/ui-toml/min_ident_chars/min_ident_chars.rs:25:21 + --> tests/ui-toml/ident_chars/min_ident_chars.rs:25:21 | LL | let (mut a, mut b) = (1, 2); | ^ error: this ident is too short (1 <= 3) - --> tests/ui-toml/min_ident_chars/min_ident_chars.rs:28:9 + --> tests/ui-toml/ident_chars/min_ident_chars.rs:28:9 | LL | for i in 0..1000 {} | ^ diff --git a/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr b/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr index 6ee77ebd8ece..357c6d5fb702 100644 --- a/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr +++ b/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr @@ -53,6 +53,7 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect literal-representation-threshold matches-for-let-else max-fn-params-bools + max-ident-chars-length max-include-file-size max-struct-bools max-suggested-slice-pattern-length @@ -147,6 +148,7 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect literal-representation-threshold matches-for-let-else max-fn-params-bools + max-ident-chars-length max-include-file-size max-struct-bools max-suggested-slice-pattern-length @@ -241,6 +243,7 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni literal-representation-threshold matches-for-let-else max-fn-params-bools + max-ident-chars-length max-include-file-size max-struct-bools max-suggested-slice-pattern-length diff --git a/tests/ui/min_ident_chars.rs b/tests/ui/ident_chars.rs similarity index 100% rename from tests/ui/min_ident_chars.rs rename to tests/ui/ident_chars.rs diff --git a/tests/ui/min_ident_chars.stderr b/tests/ui/ident_chars.stderr similarity index 71% rename from tests/ui/min_ident_chars.stderr rename to tests/ui/ident_chars.stderr index 36bf89e79f00..0397862b3488 100644 --- a/tests/ui/min_ident_chars.stderr +++ b/tests/ui/ident_chars.stderr @@ -1,5 +1,5 @@ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:9:8 + --> tests/ui/ident_chars.rs:9:8 | LL | struct A { | ^ @@ -8,265 +8,265 @@ LL | struct A { = help: to override `-D warnings` add `#[allow(clippy::min_ident_chars)]` error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:11:5 + --> tests/ui/ident_chars.rs:11:5 | LL | a: u32, | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:14:5 + --> tests/ui/ident_chars.rs:14:5 | LL | A: u32, | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:16:5 + --> tests/ui/ident_chars.rs:16:5 | LL | I: u32, | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:20:8 + --> tests/ui/ident_chars.rs:20:8 | LL | struct B(u32); | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:23:8 + --> tests/ui/ident_chars.rs:23:8 | LL | struct O { | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:25:5 + --> tests/ui/ident_chars.rs:25:5 | LL | o: u32, | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:31:6 + --> tests/ui/ident_chars.rs:31:6 | LL | enum C { | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:33:5 + --> tests/ui/ident_chars.rs:33:5 | LL | D, | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:35:5 + --> tests/ui/ident_chars.rs:35:5 | LL | E, | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:37:5 + --> tests/ui/ident_chars.rs:37:5 | LL | F, | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:52:11 + --> tests/ui/ident_chars.rs:52:11 | LL | const A: u32 = 0; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:54:10 + --> tests/ui/ident_chars.rs:54:10 | LL | type A; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:56:8 + --> tests/ui/ident_chars.rs:56:8 | LL | fn a() {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:71:9 + --> tests/ui/ident_chars.rs:71:9 | LL | let h = 1; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:73:9 + --> tests/ui/ident_chars.rs:73:9 | LL | let e = 2; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:75:9 + --> tests/ui/ident_chars.rs:75:9 | LL | let l = 3; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:77:9 + --> tests/ui/ident_chars.rs:77:9 | LL | let l = 4; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:79:9 + --> tests/ui/ident_chars.rs:79:9 | LL | let o = 6; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:84:10 + --> tests/ui/ident_chars.rs:84:10 | LL | let (h, o, w) = (1, 2, 3); | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:84:13 + --> tests/ui/ident_chars.rs:84:13 | LL | let (h, o, w) = (1, 2, 3); | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:87:10 + --> tests/ui/ident_chars.rs:87:10 | LL | for (a, (r, e)) in (0..1000).enumerate().enumerate() {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:87:14 + --> tests/ui/ident_chars.rs:87:14 | LL | for (a, (r, e)) in (0..1000).enumerate().enumerate() {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:87:17 + --> tests/ui/ident_chars.rs:87:17 | LL | for (a, (r, e)) in (0..1000).enumerate().enumerate() {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:92:16 + --> tests/ui/ident_chars.rs:92:16 | LL | while let (d, o, _i, n, g) = (true, true, false, false, true) {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:92:19 + --> tests/ui/ident_chars.rs:92:19 | LL | while let (d, o, _i, n, g) = (true, true, false, false, true) {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:92:29 + --> tests/ui/ident_chars.rs:92:29 | LL | while let (d, o, _i, n, g) = (true, true, false, false, true) {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:99:9 + --> tests/ui/ident_chars.rs:99:9 | LL | let o = 1; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:101:9 + --> tests/ui/ident_chars.rs:101:9 | LL | let o = O { o }; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:116:4 + --> tests/ui/ident_chars.rs:116:4 | LL | fn b() {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:118:21 + --> tests/ui/ident_chars.rs:118:21 | LL | fn wrong_pythagoras(a: f32, b: f32) -> f32 { | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:118:29 + --> tests/ui/ident_chars.rs:118:29 | LL | fn wrong_pythagoras(a: f32, b: f32) -> f32 { | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:137:19 + --> tests/ui/ident_chars.rs:137:19 | LL | fn fmt(&self, g: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:144:14 + --> tests/ui/ident_chars.rs:144:14 | LL | let a = |f: i8| f; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:144:9 + --> tests/ui/ident_chars.rs:144:9 | LL | let a = |f: i8| f; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:149:7 + --> tests/ui/ident_chars.rs:149:7 | LL | trait D { | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:151:10 + --> tests/ui/ident_chars.rs:151:10 | LL | fn f(g: i32); | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:151:8 + --> tests/ui/ident_chars.rs:151:8 | LL | fn f(g: i32); | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:156:8 + --> tests/ui/ident_chars.rs:156:8 | LL | fn g(arg: i8) { | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:158:12 + --> tests/ui/ident_chars.rs:158:12 | LL | fn c(d: u8) {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:158:14 + --> tests/ui/ident_chars.rs:158:14 | LL | fn c(d: u8) {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:166:12 + --> tests/ui/ident_chars.rs:166:12 | LL | fn h() {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:168:18 + --> tests/ui/ident_chars.rs:168:18 | LL | fn inner(a: i32) {} | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:170:18 + --> tests/ui/ident_chars.rs:170:18 | LL | let a = |f: String| f; | ^ error: this ident consists of a single char - --> tests/ui/min_ident_chars.rs:170:13 + --> tests/ui/ident_chars.rs:170:13 | LL | let a = |f: String| f; | ^