[pbs-devel] [PATCH proxmox 6/6] rrd: use unwrap_or_default when possible
Maximiliano Sandoval
m.sandoval at proxmox.com
Wed Feb 28 12:39:20 CET 2024
Fixes the Clippy warnings:
warning: use of `unwrap_or_else` to construct default value
--> proxmox-rrd/src/cache.rs:65:41
|
65 | let file_options = file_options.unwrap_or_else(CreateOptions::new);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
= note: `#[warn(clippy::unwrap_or_default)]` on by default
warning: use of `unwrap_or_else` to construct default value
--> proxmox-rrd/src/cache.rs:66:39
|
66 | let dir_options = dir_options.unwrap_or_else(CreateOptions::new);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
proxmox-rrd/src/cache.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/proxmox-rrd/src/cache.rs b/proxmox-rrd/src/cache.rs
index e3d2f8d5..5b123a6b 100644
--- a/proxmox-rrd/src/cache.rs
+++ b/proxmox-rrd/src/cache.rs
@@ -62,8 +62,8 @@ impl Cache {
) -> Result<Self, Error> {
let basedir = basedir.as_ref().to_owned();
- let file_options = file_options.unwrap_or_else(CreateOptions::new);
- let dir_options = dir_options.unwrap_or_else(CreateOptions::new);
+ let file_options = file_options.unwrap_or_default();
+ let dir_options = dir_options.unwrap_or_default();
create_path(
&basedir,
--
2.39.2
More information about the pbs-devel
mailing list