I have a function which receive some parameter, but when I try to use the parameter, it throw an error.
// the function
pub fn solc_compile(compiler: &str, file: &str, out: &str, config: templates::Config) {
    let mut args = vec![
        "--bin",
        "--abi",
        "--include-path",
        "./libs",
        "--include-path",
        "./node_modules",
        "--output-dir",
        out,
    ];
    if config.compiler.optimize {
        let runs: &str = config.compiler.runs.to_string().as_str();
        args.push("--optimize");
        args.push("--optimize-runs");
        args.push(runs);
    }
}
// config type using on the function parameter (config templates::Config).
templates.rs
// config templates.
#[derive(Deserialize, Serialize)]
pub struct Config {
    pub info: ConfigInfo,
    pub compiler: ConfigCompiler,
}
// config.info templates.
#[derive(Deserialize, Serialize)]
pub struct ConfigInfo {
    pub name: String,
    pub license: String,
}
// config.compiler templates.
#[derive(Deserialize, Serialize)]
pub struct ConfigCompiler {
    pub solc: String,
    pub optimize: bool,
    pub runs: i64,
}
And this is the error I've got when run cargo build.
error[E0716]: temporary value dropped while borrowed
  --> src/solc.rs:58:26
   |
58 |         let runs: &str = config.compiler.runs.to_string().as_str();
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^         - temporary value is freed at the end of this statement
   |                          |
   |                          creates a temporary which is freed while still in use
...
61 |         args.push(runs);
   |                   ---- borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value