Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e2ecb13

Browse files
committed
rename the lint
1 parent 52cfc99 commit e2ecb13

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5155,12 +5155,12 @@ Released 2018-09-13
51555155
[`significant_drop_tightening`]: https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
51565156
[`similar_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#similar_names
51575157
[`single_char_add_str`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str
5158+
[`single_char_idents`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_char_idents
51585159
[`single_char_lifetime_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_char_lifetime_names
51595160
[`single_char_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
51605161
[`single_char_push_str`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_char_push_str
51615162
[`single_component_path_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
51625163
[`single_element_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop
5163-
[`single_letter_idents`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_letter_idents
51645164
[`single_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match
51655165
[`single_match_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
51665166
[`size_of_in_element_count`]: https://rust-lang.github.io/rust-clippy/master/index.html#size_of_in_element_count

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,9 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
565565
crate::shadow::SHADOW_SAME_INFO,
566566
crate::shadow::SHADOW_UNRELATED_INFO,
567567
crate::significant_drop_tightening::SIGNIFICANT_DROP_TIGHTENING_INFO,
568+
crate::single_char_idents::SINGLE_CHAR_IDENTS_INFO,
568569
crate::single_char_lifetime_names::SINGLE_CHAR_LIFETIME_NAMES_INFO,
569570
crate::single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS_INFO,
570-
crate::single_letter_idents::SINGLE_LETTER_IDENTS_INFO,
571571
crate::size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT_INFO,
572572
crate::size_of_ref::SIZE_OF_REF_INFO,
573573
crate::slow_vector_initialization::SLOW_VECTOR_INITIALIZATION_INFO,

clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ mod semicolon_if_nothing_returned;
284284
mod serde_api;
285285
mod shadow;
286286
mod significant_drop_tightening;
287+
mod single_char_idents;
287288
mod single_char_lifetime_names;
288289
mod single_component_path_imports;
289-
mod single_letter_idents;
290290
mod size_of_in_element_count;
291291
mod size_of_ref;
292292
mod slow_vector_initialization;
@@ -1036,7 +1036,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10361036
store.register_late_pass(|_| Box::new(needless_if::NeedlessIf));
10371037
let allowed_idents = conf.allowed_idents.clone();
10381038
store.register_early_pass(move || {
1039-
Box::new(single_letter_idents::SingleLetterIdents {
1039+
Box::new(single_char_idents::SingleCharIdents {
10401040
allowed_idents: allowed_idents.clone(),
10411041
})
10421042
});

clippy_lints/src/single_letter_idents.rs renamed to clippy_lints/src/single_char_idents.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,29 @@ declare_clippy_lint! {
2424
/// }
2525
/// ```
2626
#[clippy::version = "1.72.0"]
27-
pub SINGLE_LETTER_IDENTS,
27+
pub SINGLE_CHAR_IDENTS,
2828
restriction,
2929
"disallows idents that can be represented as a char"
3030
}
31-
impl_lint_pass!(SingleLetterIdents => [SINGLE_LETTER_IDENTS]);
31+
impl_lint_pass!(SingleCharIdents => [SINGLE_CHAR_IDENTS]);
3232

3333
#[derive(Clone)]
34-
pub struct SingleLetterIdents {
34+
pub struct SingleCharIdents {
3535
pub allowed_idents: FxHashSet<char>,
3636
}
3737

38-
impl EarlyLintPass for SingleLetterIdents {
38+
impl EarlyLintPass for SingleCharIdents {
3939
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: Ident) {
4040
let str = ident.name.as_str();
4141
let chars = str.chars();
42-
if let [char, rest @ ..] = chars.collect_vec().as_slice()
42+
if let [char, rest @ ..] = &*chars.collect_vec()
4343
&& rest.is_empty()
4444
&& self.allowed_idents.get(char).is_none()
4545
&& !in_external_macro(cx.sess(), ident.span)
4646
// Ignore proc macros. Let's implement `WithSearchPat` for early lints someday :)
4747
&& snippet(cx, ident.span, str) == str
4848
{
49-
span_lint(cx, SINGLE_LETTER_IDENTS, ident.span, "this ident comprises of a single letter");
49+
span_lint(cx, SINGLE_CHAR_IDENTS, ident.span, "this ident comprises of a single char");
5050
}
5151
}
5252
}

0 commit comments

Comments
 (0)