Skip to content

Commit 04619ef

Browse files
committed
Fix CI
1 parent d97bc85 commit 04619ef

File tree

6 files changed

+8
-9
lines changed

6 files changed

+8
-9
lines changed

clippy_lints/src/lib.register_nursery.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
1818
LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN),
1919
LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
2020
LintId::of(mutex_atomic::MUTEX_INTEGER),
21-
LintId::of(methods::CLONED_LAST),
2221
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
2322
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),
2423
LintId::of(option_if_let_else::OPTION_IF_LET_ELSE),

clippy_lints/src/methods/cloned_last.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, rec
1616
});
1717
if recv_impls_iterator {
1818
let msg = "called `cloned().last()` on an `Iterator`. It may be more efficient to call
19-
`.last().clone()` instead";
19+
`.last().cloned()` instead";
2020
let iter_snippet = snippet(cx, recv.span, "..");
2121
span_lint_and_sugg(
2222
cx,
2323
CLONED_LAST,
2424
expr.span,
2525
msg,
2626
"try this",
27-
format!("{}.last().clone()", iter_snippet),
27+
format!("{}.last().cloned()", iter_snippet),
2828
Applicability::MachineApplicable,
2929
);
3030
}

clippy_lints/src/methods/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ declare_clippy_lint! {
123123
/// Could be written as
124124
/// ```rust
125125
/// # let vec = vec!["string".to_string()];
126-
/// vec.iter().last().clone();
126+
/// vec.iter().last().cloned();
127127
/// ```
128128
#[clippy::version = "1.59.0"]
129129
pub CLONED_LAST,

tests/ui/cloned_last.fixed

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// run-rustfix
2-
#![warn(clippy::nursery)]
2+
#![warn(clippy::all)]
33

44
fn main() {
55
#[rustfmt::skip]
66
let _: Option<String> = vec!["1".to_string(), "2".to_string(), "3".to_string()]
7-
.iter().last().clone();
7+
.iter().last().cloned();
88
}

tests/ui/cloned_last.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![warn(clippy::nursery)]
2+
#![warn(clippy::all)]
33

44
fn main() {
55
#[rustfmt::skip]

tests/ui/cloned_last.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: called `cloned().last()` on an `Iterator`. It may be more efficient to call
2-
`.last().clone()` instead
2+
`.last().cloned()` instead
33
--> $DIR/cloned_last.rs:6:29
44
|
55
LL | let _: Option<String> = vec!["1".to_string(), "2".to_string(), "3".to_string()]
@@ -13,7 +13,7 @@ LL | | .last();
1313
help: try this
1414
|
1515
LL ~ let _: Option<String> = vec!["1".to_string(), "2".to_string(), "3".to_string()]
16-
LL ~ .iter().last().clone();
16+
LL ~ .iter().last().cloned();
1717
|
1818

1919
error: aborting due to previous error

0 commit comments

Comments
 (0)