needless_pass_by_value: Add suggestion for implementing Copy (fixes #2222)
This commit is contained in:
parent
cf1fbaa36a
commit
2a30c8a194
2 changed files with 31 additions and 0 deletions
|
|
@ -202,6 +202,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
|||
|
||||
// Dereference suggestion
|
||||
let sugg = |db: &mut DiagnosticBuilder| {
|
||||
if let ty::TypeVariants::TyAdt(ref def, ..) = ty.sty {
|
||||
if let Some(span) = cx.tcx.hir.span_if_local(def.did) {
|
||||
// FIXME (#2374) Restrict this to types which can impl Copy
|
||||
db.span_help(span, "consider marking this type as Copy if possible");
|
||||
}
|
||||
}
|
||||
|
||||
let deref_span = spans_need_deref.get(&canonical_id);
|
||||
if_chain! {
|
||||
if match_type(cx, ty, &paths::VEC);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue