mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-13 15:33:53 +00:00
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:
commit
125f08d2c6
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user