You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/06/02 10:26:33 UTC
[arrow-rs] branch master updated: Fix clippy for object_store (#4344)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 66ba303bc Fix clippy for object_store (#4344)
66ba303bc is described below
commit 66ba303bc06c56596cbea45eb6bdc0ba5ba7c640
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Fri Jun 2 11:26:28 2023 +0100
Fix clippy for object_store (#4344)
---
object_store/src/aws/mod.rs | 18 ++++++++----------
object_store/src/path/mod.rs | 9 +++------
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/object_store/src/aws/mod.rs b/object_store/src/aws/mod.rs
index 3696e4ad4..8de4b7c6a 100644
--- a/object_store/src/aws/mod.rs
+++ b/object_store/src/aws/mod.rs
@@ -1127,23 +1127,21 @@ mod tests {
)
.with_allow_http(true);
- let config =
- if let Some(endpoint) = env::var("OBJECT_STORE_AWS_ENDPOINT").ok() {
- config.with_endpoint(endpoint)
- } else {
- config
- };
+ let config = if let Ok(endpoint) = env::var("OBJECT_STORE_AWS_ENDPOINT") {
+ config.with_endpoint(endpoint)
+ } else {
+ config
+ };
- let config = if let Some(token) =
- env::var("OBJECT_STORE_AWS_SESSION_TOKEN").ok()
+ let config = if let Ok(token) = env::var("OBJECT_STORE_AWS_SESSION_TOKEN")
{
config.with_token(token)
} else {
config
};
- let config = if let Some(virtual_hosted_style_request) =
- env::var("OBJECT_STORE_VIRTUAL_HOSTED_STYLE_REQUEST").ok()
+ let config = if let Ok(virtual_hosted_style_request) =
+ env::var("OBJECT_STORE_VIRTUAL_HOSTED_STYLE_REQUEST")
{
config.with_virtual_hosted_style_request(
virtual_hosted_style_request.trim().parse().unwrap(),
diff --git a/object_store/src/path/mod.rs b/object_store/src/path/mod.rs
index 29b134176..ab30e0ed0 100644
--- a/object_store/src/path/mod.rs
+++ b/object_store/src/path/mod.rs
@@ -438,18 +438,15 @@ mod tests {
assert!(existing_path.prefix_match(&prefix).is_none());
// Prefix matches but there aren't any parts after it
- let existing_path = Path::from("apple/bear/cow/dog");
-
- let prefix = existing_path.clone();
- assert_eq!(existing_path.prefix_match(&prefix).unwrap().count(), 0);
+ let existing = Path::from("apple/bear/cow/dog");
+ assert_eq!(existing.prefix_match(&existing).unwrap().count(), 0);
assert_eq!(Path::default().parts().count(), 0);
}
#[test]
fn prefix_matches() {
let haystack = Path::from_iter(["foo/bar", "baz%2Ftest", "something"]);
- let needle = haystack.clone();
// self starts with self
assert!(
haystack.prefix_matches(&haystack),
@@ -457,7 +454,7 @@ mod tests {
);
// a longer prefix doesn't match
- let needle = needle.child("longer now");
+ let needle = haystack.child("longer now");
assert!(
!haystack.prefix_matches(&needle),
"{haystack:?} shouldn't have started with {needle:?}"