From 758d0e8661fd757ed12a07959eae142c695500ed Mon Sep 17 00:00:00 2001 From: J-ZhengLi Date: Tue, 28 Nov 2023 10:28:55 +0800 Subject: [PATCH] change name to [`infinite_loop`]; & apply review suggestions; --- CHANGELOG.md | 2 +- clippy_lints/src/declared_lints.rs | 2 +- .../{infinite_loops.rs => infinite_loop.rs} | 11 +++----- clippy_lints/src/loops/mod.rs | 12 ++++----- tests/ui/infinite_loops.rs | 8 +++++- tests/ui/infinite_loops.stderr | 26 +++++++++++-------- 6 files changed, 34 insertions(+), 27 deletions(-) rename clippy_lints/src/loops/{infinite_loops.rs => infinite_loop.rs} (91%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c62cf515..924d346a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5147,7 +5147,7 @@ Released 2018-09-13 [`inefficient_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string [`infallible_destructuring_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#infallible_destructuring_match [`infinite_iter`]: https://rust-lang.github.io/rust-clippy/master/index.html#infinite_iter -[`infinite_loops`]: https://rust-lang.github.io/rust-clippy/master/index.html#infinite_loops +[`infinite_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#infinite_loop [`inherent_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string [`inherent_to_string_shadow_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string_shadow_display [`init_numbered_fields`]: https://rust-lang.github.io/rust-clippy/master/index.html#init_numbered_fields diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index 7520b5789..6422c6cc6 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -263,7 +263,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::loops::EXPLICIT_INTO_ITER_LOOP_INFO, crate::loops::EXPLICIT_ITER_LOOP_INFO, crate::loops::FOR_KV_MAP_INFO, - crate::loops::INFINITE_LOOPS_INFO, + crate::loops::INFINITE_LOOP_INFO, crate::loops::ITER_NEXT_LOOP_INFO, crate::loops::MANUAL_FIND_INFO, crate::loops::MANUAL_FLATTEN_INFO, diff --git a/clippy_lints/src/loops/infinite_loops.rs b/clippy_lints/src/loops/infinite_loop.rs similarity index 91% rename from clippy_lints/src/loops/infinite_loops.rs rename to clippy_lints/src/loops/infinite_loop.rs index 5e474bf45..9b88dd76e 100644 --- a/clippy_lints/src/loops/infinite_loops.rs +++ b/clippy_lints/src/loops/infinite_loop.rs @@ -7,7 +7,7 @@ use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::LateContext; -use super::INFINITE_LOOPS; +use super::INFINITE_LOOP; pub(super) fn check<'tcx>( cx: &LateContext<'tcx>, @@ -15,7 +15,7 @@ pub(super) fn check<'tcx>( loop_block: &'tcx hir::Block<'_>, label: Option