From 24e11e99ee5725173f9c59bcdc8befec68f43db9 Mon Sep 17 00:00:00 2001 From: Gwen Lg Date: Sun, 14 Dec 2025 17:06:36 +0100 Subject: [PATCH] style: some small fixes - remove invalid struct pattern lint message: struct pattern is not needed for a unit variant help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unneeded_struct_pattern - remove call to default() on unit struct lint message: use of `default` to create a unit struct help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#default_constructed_unit_structs - replace if/else by direct affectation lint message: this if-then-else expression assigns a bool literal help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_bool_assign - replace assert_eq on unit by `unwrap` + let typed binding --- src/api/s3/delete.rs | 6 +----- src/api/s3/router.rs | 2 +- src/db/test.rs | 4 ++-- src/net/endpoint.rs | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/api/s3/delete.rs b/src/api/s3/delete.rs index 4b705ad8..0ef1bf33 100644 --- a/src/api/s3/delete.rs +++ b/src/api/s3/delete.rs @@ -139,11 +139,7 @@ fn parse_delete_objects_xml(xml: &roxmltree::Document) -> Option key: key_str.to_string(), }); } else if item.has_tag_name("Quiet") { - if item.text()? == "true" { - ret.quiet = true; - } else { - ret.quiet = false; - } + ret.quiet = item.text()? == "true"; } else { return None; } diff --git a/src/api/s3/router.rs b/src/api/s3/router.rs index 6616c47f..30af6895 100644 --- a/src/api/s3/router.rs +++ b/src/api/s3/router.rs @@ -1011,7 +1011,7 @@ mod tests { // no bucket, won't work with the rest of the test suite assert!(matches!( parse("GET", "/", None, None).0, - Endpoint::ListBuckets { .. } + Endpoint::ListBuckets )); assert!(matches!( parse("GET", "/", None, None).0.authorization_type(), diff --git a/src/db/test.rs b/src/db/test.rs index 46e12bb5..91ac3522 100644 --- a/src/db/test.rs +++ b/src/db/test.rs @@ -21,7 +21,7 @@ fn test_suite(db: Db) { let res = db.transaction::<_, (), _>(|tx| { assert_eq!(tx.get(&tree, ka).unwrap().unwrap(), va); - assert_eq!(tx.insert(&tree, ka, vb).unwrap(), ()); + let _: () = tx.insert(&tree, ka, vb).unwrap(); assert_eq!(tx.get(&tree, ka).unwrap().unwrap(), vb); @@ -33,7 +33,7 @@ fn test_suite(db: Db) { let res = db.transaction::<(), _, _>(|tx| { assert_eq!(tx.get(&tree, ka).unwrap().unwrap(), vb); - assert_eq!(tx.insert(&tree, ka, vc).unwrap(), ()); + let _: () = tx.insert(&tree, ka, vc).unwrap(); assert_eq!(tx.get(&tree, ka).unwrap().unwrap(), vc); diff --git a/src/net/endpoint.rs b/src/net/endpoint.rs index 3ab1048a..af484231 100644 --- a/src/net/endpoint.rs +++ b/src/net/endpoint.rs @@ -87,7 +87,7 @@ where { pub(crate) fn new(netapp: Arc, path: String) -> Self { Self { - _phantom: PhantomData::default(), + _phantom: PhantomData, netapp, path, handler: ArcSwapOption::from(None),