diff --git a/README.md b/README.md index 7119bb7..48ecec8 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ impl Options for Settings { } } -fn run(args: &'static [&'static str]) -> String { +fn run(args: &[&str]) -> String { let s = Settings::default().parse(args); let mut output = if s.caps { s.text.to_uppercase() diff --git a/src/lib.rs b/src/lib.rs index d259d9d..e098140 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,7 +50,7 @@ pub trait Arguments: Sized { /// [`ArgumentIter`](ArgumentIter). fn parse(args: I) -> ArgumentIter where - I: IntoIterator + 'static, + I: IntoIterator, I::Item: Into, { ArgumentIter::::from_args(args) @@ -86,7 +86,7 @@ pub trait Arguments: Sized { /// exit if `--help` or `--version` are passed and if any errors are found. fn check(args: I) where - I: IntoIterator + 'static, + I: IntoIterator, I::Item: Into, { exit_if_err(Self::try_check(args), Self::EXIT_CODE) @@ -98,7 +98,7 @@ pub trait Arguments: Sized { /// exit if `--help` or `--version` are passed. fn try_check(args: I) -> Result<(), Error> where - I: IntoIterator + 'static, + I: IntoIterator, I::Item: Into, { let mut iter = Self::parse(args); @@ -124,7 +124,7 @@ pub struct ArgumentIter { impl ArgumentIter { fn from_args(args: I) -> Self where - I: IntoIterator + 'static, + I: IntoIterator, I::Item: Into, { Self { @@ -181,7 +181,7 @@ pub trait Options: Sized { /// Parse an iterator of arguments into the options fn parse(self, args: I) -> Self where - I: IntoIterator + 'static, + I: IntoIterator, I::Item: Into, { exit_if_err(self.try_parse(args), Arg::EXIT_CODE) @@ -190,7 +190,7 @@ pub trait Options: Sized { #[allow(unused_mut)] fn try_parse(mut self, args: I) -> Result where - I: IntoIterator + 'static, + I: IntoIterator, I::Item: Into, { // Hacky but it works: if the parse-is-complete flag is active the @@ -225,7 +225,7 @@ pub trait Options: Sized { #[cfg(feature = "parse-is-complete")] fn print_complete, Arg: Arguments>(mut args: I) where - I: Iterator + 'static, + I: Iterator, I::Item: Into, { let _exec_name = args.next(); diff --git a/tests/coreutils/basename.rs b/tests/coreutils/basename.rs index 7ceaa33..66d598a 100644 --- a/tests/coreutils/basename.rs +++ b/tests/coreutils/basename.rs @@ -37,7 +37,7 @@ impl Options for Settings { } } -fn parse(args: &'static [&'static str]) -> Settings { +fn parse(args: &[&str]) -> Settings { let mut settings = Settings::default().parse(args); if !settings.multiple { assert_eq!(settings.names.len(), 2); diff --git a/tests/coreutils/head.rs b/tests/coreutils/head.rs index 40f3e81..c1257c7 100644 --- a/tests/coreutils/head.rs +++ b/tests/coreutils/head.rs @@ -10,7 +10,7 @@ use uutils_args::{Arguments, Options, Value}; // optional at compile time. As the GNU docs explain, it's very error-prone. fn parse_deprecated(iter: I) -> Option where - I: IntoIterator + Clone + 'static, + I: IntoIterator + Clone, I::Item: Into, { let mut iter = iter.into_iter(); @@ -210,7 +210,7 @@ impl Options for Settings { fn parse_head(iter: I) -> Result where - I: IntoIterator + Clone + 'static, + I: IntoIterator + Clone, I::Item: Into, { match parse_deprecated(iter.clone()) { diff --git a/tests/coreutils/tail.rs b/tests/coreutils/tail.rs index 671b9be..7e6b63e 100644 --- a/tests/coreutils/tail.rs +++ b/tests/coreutils/tail.rs @@ -10,7 +10,7 @@ use uutils_args::{Arguments, Options, Value}; // optional at compile time. As the GNU docs explain, it's very error-prone. fn parse_deprecated(iter: I) -> Option where - I: IntoIterator + Clone + 'static, + I: IntoIterator + Clone, I::Item: Into, { let mut iter = iter.into_iter(); @@ -275,7 +275,7 @@ impl Options for Settings { fn parse_tail(iter: I) -> Result where - I: IntoIterator + Clone + 'static, + I: IntoIterator + Clone, I::Item: Into, { match parse_deprecated(iter.clone()) {