Skip to content

Commit 25171f2

Browse files
committed
add manual_pop_if lint
Add a lint to detect when the recently added Vec::pop_if, VecDeque::pop_front_if, and VecDeque::pop_back_if are manually implemented. changelog: add [`manual_pop_if`] lint
1 parent e645f93 commit 25171f2

File tree

9 files changed

+1211
-0
lines changed

9 files changed

+1211
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6705,6 +6705,7 @@ Released 2018-09-13
67056705
[`manual_ok_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_or
67066706
[`manual_option_as_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_option_as_slice
67076707
[`manual_pattern_char_comparison`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_pattern_char_comparison
6708+
[`manual_pop_if`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_pop_if
67086709
[`manual_range_contains`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
67096710
[`manual_range_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_patterns
67106711
[`manual_rem_euclid`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rem_euclid

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ pub static LINTS: &[&::declare_clippy_lint::LintInfo] = &[
312312
crate::manual_main_separator_str::MANUAL_MAIN_SEPARATOR_STR_INFO,
313313
crate::manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE_INFO,
314314
crate::manual_option_as_slice::MANUAL_OPTION_AS_SLICE_INFO,
315+
crate::manual_pop_if::MANUAL_POP_IF_INFO,
315316
crate::manual_range_patterns::MANUAL_RANGE_PATTERNS_INFO,
316317
crate::manual_rem_euclid::MANUAL_REM_EUCLID_INFO,
317318
crate::manual_retain::MANUAL_RETAIN_INFO,

clippy_lints/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ mod manual_let_else;
211211
mod manual_main_separator_str;
212212
mod manual_non_exhaustive;
213213
mod manual_option_as_slice;
214+
mod manual_pop_if;
214215
mod manual_range_patterns;
215216
mod manual_rem_euclid;
216217
mod manual_retain;
@@ -864,6 +865,7 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co
864865
Box::new(move |tcx| Box::new(duration_suboptimal_units::DurationSuboptimalUnits::new(tcx, conf))),
865866
Box::new(move |_| Box::new(manual_take::ManualTake::new(conf))),
866867
Box::new(|_| Box::new(manual_checked_ops::ManualCheckedOps)),
868+
Box::new(move |_| Box::new(manual_pop_if::ManualPopIf::new(conf))),
867869
// add late passes here, used by `cargo dev new_lint`
868870
];
869871
store.late_passes.extend(late_lints);

0 commit comments

Comments
 (0)