You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/12/29 02:33:30 UTC

(incubator-opendal) 03/03: Fix

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch fix-issues-on-1-75
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit 67c710b51b397be0dccc4c2cb58733e3a95050ef
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Fri Dec 29 10:33:17 2023 +0800

    Fix
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 bindings/python/src/file.rs          |  3 +++
 integrations/object_store/src/lib.rs | 16 ++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/bindings/python/src/file.rs b/bindings/python/src/file.rs
index 09cc6daeb..304bb0f31 100644
--- a/bindings/python/src/file.rs
+++ b/bindings/python/src/file.rs
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+// Remove this allow after <https://github.com/rust-lang/rust-clippy/issues/12039> fixed.
+#![allow(clippy::unnecessary_fallible_conversions)]
+
 use std::io::Read;
 use std::io::Seek;
 use std::io::SeekFrom;
diff --git a/integrations/object_store/src/lib.rs b/integrations/object_store/src/lib.rs
index 5d6123c1d..3ebc44e98 100644
--- a/integrations/object_store/src/lib.rs
+++ b/integrations/object_store/src/lib.rs
@@ -341,11 +341,11 @@ mod tests {
         let op = Operator::new(services::Memory::default()).unwrap().finish();
         let object_store = Arc::new(OpendalStore::new(op));
 
-        let path: Path = "data/test.txt".try_into().unwrap();
+        let path: Path = "data/test.txt".into();
         let bytes = Bytes::from_static(b"hello, world!");
         object_store.put(&path, bytes).await.unwrap();
 
-        let path: Path = "data/nested/test.txt".try_into().unwrap();
+        let path: Path = "data/nested/test.txt".into();
         let bytes = Bytes::from_static(b"hello, world! I am nested.");
         object_store.put(&path, bytes).await.unwrap();
 
@@ -358,7 +358,7 @@ mod tests {
         let object_store: Arc<dyn ObjectStore> = Arc::new(OpendalStore::new(op));
 
         // Retrieve a specific file
-        let path: Path = "data/test.txt".try_into().unwrap();
+        let path: Path = "data/test.txt".into();
 
         let bytes = Bytes::from_static(b"hello, world!");
         object_store.put(&path, bytes.clone()).await.unwrap();
@@ -382,7 +382,7 @@ mod tests {
     #[tokio::test]
     async fn test_list() {
         let object_store = create_test_object_store().await;
-        let path: Path = "data/".try_into().unwrap();
+        let path: Path = "data/".into();
         let results = object_store
             .list(Some(&path))
             .await
@@ -409,7 +409,7 @@ mod tests {
         assert_eq!(locations, expected_locations);
 
         for (location, bytes) in expected_files {
-            let path: Path = location.try_into().unwrap();
+            let path: Path = location.into();
             assert_eq!(
                 object_store
                     .get(&path)
@@ -426,7 +426,7 @@ mod tests {
     #[tokio::test]
     async fn test_list_with_delimiter() {
         let object_store = create_test_object_store().await;
-        let path: Path = "data/".try_into().unwrap();
+        let path: Path = "data/".into();
         let result = object_store.list_with_delimiter(Some(&path)).await.unwrap();
         assert_eq!(result.objects.len(), 1);
         assert_eq!(result.common_prefixes.len(), 1);
@@ -437,8 +437,8 @@ mod tests {
     #[tokio::test]
     async fn test_list_with_offset() {
         let object_store = create_test_object_store().await;
-        let path: Path = "data/".try_into().unwrap();
-        let offset: Path = "data/nested/test.txt".try_into().unwrap();
+        let path: Path = "data/".into();
+        let offset: Path = "data/nested/test.txt".into();
         let result = object_store
             .list_with_offset(Some(&path), &offset)
             .await