Consider the following code:
extern crate clap;
use clap::{App};
use std::io;
fn parse_argv() -> &'static clap::ArgMatches {
return App::new("example")
.get_matches()
}
fn main() -> io::Result<()> {
let matches = parse_argv();
Ok(())
}
This is the error:
error[E0106]: missing lifetime specifier
--> src/main.rs:6:29
|
6 | fn parse_argv() -> &'static clap::ArgMatches {
| ^^^^^^^^^^^^^^^^ help: consider giving it a 'static lifetime: `clap::ArgMatches + 'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
What is the problem here and how do I solve it? I think I did what compiler asked for, but the error won't disappear.