mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-28 16:07:06 +00:00
fix: remove func call from alternative value.
this avoid useless allocation or non-trivial work, if the default value is not needed/used. add a line in Cargo.toml to easly enable or_fun_call lint help: https://rust-lang.github.io/rust-clippy/master/index.html?search=or_fun_call
This commit is contained in:
@@ -65,7 +65,11 @@ pub fn register_bg_vars(
|
||||
vars: &mut vars::BgVars,
|
||||
) {
|
||||
vars.register_ro(persister, "lifecycle-last-completed", |p| {
|
||||
p.get_with(|x| x.last_completed.clone().unwrap_or("never".to_string()))
|
||||
p.get_with(|x| {
|
||||
x.last_completed
|
||||
.clone()
|
||||
.unwrap_or_else(|| "never".to_string())
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user