[pbs-devel] [PATCH proxmox 18/18] auth-api: do not clone struct implementing Copy
Maximiliano Sandoval
m.sandoval at proxmox.com
Wed Jun 26 12:45:14 CEST 2024
Fixes the clippy warning:
warning: using `clone` on type `Option<&dyn AuthContext>` which implements the `Copy` trait
--> proxmox-auth-api/src/api/mod.rs:111:5
|
111 | / AUTH_CONTEXT
112 | | .lock()
113 | | .unwrap()
114 | | .clone()
| |________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
= note: `#[warn(clippy::clone_on_copy)]` on by default
help: try dereferencing it
|
111 ~ (*AUTH_CONTEXT
112 + .lock()
113 + .unwrap())
|
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
proxmox-auth-api/src/api/mod.rs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/proxmox-auth-api/src/api/mod.rs b/proxmox-auth-api/src/api/mod.rs
index c4e507c3..7fe3c2bc 100644
--- a/proxmox-auth-api/src/api/mod.rs
+++ b/proxmox-auth-api/src/api/mod.rs
@@ -108,10 +108,9 @@ pub fn set_auth_context(auth_context: &'static dyn AuthContext) {
}
fn auth_context() -> Result<&'static dyn AuthContext, Error> {
- AUTH_CONTEXT
+ (*AUTH_CONTEXT
.lock()
- .unwrap()
- .clone()
+ .unwrap())
.ok_or_else(|| format_err!("no realm access configured"))
}
--
2.39.2
More information about the pbs-devel
mailing list