clippy: us *_or_else with function calls
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
@ -456,7 +456,7 @@ fn handlebars_humam_bytes_helper(
|
||||
) -> HelperResult {
|
||||
let param = h.param(0).map(|v| v.value().as_u64())
|
||||
.flatten()
|
||||
.ok_or(RenderError::new("human-bytes: param not found"))?;
|
||||
.ok_or_else(|| RenderError::new("human-bytes: param not found"))?;
|
||||
|
||||
out.write(&HumanByte::from(param).to_string())?;
|
||||
|
||||
@ -472,10 +472,10 @@ fn handlebars_relative_percentage_helper(
|
||||
) -> HelperResult {
|
||||
let param0 = h.param(0).map(|v| v.value().as_f64())
|
||||
.flatten()
|
||||
.ok_or(RenderError::new("relative-percentage: param0 not found"))?;
|
||||
.ok_or_else(|| RenderError::new("relative-percentage: param0 not found"))?;
|
||||
let param1 = h.param(1).map(|v| v.value().as_f64())
|
||||
.flatten()
|
||||
.ok_or(RenderError::new("relative-percentage: param1 not found"))?;
|
||||
.ok_or_else(|| RenderError::new("relative-percentage: param1 not found"))?;
|
||||
|
||||
if param1 == 0.0 {
|
||||
out.write("-")?;
|
||||
|
Reference in New Issue
Block a user