Skip to content

Commit

Permalink
Update help text in inefficient_to_string
Browse files Browse the repository at this point in the history
Co-Authored-By: Manish Goregaokar <manishsmail@gmail.com>
  • Loading branch information
HMPerson1 and Manishearth committed Oct 17, 2019
1 parent ffb53e7 commit 2106a23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/inefficient_to_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn lint<'tcx>(cx: &LateContext<'_, 'tcx>, expr: &hir::Expr, arg: &hir::Expr,
&format!("calling `to_string` on `{}`", arg_ty),
|db| {
db.help(&format!(
"`{}` implements `ToString` through the blanket impl, but `{}` specializes `ToString` directly",
"`{}` implements `ToString` through a slower blanket impl, but `{}` has a fast specialization of `ToString`",
self_ty, deref_self_ty
));
let mut applicability = Applicability::MachineApplicable;
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/inefficient_to_string.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,47 @@ note: lint level defined here
|
LL | #![deny(clippy::inefficient_to_string)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: `&str` implements `ToString` through the blanket impl, but `str` specializes `ToString` directly
= help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`

error: calling `to_string` on `&&&str`
--> $DIR/inefficient_to_string.rs:13:21
|
LL | let _: String = rrrstr.to_string();
| ^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrstr).to_string()`
|
= help: `&&str` implements `ToString` through the blanket impl, but `str` specializes `ToString` directly
= help: `&&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`

error: calling `to_string` on `&&std::string::String`
--> $DIR/inefficient_to_string.rs:21:21
|
LL | let _: String = rrstring.to_string();
| ^^^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrstring).to_string()`
|
= help: `&std::string::String` implements `ToString` through the blanket impl, but `std::string::String` specializes `ToString` directly
= help: `&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString`

error: calling `to_string` on `&&&std::string::String`
--> $DIR/inefficient_to_string.rs:22:21
|
LL | let _: String = rrrstring.to_string();
| ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrstring).to_string()`
|
= help: `&&std::string::String` implements `ToString` through the blanket impl, but `std::string::String` specializes `ToString` directly
= help: `&&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString`

error: calling `to_string` on `&&std::borrow::Cow<'_, str>`
--> $DIR/inefficient_to_string.rs:30:21
|
LL | let _: String = rrcow.to_string();
| ^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrcow).to_string()`
|
= help: `&std::borrow::Cow<'_, str>` implements `ToString` through the blanket impl, but `std::borrow::Cow<'_, str>` specializes `ToString` directly
= help: `&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString`

error: calling `to_string` on `&&&std::borrow::Cow<'_, str>`
--> $DIR/inefficient_to_string.rs:31:21
|
LL | let _: String = rrrcow.to_string();
| ^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrcow).to_string()`
|
= help: `&&std::borrow::Cow<'_, str>` implements `ToString` through the blanket impl, but `std::borrow::Cow<'_, str>` specializes `ToString` directly
= help: `&&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString`

error: aborting due to 6 previous errors

0 comments on commit 2106a23

Please sign in to comment.