Skip to content

Commit b049c88

Browse files
committed
Eat dogfood
1 parent 0462666 commit b049c88

File tree

9 files changed

+12
-12
lines changed

9 files changed

+12
-12
lines changed

clippy_lints/src/booleans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ fn simplify_not(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
261261
}
262262
METHODS_WITH_NEGATION
263263
.iter()
264-
.cloned()
264+
.copied()
265265
.flat_map(|(a, b)| vec![(a, b), (b, a)])
266266
.find(|&(a, _)| {
267267
let path: &str = &path.ident.name.as_str();

clippy_lints/src/checked_conversions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ fn get_implementing_type<'a>(path: &QPath<'_>, candidates: &'a [&str], function:
323323
if let [int] = &*tp.segments;
324324
then {
325325
let name = &int.ident.name.as_str();
326-
candidates.iter().find(|c| name == *c).cloned()
326+
candidates.iter().find(|c| name == *c).copied()
327327
} else {
328328
None
329329
}
@@ -337,7 +337,7 @@ fn int_ty_to_sym<'tcx>(path: &QPath<'_>) -> Option<&'tcx str> {
337337
if let [ty] = &*path.segments;
338338
then {
339339
let name = &ty.ident.name.as_str();
340-
INTS.iter().find(|c| name == *c).cloned()
340+
INTS.iter().find(|c| name == *c).copied()
341341
} else {
342342
None
343343
}

clippy_lints/src/loops/never_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn never_loop_expr(expr: &Expr<'_>, main_loop_id: HirId) -> NeverLoopResult {
100100
ExprKind::Binary(_, e1, e2)
101101
| ExprKind::Assign(e1, e2, _)
102102
| ExprKind::AssignOp(_, e1, e2)
103-
| ExprKind::Index(e1, e2) => never_loop_expr_all(&mut [e1, e2].iter().cloned(), main_loop_id),
103+
| ExprKind::Index(e1, e2) => never_loop_expr_all(&mut [e1, e2].iter().copied(), main_loop_id),
104104
ExprKind::Loop(b, _, _, _) => {
105105
// Break can come from the inner loop so remove them.
106106
absorb_break(&never_loop_block(b, main_loop_id))

clippy_lints/src/matches.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ fn check_wild_enum_match(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>])
11241124
Applicability::MaybeIncorrect,
11251125
),
11261126
variants => {
1127-
let mut suggestions: Vec<_> = variants.iter().cloned().map(format_suggestion).collect();
1127+
let mut suggestions: Vec<_> = variants.iter().copied().map(format_suggestion).collect();
11281128
let message = if adt_def.is_variant_list_non_exhaustive() {
11291129
suggestions.push("_".into());
11301130
"wildcard matches known variants and will also match future added variants"

clippy_lints/src/needless_pass_by_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
279279
spans.extend(
280280
deref_span
281281
.iter()
282-
.cloned()
282+
.copied()
283283
.map(|span| (span, format!("*{}", snippet(cx, span, "<expr>")))),
284284
);
285285
spans.sort_by_key(|&(span, _)| span);

clippy_lints/src/suspicious_operation_groupings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn attempt_to_emit_no_difference_lint(
195195
i: usize,
196196
expected_loc: IdentLocation,
197197
) {
198-
if let Some(binop) = binops.get(i).cloned() {
198+
if let Some(binop) = binops.get(i).copied() {
199199
// We need to try and figure out which identifier we should
200200
// suggest using instead. Since there could be multiple
201201
// replacement candidates in a given expression, and we're

clippy_lints/src/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ impl Write {
573573
diag.multipart_suggestion(
574574
"try this",
575575
iter::once((comma_span.to(token_expr.span), String::new()))
576-
.chain(fmt_spans.iter().cloned().zip(iter::repeat(replacement)))
576+
.chain(fmt_spans.iter().copied().zip(iter::repeat(replacement)))
577577
.collect(),
578578
Applicability::MachineApplicable,
579579
);

clippy_utils/src/hir_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ fn reduce_exprkind<'hir>(cx: &LateContext<'_>, kind: &'hir ExprKind<'hir>) -> &'
424424
TokenKind::LineComment { .. } | TokenKind::BlockComment { .. } | TokenKind::Whitespace
425425
)
426426
})
427-
.ne([TokenKind::OpenBrace, TokenKind::CloseBrace].iter().cloned()) =>
427+
.ne([TokenKind::OpenBrace, TokenKind::CloseBrace].iter().copied()) =>
428428
{
429429
kind
430430
},

clippy_utils/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
10531053
/// the function once on the given pattern.
10541054
pub fn recurse_or_patterns<'tcx, F: FnMut(&'tcx Pat<'tcx>)>(pat: &'tcx Pat<'tcx>, mut f: F) {
10551055
if let PatKind::Or(pats) = pat.kind {
1056-
pats.iter().cloned().for_each(f)
1056+
pats.iter().copied().for_each(f)
10571057
} else {
10581058
f(pat)
10591059
}
@@ -1230,14 +1230,14 @@ pub fn match_any_def_paths(cx: &LateContext<'_>, did: DefId, paths: &[&[&str]])
12301230
let search_path = cx.get_def_path(did);
12311231
paths
12321232
.iter()
1233-
.position(|p| p.iter().map(|x| Symbol::intern(x)).eq(search_path.iter().cloned()))
1233+
.position(|p| p.iter().map(|x| Symbol::intern(x)).eq(search_path.iter().copied()))
12341234
}
12351235

12361236
/// Checks if the given `DefId` matches the path.
12371237
pub fn match_def_path<'tcx>(cx: &LateContext<'tcx>, did: DefId, syms: &[&str]) -> bool {
12381238
// We should probably move to Symbols in Clippy as well rather than interning every time.
12391239
let path = cx.get_def_path(did);
1240-
syms.iter().map(|x| Symbol::intern(x)).eq(path.iter().cloned())
1240+
syms.iter().map(|x| Symbol::intern(x)).eq(path.iter().copied())
12411241
}
12421242

12431243
pub fn match_panic_call(cx: &LateContext<'_>, expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> {

0 commit comments

Comments
 (0)