Skip to content

Commit f343cd2

Browse files
committed
Adds the missing turbofish
1 parent 30de2e7 commit f343cd2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clippy_lints/src/methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ fn lint_clone_on_ref_ptr(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr) {
10291029
expr.span,
10301030
"using '.clone()' on a ref-counted pointer",
10311031
"try this",
1032-
format!("{}<{}>::clone(&{})", caller_type, subst.type_at(0), snippet(cx, arg.span, "_")),
1032+
format!("{}::<{}>::clone(&{})", caller_type, subst.type_at(0), snippet(cx, arg.span, "_")),
10331033
);
10341034
}
10351035
}

tests/ui/unnecessary_clone.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@ error: using '.clone()' on a ref-counted pointer
1616
--> $DIR/unnecessary_clone.rs:30:5
1717
|
1818
30 | rc.clone();
19-
| ^^^^^^^^^^ help: try this: `Rc<bool>::clone(&rc)`
19+
| ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
2020
|
2121
= note: `-D clone-on-ref-ptr` implied by `-D warnings`
2222

2323
error: using '.clone()' on a ref-counted pointer
2424
--> $DIR/unnecessary_clone.rs:33:5
2525
|
2626
33 | arc.clone();
27-
| ^^^^^^^^^^^ help: try this: `Arc<bool>::clone(&arc)`
27+
| ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
2828

2929
error: using '.clone()' on a ref-counted pointer
3030
--> $DIR/unnecessary_clone.rs:36:5
3131
|
3232
36 | rcweak.clone();
33-
| ^^^^^^^^^^^^^^ help: try this: `Weak<bool>::clone(&rcweak)`
33+
| ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
3434

3535
error: using '.clone()' on a ref-counted pointer
3636
--> $DIR/unnecessary_clone.rs:39:5
3737
|
3838
39 | arc_weak.clone();
39-
| ^^^^^^^^^^^^^^^^ help: try this: `Weak<bool>::clone(&arc_weak)`
39+
| ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
4040

4141
error: using '.clone()' on a ref-counted pointer
4242
--> $DIR/unnecessary_clone.rs:43:29
4343
|
4444
43 | let _: Arc<SomeTrait> = x.clone();
45-
| ^^^^^^^^^ help: try this: `Arc<SomeImpl>::clone(&x)`
45+
| ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
4646

4747
error: using `clone` on a `Copy` type
4848
--> $DIR/unnecessary_clone.rs:47:5

0 commit comments

Comments
 (0)