diff --git a/bindings/python/src/file.rs b/bindings/python/src/file.rs index 09cc6daeb852..304bb0f31246 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 fixed. +#![allow(clippy::unnecessary_fallible_conversions)] + use std::io::Read; use std::io::Seek; use std::io::SeekFrom; diff --git a/core/src/services/huggingface/backend.rs b/core/src/services/huggingface/backend.rs index 0974395ea988..70e6d39b5125 100644 --- a/core/src/services/huggingface/backend.rs +++ b/core/src/services/huggingface/backend.rs @@ -309,7 +309,7 @@ impl Accessor for HuggingfaceBackend { .map_err(new_json_deserialize_error)?; // NOTE: if the file is not found, the server will return 200 with an empty array - if let Some(status) = decoded_response.get(0) { + if let Some(status) = decoded_response.first() { if let Some(commit_info) = status.last_commit.as_ref() { meta.set_last_modified(parse_datetime_from_rfc3339( commit_info.date.as_str(), diff --git a/core/src/services/mod.rs b/core/src/services/mod.rs index 910908001401..e9e42675b371 100644 --- a/core/src/services/mod.rs +++ b/core/src/services/mod.rs @@ -69,6 +69,8 @@ pub use ftp::FtpConfig; mod gcs; #[cfg(feature = "services-gcs")] pub use gcs::Gcs; +#[cfg(feature = "services-gcs")] +pub use gcs::GcsConfig; #[cfg(feature = "services-ghac")] mod ghac; diff --git a/core/src/services/webdav/backend.rs b/core/src/services/webdav/backend.rs index a7e461cb4564..36a960940764 100644 --- a/core/src/services/webdav/backend.rs +++ b/core/src/services/webdav/backend.rs @@ -350,7 +350,7 @@ impl Accessor for WebdavBackend { quick_xml::de::from_reader(bs.reader()).map_err(new_xml_deserialize_error)?; let item = result .response - .get(0) + .first() .ok_or_else(|| { Error::new( ErrorKind::Unexpected, diff --git a/integrations/object_store/src/lib.rs b/integrations/object_store/src/lib.rs index 5d6123c1d7c6..3ebc44e98543 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 = 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