mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Allow manual_unwrap_or_default at useless_conversion_try tests
This commit is contained in:
parent
5b63ab1131
commit
478d44487e
2 changed files with 14 additions and 10 deletions
|
@ -1,5 +1,9 @@
|
||||||
#![deny(clippy::useless_conversion)]
|
#![deny(clippy::useless_conversion)]
|
||||||
#![allow(clippy::needless_if, clippy::unnecessary_fallible_conversions)]
|
#![allow(
|
||||||
|
clippy::needless_if,
|
||||||
|
clippy::unnecessary_fallible_conversions,
|
||||||
|
clippy::manual_unwrap_or_default
|
||||||
|
)]
|
||||||
|
|
||||||
fn test_generic<T: Copy>(val: T) -> T {
|
fn test_generic<T: Copy>(val: T) -> T {
|
||||||
let _ = T::try_from(val).unwrap();
|
let _ = T::try_from(val).unwrap();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: useless conversion to the same type: `T`
|
error: useless conversion to the same type: `T`
|
||||||
--> tests/ui/useless_conversion_try.rs:5:13
|
--> tests/ui/useless_conversion_try.rs:9:13
|
||||||
|
|
|
|
||||||
LL | let _ = T::try_from(val).unwrap();
|
LL | let _ = T::try_from(val).unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
@ -12,7 +12,7 @@ LL | #![deny(clippy::useless_conversion)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: useless conversion to the same type: `T`
|
error: useless conversion to the same type: `T`
|
||||||
--> tests/ui/useless_conversion_try.rs:7:5
|
--> tests/ui/useless_conversion_try.rs:11:5
|
||||||
|
|
|
|
||||||
LL | val.try_into().unwrap()
|
LL | val.try_into().unwrap()
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
@ -20,7 +20,7 @@ LL | val.try_into().unwrap()
|
||||||
= help: consider removing `.try_into()`
|
= help: consider removing `.try_into()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion_try.rs:30:21
|
--> tests/ui/useless_conversion_try.rs:34:21
|
||||||
|
|
|
|
||||||
LL | let _: String = "foo".to_string().try_into().unwrap();
|
LL | let _: String = "foo".to_string().try_into().unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -28,7 +28,7 @@ LL | let _: String = "foo".to_string().try_into().unwrap();
|
||||||
= help: consider removing `.try_into()`
|
= help: consider removing `.try_into()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion_try.rs:32:21
|
--> tests/ui/useless_conversion_try.rs:36:21
|
||||||
|
|
|
|
||||||
LL | let _: String = TryFrom::try_from("foo".to_string()).unwrap();
|
LL | let _: String = TryFrom::try_from("foo".to_string()).unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -36,7 +36,7 @@ LL | let _: String = TryFrom::try_from("foo".to_string()).unwrap();
|
||||||
= help: consider removing `TryFrom::try_from()`
|
= help: consider removing `TryFrom::try_from()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion_try.rs:34:13
|
--> tests/ui/useless_conversion_try.rs:38:13
|
||||||
|
|
|
|
||||||
LL | let _ = String::try_from("foo".to_string()).unwrap();
|
LL | let _ = String::try_from("foo".to_string()).unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -44,7 +44,7 @@ LL | let _ = String::try_from("foo".to_string()).unwrap();
|
||||||
= help: consider removing `String::try_from()`
|
= help: consider removing `String::try_from()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion_try.rs:36:13
|
--> tests/ui/useless_conversion_try.rs:40:13
|
||||||
|
|
|
|
||||||
LL | let _ = String::try_from(format!("A: {:04}", 123)).unwrap();
|
LL | let _ = String::try_from(format!("A: {:04}", 123)).unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -52,7 +52,7 @@ LL | let _ = String::try_from(format!("A: {:04}", 123)).unwrap();
|
||||||
= help: consider removing `String::try_from()`
|
= help: consider removing `String::try_from()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion_try.rs:38:21
|
--> tests/ui/useless_conversion_try.rs:42:21
|
||||||
|
|
|
|
||||||
LL | let _: String = format!("Hello {}", "world").try_into().unwrap();
|
LL | let _: String = format!("Hello {}", "world").try_into().unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -60,7 +60,7 @@ LL | let _: String = format!("Hello {}", "world").try_into().unwrap();
|
||||||
= help: consider removing `.try_into()`
|
= help: consider removing `.try_into()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion_try.rs:40:21
|
--> tests/ui/useless_conversion_try.rs:44:21
|
||||||
|
|
|
|
||||||
LL | let _: String = String::new().try_into().unwrap();
|
LL | let _: String = String::new().try_into().unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -68,7 +68,7 @@ LL | let _: String = String::new().try_into().unwrap();
|
||||||
= help: consider removing `.try_into()`
|
= help: consider removing `.try_into()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion_try.rs:42:27
|
--> tests/ui/useless_conversion_try.rs:46:27
|
||||||
|
|
|
|
||||||
LL | let _: String = match String::from("_").try_into() {
|
LL | let _: String = match String::from("_").try_into() {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
Loading…
Reference in a new issue