Skip to content

filter_fn doesn't keep mut information #641

@GuillaumeGomez

Description

@GuillaumeGomez
pub fn format_secs(mut value: f32, _: &dyn Values) -> askama::Result<String> {
    value += 2.;
    Ok(value.to_string())
}

It fails because value doesn't keep its mut keyword:

error[E0384]: cannot assign to immutable argument `value`
   --> src/web/page/templates.rs:162:17
    |
162 |                 value += 2.;
    |                 ^^^^^^^^^^^^^ cannot assign to immutable argument

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions