diff options
Diffstat (limited to 'src/garage')
-rw-r--r-- | src/garage/main.rs | 2 | ||||
-rw-r--r-- | src/garage/tests/bucket.rs | 4 | ||||
-rw-r--r-- | src/garage/tests/list.rs | 4 | ||||
-rw-r--r-- | src/garage/tests/multipart.rs | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/src/garage/main.rs b/src/garage/main.rs index 08ec912b..e898e680 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -115,7 +115,7 @@ async fn cli_command(opt: Opt) -> Result<(), Error> { } else { let node_id = garage_rpc::system::read_node_id(&config.as_ref().unwrap().metadata_dir) .err_context(READ_KEY_ERROR)?; - if let Some(a) = config.as_ref().map(|c| c.rpc_public_addr).flatten() { + if let Some(a) = config.as_ref().and_then(|c| c.rpc_public_addr) { (node_id, a) } else { let default_addr = SocketAddr::new( diff --git a/src/garage/tests/bucket.rs b/src/garage/tests/bucket.rs index 1a534042..ff5cc8da 100644 --- a/src/garage/tests/bucket.rs +++ b/src/garage/tests/bucket.rs @@ -27,7 +27,7 @@ async fn test_bucket_all() { .buckets .as_ref() .unwrap() - .into_iter() + .iter() .filter(|x| x.name.as_ref().is_some()) .find(|x| x.name.as_ref().unwrap() == "hello") .is_some()); @@ -79,7 +79,7 @@ async fn test_bucket_all() { .buckets .as_ref() .unwrap() - .into_iter() + .iter() .filter(|x| x.name.as_ref().is_some()) .find(|x| x.name.as_ref().unwrap() == "hello") .is_none()); diff --git a/src/garage/tests/list.rs b/src/garage/tests/list.rs index 6e092a3f..bb03f250 100644 --- a/src/garage/tests/list.rs +++ b/src/garage/tests/list.rs @@ -527,8 +527,8 @@ async fn test_listmultipart() { upnext = r.next_upload_id_marker; loopcnt += 1; - upcnt += r.uploads.unwrap_or(vec![]).len(); - pfxcnt += r.common_prefixes.unwrap_or(vec![]).len(); + upcnt += r.uploads.unwrap_or_default().len(); + pfxcnt += r.common_prefixes.unwrap_or_default().len(); if next.is_none() { break; diff --git a/src/garage/tests/multipart.rs b/src/garage/tests/multipart.rs index 095c9d34..7fec4de6 100644 --- a/src/garage/tests/multipart.rs +++ b/src/garage/tests/multipart.rs @@ -124,7 +124,7 @@ async fn test_uploadlistpart() { assert!(r.part_number_marker.is_none()); assert!(r.next_part_number_marker.is_some()); - assert_eq!(r.max_parts, 1 as i32); + assert_eq!(r.max_parts, 1_i32); assert!(r.is_truncated); assert_eq!(r.key.unwrap(), "a"); assert_eq!(r.upload_id.unwrap().as_str(), uid.as_str()); @@ -146,7 +146,7 @@ async fn test_uploadlistpart() { r2.part_number_marker.as_ref().unwrap(), r.next_part_number_marker.as_ref().unwrap() ); - assert_eq!(r2.max_parts, 1 as i32); + assert_eq!(r2.max_parts, 1_i32); assert!(r2.is_truncated); assert_eq!(r2.key.unwrap(), "a"); assert_eq!(r2.upload_id.unwrap().as_str(), uid.as_str()); |