use unwrap_or_default instead of unwrap_or(Vec::new)
Fixes the clippy warning: warning: use of `unwrap_or_else` to construct default value --> proxmox-tfa/src/api/mod.rs:1355:43 | 1355 | |cap| cap.map(Vec::with_capacity).unwrap_or_else(Vec::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 Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
8c9eb85706
commit
16aa2b74bc
@ -1352,7 +1352,7 @@ where
|
||||
let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT_SECS;
|
||||
deserializer.deserialize_seq(serde_tools::fold(
|
||||
"a challenge entry",
|
||||
|cap| cap.map(Vec::with_capacity).unwrap_or_else(Vec::new),
|
||||
|cap| cap.map(Vec::with_capacity).unwrap_or_default(),
|
||||
move |out, reg: T| {
|
||||
if !reg.is_expired(expire_before) {
|
||||
out.push(reg);
|
||||
|
@ -83,7 +83,7 @@ where
|
||||
/// {
|
||||
/// deserializer.deserialize_seq(proxmox_serde::fold(
|
||||
/// "a sequence of integers",
|
||||
/// |cap| cap.map(Vec::with_capacity).unwrap_or_else(Vec::new),
|
||||
/// |cap| cap.map(Vec::with_capacity).unwrap_or_default(),
|
||||
/// |out, num: u64| {
|
||||
/// if num != 4 {
|
||||
/// out.push(num.to_string());
|
||||
|
Loading…
Reference in New Issue
Block a user