Skip to content

Commit

Permalink
Merge pull request #76 from tertsdiepraam/remove-static-lifetime
Browse files Browse the repository at this point in the history
Remove 'static lifetime
  • Loading branch information
cakebaker authored Dec 16, 2023
2 parents f24edac + cc9ce1e commit d4b4e3c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl Options<Arg> 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()
Expand Down
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub trait Arguments: Sized {
/// [`ArgumentIter<Self>`](ArgumentIter).
fn parse<I>(args: I) -> ArgumentIter<Self>
where
I: IntoIterator + 'static,
I: IntoIterator,
I::Item: Into<OsString>,
{
ArgumentIter::<Self>::from_args(args)
Expand Down Expand Up @@ -86,7 +86,7 @@ pub trait Arguments: Sized {
/// exit if `--help` or `--version` are passed and if any errors are found.
fn check<I>(args: I)
where
I: IntoIterator + 'static,
I: IntoIterator,
I::Item: Into<OsString>,
{
exit_if_err(Self::try_check(args), Self::EXIT_CODE)
Expand All @@ -98,7 +98,7 @@ pub trait Arguments: Sized {
/// exit if `--help` or `--version` are passed.
fn try_check<I>(args: I) -> Result<(), Error>
where
I: IntoIterator + 'static,
I: IntoIterator,
I::Item: Into<OsString>,
{
let mut iter = Self::parse(args);
Expand All @@ -124,7 +124,7 @@ pub struct ArgumentIter<T: Arguments> {
impl<T: Arguments> ArgumentIter<T> {
fn from_args<I>(args: I) -> Self
where
I: IntoIterator + 'static,
I: IntoIterator,
I::Item: Into<OsString>,
{
Self {
Expand Down Expand Up @@ -181,7 +181,7 @@ pub trait Options<Arg: Arguments>: Sized {
/// Parse an iterator of arguments into the options
fn parse<I>(self, args: I) -> Self
where
I: IntoIterator + 'static,
I: IntoIterator,
I::Item: Into<OsString>,
{
exit_if_err(self.try_parse(args), Arg::EXIT_CODE)
Expand All @@ -190,7 +190,7 @@ pub trait Options<Arg: Arguments>: Sized {
#[allow(unused_mut)]
fn try_parse<I>(mut self, args: I) -> Result<Self, Error>
where
I: IntoIterator + 'static,
I: IntoIterator,
I::Item: Into<OsString>,
{
// Hacky but it works: if the parse-is-complete flag is active the
Expand Down Expand Up @@ -225,7 +225,7 @@ pub trait Options<Arg: Arguments>: Sized {
#[cfg(feature = "parse-is-complete")]
fn print_complete<I, O: Options<Arg>, Arg: Arguments>(mut args: I)
where
I: Iterator + 'static,
I: Iterator,
I::Item: Into<OsString>,
{
let _exec_name = args.next();
Expand Down
2 changes: 1 addition & 1 deletion tests/coreutils/basename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Options<Arg> 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);
Expand Down
4 changes: 2 additions & 2 deletions tests/coreutils/head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<I>(iter: I) -> Option<Settings>
where
I: IntoIterator + Clone + 'static,
I: IntoIterator + Clone,
I::Item: Into<OsString>,
{
let mut iter = iter.into_iter();
Expand Down Expand Up @@ -210,7 +210,7 @@ impl Options<Arg> for Settings {

fn parse_head<I>(iter: I) -> Result<Settings, uutils_args::Error>
where
I: IntoIterator + Clone + 'static,
I: IntoIterator + Clone,
I::Item: Into<OsString>,
{
match parse_deprecated(iter.clone()) {
Expand Down
4 changes: 2 additions & 2 deletions tests/coreutils/tail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<I>(iter: I) -> Option<Settings>
where
I: IntoIterator + Clone + 'static,
I: IntoIterator + Clone,
I::Item: Into<OsString>,
{
let mut iter = iter.into_iter();
Expand Down Expand Up @@ -275,7 +275,7 @@ impl Options<Arg> for Settings {

fn parse_tail<I>(iter: I) -> Result<Settings, uutils_args::Error>
where
I: IntoIterator + Clone + 'static,
I: IntoIterator + Clone,
I::Item: Into<OsString>,
{
match parse_deprecated(iter.clone()) {
Expand Down

0 comments on commit d4b4e3c

Please sign in to comment.