Merge pull request #231 from birkenfeld/to_string_hint

methods: people might be using to_string() to make a copy; add a hint…
This commit is contained in:
llogiq 2015-08-25 12:55:09 +02:00
commit 125f08d2c6

View File

@ -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");
}
}
}