From 81ef3da03cfb00eb16bd01d884fdc38835d9dfe0 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 25 Aug 2015 12:45:52 +0200 Subject: [PATCH] methods: people might be using to_string() to make a copy; add a hint for that --- src/methods.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/methods.rs b/src/methods.rs index df8e35d98fb..40043be109a 100644 --- a/src/methods.rs +++ b/src/methods.rs @@ -41,7 +41,8 @@ impl LintPass for MethodsPass { if obj_ty.sty == ty::TyStr { span_lint(cx, STR_TO_STRING, expr.span, "`str.to_owned()` is faster"); } else if match_type(cx, obj_ty, &STRING_PATH) { - span_lint(cx, STRING_TO_STRING, expr.span, "`String.to_string()` is a no-op"); + span_lint(cx, STRING_TO_STRING, expr.span, "`String.to_string()` is a no-op; use \ + `clone()` to make a copy"); } } }