use unboxed closures and fix some formatting

- get_env_var closure is borrowed so it can be reused
    * closure might need to be explicitly marked |&:| a.k.a Fn<> at call
      site