about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRenato Lochetti <renato.lochetti@gmail.com>2024-06-06 21:44:06 +0100
committerRenato Lochetti <renato.lochetti@gmail.com>2024-06-06 21:44:06 +0100
commit478d44487e4c69888b29a1bddbcedc7872fbef28 (patch)
treed263b26848eb7b3d457492cf60f632a4bdf242a9
parent5b63ab113118a97997c6bb2b553a54687b1b67d2 (diff)
downloadrust-478d44487e4c69888b29a1bddbcedc7872fbef28.tar.gz
rust-478d44487e4c69888b29a1bddbcedc7872fbef28.zip
Allow manual_unwrap_or_default at useless_conversion_try tests
-rw-r--r--tests/ui/useless_conversion_try.rs6
-rw-r--r--tests/ui/useless_conversion_try.stderr18
2 files changed, 14 insertions, 10 deletions
diff --git a/tests/ui/useless_conversion_try.rs b/tests/ui/useless_conversion_try.rs
index 803d3b39f37..23edeae12b8 100644
--- a/tests/ui/useless_conversion_try.rs
+++ b/tests/ui/useless_conversion_try.rs
@@ -1,5 +1,9 @@
 #![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 {
     let _ = T::try_from(val).unwrap();
diff --git a/tests/ui/useless_conversion_try.stderr b/tests/ui/useless_conversion_try.stderr
index 11fb8f38ea5..30a43629dbd 100644
--- a/tests/ui/useless_conversion_try.stderr
+++ b/tests/ui/useless_conversion_try.stderr
@@ -1,5 +1,5 @@
 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();
    |             ^^^^^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL | #![deny(clippy::useless_conversion)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 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()
    |     ^^^^^^^^^^^^^^
@@ -20,7 +20,7 @@ LL |     val.try_into().unwrap()
    = help: consider removing `.try_into()`
 
 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();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -28,7 +28,7 @@ LL |     let _: String = "foo".to_string().try_into().unwrap();
    = help: consider removing `.try_into()`
 
 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();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -36,7 +36,7 @@ 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`
-  --> 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();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -44,7 +44,7 @@ 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`
-  --> 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();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -52,7 +52,7 @@ 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`
-  --> 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();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +60,7 @@ LL |     let _: String = format!("Hello {}", "world").try_into().unwrap();
    = help: consider removing `.try_into()`
 
 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();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -68,7 +68,7 @@ LL |     let _: String = String::new().try_into().unwrap();
    = help: consider removing `.try_into()`
 
 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() {
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^