Skip to content

Commit 8da266c

Browse files
committed
return redundant clone in cause of cloned.count
1 parent 8058df6 commit 8da266c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clippy_lints/src/methods/iter_overeager_cloned.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_lint::LateContext;
77
use rustc_span::sym;
88

99
use super::ITER_OVEREAGER_CLONED;
10+
use crate::redundant_clone::REDUNDANT_CLONE;
1011

1112
/// lint use of `cloned().last()` for `Iterators`
1213
pub(super) fn check<'tcx>(
@@ -23,7 +24,7 @@ pub(super) fn check<'tcx>(
2324
if recv_impls_iterator {
2425
let (lint, msg) = match name {
2526
"count" => (
26-
ITER_OVEREAGER_CLONED,
27+
REDUNDANT_CLONE,
2728
format!(
2829
"called `cloned().{}()` on an `Iterator`. It may be more efficient to call\
2930
`.{}()` instead",

tests/ui/iter_overeager_cloned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![warn(clippy::iter_overeager_cloned)]
2+
#![warn(clippy::iter_overeager_cloned, clippy::redundant_clone)]
33

44
fn main() {
55
let vec = vec!["1".to_string(), "2".to_string(), "3".to_string()];

0 commit comments

Comments
 (0)