rust/tests/ui/useless_conversion_try.stderr
Koichi ITO ae0216d557 Use the traits added to the Rust 2021 Edition prelude
Follow up https://github.com/rust-lang/rust/pull/96861.

This PR uses the traits added to the Rust 2021 Edition prelude.

> The `TryInto`, `TryFrom` and `FromIterator` traits are now part of the prelude.

https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html
2022-05-12 00:38:11 +09:00

80 lines
2.6 KiB
Plaintext

error: useless conversion to the same type: `T`
--> $DIR/useless_conversion_try.rs:4:13
|
LL | let _ = T::try_from(val).unwrap();
| ^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/useless_conversion_try.rs:1:9
|
LL | #![deny(clippy::useless_conversion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: consider removing `T::try_from()`
error: useless conversion to the same type: `T`
--> $DIR/useless_conversion_try.rs:5:5
|
LL | val.try_into().unwrap()
| ^^^^^^^^^^^^^^
|
= help: consider removing `.try_into()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion_try.rs:27:21
|
LL | let _: String = "foo".to_string().try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `.try_into()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion_try.rs:28:21
|
LL | let _: String = TryFrom::try_from("foo".to_string()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `TryFrom::try_from()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion_try.rs:29:13
|
LL | let _ = String::try_from("foo".to_string()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `String::try_from()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion_try.rs:30:13
|
LL | let _ = String::try_from(format!("A: {:04}", 123)).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `String::try_from()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion_try.rs:31:21
|
LL | let _: String = format!("Hello {}", "world").try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `.try_into()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion_try.rs:32:21
|
LL | let _: String = "".to_owned().try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `.try_into()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion_try.rs:33:27
|
LL | let _: String = match String::from("_").try_into() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `.try_into()`
error: aborting due to 9 previous errors