Closed
Description
#[derive(Clone)]
struct S;
fn foo(_: S) {}
fn main() {
let s = &S;
foo(s);
}
we should suggest cloning.
Also, given
#[derive(Clone)]
struct S;
trait X {}
impl X for S {}
fn foo<T: X>(_: T) {}
fn bar<T: X>(s: &T) {
foo(s);
}
fn main() {}
we should suggest
fn bar<T: X + Clone>(s: &T) {
foo(s.clone());
}
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.