public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH offline-mirror 1/2] remove needless borrows
@ 2024-02-14  9:27 Maximiliano Sandoval
  2024-02-14  9:27 ` [pbs-devel] [PATCH offline-mirror 2/2] verifier: elide explicit lifetime Maximiliano Sandoval
  2024-02-21 11:14 ` [pbs-devel] applied-series: [PATCH offline-mirror 1/2] remove needless borrows Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Maximiliano Sandoval @ 2024-02-14  9:27 UTC (permalink / raw)
  To: pbs-devel

Fixes the clippy lint
```
warning: the borrowed expression implements the required traits
   --> src/medium.rs:143:9
    |
143 |         &statefile(base),
    |         ^^^^^^^^^^^^^^^^ help: change this to: `statefile(base)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/medium.rs | 2 +-
 src/pool.rs   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/medium.rs b/src/medium.rs
index 4b1f006..53df50d 100644
--- a/src/medium.rs
+++ b/src/medium.rs
@@ -140,7 +140,7 @@ fn load_state(base: &Path) -> Result<Option<MediumState>, Error> {
 // Helper to write statefile
 fn write_state(_lock: &ConfigLockGuard, base: &Path, state: &MediumState) -> Result<(), Error> {
     replace_file(
-        &statefile(base),
+        statefile(base),
         &serde_json::to_vec(&state)?,
         CreateOptions::default(),
         true,
diff --git a/src/pool.rs b/src/pool.rs
index 3da8c08..f20f5ea 100644
--- a/src/pool.rs
+++ b/src/pool.rs
@@ -76,7 +76,7 @@ impl Pool {
     pub(crate) fn lock(&self) -> Result<PoolLockGuard, Error> {
         let timeout = std::time::Duration::new(30, 0);
         let lock = Some(proxmox_sys::fs::open_file_locked(
-            &self.lock_path(),
+            self.lock_path(),
             timeout,
             true,
             CreateOptions::default(),
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] [PATCH offline-mirror 2/2] verifier: elide explicit lifetime
  2024-02-14  9:27 [pbs-devel] [PATCH offline-mirror 1/2] remove needless borrows Maximiliano Sandoval
@ 2024-02-14  9:27 ` Maximiliano Sandoval
  2024-02-21 11:14 ` [pbs-devel] applied-series: [PATCH offline-mirror 1/2] remove needless borrows Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Maximiliano Sandoval @ 2024-02-14  9:27 UTC (permalink / raw)
  To: pbs-devel

Fixes the clippy lint:

```
warning: the following explicit lifetimes could be elided: 'msg
  --> src/helpers/verifier.rs:93:32
   |
93 | pub(crate) fn verify_signature<'msg>(
   |                                ^^^^
94 |     msg: &'msg [u8],
   |           ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
93 ~ pub(crate) fn verify_signature(
94 ~     msg: &[u8],
   |
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/helpers/verifier.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/helpers/verifier.rs b/src/helpers/verifier.rs
index 17d36eb..ed986af 100644
--- a/src/helpers/verifier.rs
+++ b/src/helpers/verifier.rs
@@ -90,8 +90,8 @@ impl<'a> VerificationHelper for Helper<'a> {
 }
 
 /// Verifies GPG-signed `msg` was signed by `key`, returning the verified data without signature.
-pub(crate) fn verify_signature<'msg>(
-    msg: &'msg [u8],
+pub(crate) fn verify_signature(
+    msg: &[u8],
     key: &[u8],
     detached_sig: Option<&[u8]>,
     weak_crypto: &WeakCryptoConfig,
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] applied-series: [PATCH offline-mirror 1/2] remove needless borrows
  2024-02-14  9:27 [pbs-devel] [PATCH offline-mirror 1/2] remove needless borrows Maximiliano Sandoval
  2024-02-14  9:27 ` [pbs-devel] [PATCH offline-mirror 2/2] verifier: elide explicit lifetime Maximiliano Sandoval
@ 2024-02-21 11:14 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2024-02-21 11:14 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Maximiliano Sandoval

Am 14/02/2024 um 10:27 schrieb Maximiliano Sandoval:
> Fixes the clippy lint
> ```
> warning: the borrowed expression implements the required traits
>    --> src/medium.rs:143:9
>     |
> 143 |         &statefile(base),
>     |         ^^^^^^^^^^^^^^^^ help: change this to: `statefile(base)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
>     = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
> ```
> 
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
>  src/medium.rs | 2 +-
>  src/pool.rs   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
>

applied both patches, thanks!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-21 11:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14  9:27 [pbs-devel] [PATCH offline-mirror 1/2] remove needless borrows Maximiliano Sandoval
2024-02-14  9:27 ` [pbs-devel] [PATCH offline-mirror 2/2] verifier: elide explicit lifetime Maximiliano Sandoval
2024-02-21 11:14 ` [pbs-devel] applied-series: [PATCH offline-mirror 1/2] remove needless borrows Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal