How to fix Rust E0277 the trait Fn is not implemented

Fix Rust E0277 by ensuring the argument passed to a function expecting a closure actually implements the Fn trait.

The error E0277 occurs because you are passing a value that does not implement the Fn trait to a function expecting a closure or function pointer. Change the argument to a closure or a function that matches the required signature.

fn apply<F>(f: F) where F: Fn(i32) -> i32 {
    f(5)
}

fn main() {
    let add_one = |x| x + 1;
    apply(add_one);
}