Skip to content

Commit c1d5108

Browse files
committed
rename contains_for_slice to slice_iter_any
1 parent c52ebf2 commit c1d5108

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5455,7 +5455,6 @@ Released 2018-09-13
54555455
[`comparison_to_empty`]: https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
54565456
[`const_is_empty`]: https://rust-lang.github.io/rust-clippy/master/index.html#const_is_empty
54575457
[`const_static_lifetime`]: https://rust-lang.github.io/rust-clippy/master/index.html#const_static_lifetime
5458-
[`contains_for_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#contains_for_slice
54595458
[`copy_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#copy_iterator
54605459
[`crate_in_macro_def`]: https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
54615460
[`create_dir`]: https://rust-lang.github.io/rust-clippy/master/index.html#create_dir
@@ -6021,6 +6020,7 @@ Released 2018-09-13
60216020
[`size_of_in_element_count`]: https://rust-lang.github.io/rust-clippy/master/index.html#size_of_in_element_count
60226021
[`size_of_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#size_of_ref
60236022
[`skip_while_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#skip_while_next
6023+
[`slice_iter_any`]: https://rust-lang.github.io/rust-clippy/master/index.html#slice_iter_any
60246024
[`slow_vector_initialization`]: https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization
60256025
[`stable_sort_primitive`]: https://rust-lang.github.io/rust-clippy/master/index.html#stable_sort_primitive
60266026
[`std_instead_of_alloc`]: https://rust-lang.github.io/rust-clippy/master/index.html#std_instead_of_alloc

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ pub static LINTS: &[&crate::LintInfo] = &[
371371
crate::methods::CLONE_ON_REF_PTR_INFO,
372372
crate::methods::COLLAPSIBLE_STR_REPLACE_INFO,
373373
crate::methods::CONST_IS_EMPTY_INFO,
374-
crate::methods::CONTAINS_FOR_SLICE_INFO,
375374
crate::methods::DRAIN_COLLECT_INFO,
376375
crate::methods::ERR_EXPECT_INFO,
377376
crate::methods::EXPECT_FUN_CALL_INFO,
@@ -465,6 +464,7 @@ pub static LINTS: &[&crate::LintInfo] = &[
465464
crate::methods::SHOULD_IMPLEMENT_TRAIT_INFO,
466465
crate::methods::SINGLE_CHAR_ADD_STR_INFO,
467466
crate::methods::SKIP_WHILE_NEXT_INFO,
467+
crate::methods::SLICE_ITER_ANY_INFO,
468468
crate::methods::STABLE_SORT_PRIMITIVE_INFO,
469469
crate::methods::STRING_EXTEND_CHARS_INFO,
470470
crate::methods::STRING_LIT_CHARS_ANY_INFO,

clippy_lints/src/methods/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ mod clone_on_copy;
1414
mod clone_on_ref_ptr;
1515
mod cloned_instead_of_copied;
1616
mod collapsible_str_replace;
17-
mod contains_for_slice;
1817
mod drain_collect;
1918
mod err_expect;
2019
mod expect_fun_call;
@@ -101,6 +100,7 @@ mod single_char_add_str;
101100
mod single_char_insert_string;
102101
mod single_char_push_string;
103102
mod skip_while_next;
103+
mod slice_iter_any;
104104
mod stable_sort_primitive;
105105
mod str_split;
106106
mod str_splitn;
@@ -4305,7 +4305,7 @@ declare_clippy_lint! {
43054305
/// }
43064306
/// ```
43074307
#[clippy::version = "1.85.0"]
4308-
pub CONTAINS_FOR_SLICE,
4308+
pub SLICE_ITER_ANY,
43094309
perf,
43104310
"using `contains()` instead of `iter().any()` on u8/i8 slices is more efficient"
43114311
}
@@ -4475,7 +4475,7 @@ impl_lint_pass!(Methods => [
44754475
MAP_ALL_ANY_IDENTITY,
44764476
MAP_WITH_UNUSED_ARGUMENT_OVER_RANGES,
44774477
UNNECESSARY_MAP_OR,
4478-
CONTAINS_FOR_SLICE,
4478+
SLICE_ITER_ANY,
44794479
]);
44804480

44814481
/// Extracts a method call name, args, and `Span` of the method name.
@@ -4710,7 +4710,7 @@ impl Methods {
47104710
("any", [arg]) => {
47114711
unused_enumerate_index::check(cx, expr, recv, arg);
47124712
needless_character_iteration::check(cx, expr, recv, arg, false);
4713-
contains_for_slice::check(cx, expr);
4713+
slice_iter_any::check(cx, expr);
47144714
match method_call(recv) {
47154715
Some(("cloned", recv2, [], _, _)) => iter_overeager_cloned::check(
47164716
cx,

clippy_lints/src/methods/contains_for_slice.rs renamed to clippy_lints/src/methods/slice_iter_any.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_hir::{Expr, ExprKind};
33
use rustc_lint::LateContext;
44
use rustc_middle::ty::{self};
55

6-
use super::{CONTAINS_FOR_SLICE, method_call};
6+
use super::{SLICE_ITER_ANY, method_call};
77

88
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
99
if !expr.span.from_expansion()
@@ -31,7 +31,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
3131
{
3232
span_lint(
3333
cx,
34-
CONTAINS_FOR_SLICE,
34+
SLICE_ITER_ANY,
3535
expr.span,
3636
"using `contains()` instead of `iter().any()` on u8/i8 slices is more efficient",
3737
);

tests/ui/contains_for_slice.rs renamed to tests/ui/slice_iter_any.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::contains_for_slice)]
1+
#![warn(clippy::slice_iter_any)]
22

33
fn main() {
44
let vec: Vec<u8> = vec![1, 2, 3, 4, 5, 6];

tests/ui/contains_for_slice.stderr renamed to tests/ui/slice_iter_any.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error: using `contains()` instead of `iter().any()` on u8/i8 slices is more efficient
2-
--> tests/ui/contains_for_slice.rs:6:13
2+
--> tests/ui/slice_iter_any.rs:6:13
33
|
44
LL | let _ = values.iter().any(|&v| v == 4);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::contains-for-slice` implied by `-D warnings`
8-
= help: to override `-D warnings` add `#[allow(clippy::contains_for_slice)]`
7+
= note: `-D clippy::slice-iter-any` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(clippy::slice_iter_any)]`
99

1010
error: using `contains()` instead of `iter().any()` on u8/i8 slices is more efficient
11-
--> tests/ui/contains_for_slice.rs:29:5
11+
--> tests/ui/slice_iter_any.rs:29:5
1212
|
1313
LL | values.iter().any(|&v| v == 10)
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)