Adds the missing turbofish

This commit is contained in:
Adam Lusch 2018-01-14 20:19:55 -08:00
parent 30de2e7106
commit f343cd22f6
2 changed files with 6 additions and 6 deletions

View File

@ -1029,7 +1029,7 @@ fn lint_clone_on_ref_ptr(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr) {
expr.span,
"using '.clone()' on a ref-counted pointer",
"try this",
format!("{}<{}>::clone(&{})", caller_type, subst.type_at(0), snippet(cx, arg.span, "_")),
format!("{}::<{}>::clone(&{})", caller_type, subst.type_at(0), snippet(cx, arg.span, "_")),
);
}
}

View File

@ -16,7 +16,7 @@ error: using '.clone()' on a ref-counted pointer
--> $DIR/unnecessary_clone.rs:30:5
|
30 | rc.clone();
| ^^^^^^^^^^ help: try this: `Rc<bool>::clone(&rc)`
| ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
|
= note: `-D clone-on-ref-ptr` implied by `-D warnings`
@ -24,25 +24,25 @@ error: using '.clone()' on a ref-counted pointer
--> $DIR/unnecessary_clone.rs:33:5
|
33 | arc.clone();
| ^^^^^^^^^^^ help: try this: `Arc<bool>::clone(&arc)`
| ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
error: using '.clone()' on a ref-counted pointer
--> $DIR/unnecessary_clone.rs:36:5
|
36 | rcweak.clone();
| ^^^^^^^^^^^^^^ help: try this: `Weak<bool>::clone(&rcweak)`
| ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
error: using '.clone()' on a ref-counted pointer
--> $DIR/unnecessary_clone.rs:39:5
|
39 | arc_weak.clone();
| ^^^^^^^^^^^^^^^^ help: try this: `Weak<bool>::clone(&arc_weak)`
| ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
error: using '.clone()' on a ref-counted pointer
--> $DIR/unnecessary_clone.rs:43:29
|
43 | let _: Arc<SomeTrait> = x.clone();
| ^^^^^^^^^ help: try this: `Arc<SomeImpl>::clone(&x)`
| ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
error: using `clone` on a `Copy` type
--> $DIR/unnecessary_clone.rs:47:5