Skip to content

Commit

Permalink
style: Make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 29, 2024
1 parent 10c4f63 commit d90cab0
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion clap_builder/src/builder/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4848,7 +4848,7 @@ impl Command {
/// A workaround:
/// <https://github.com/rust-lang/rust/issues/34511#issuecomment-373423999>
pub(crate) trait Captures<'a> {}
impl<'a, T> Captures<'a> for T {}
impl<T> Captures<'_> for T {}

// Internal Query Methods
impl Command {
Expand Down
2 changes: 1 addition & 1 deletion clap_builder/src/error/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ fn did_you_mean(styled: &mut StyledStr, styles: &Styles, context: &str, possible

struct Escape<'s>(&'s str);

impl<'s> std::fmt::Display for Escape<'s> {
impl std::fmt::Display for Escape<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if self.0.contains(char::is_whitespace) {
std::fmt::Debug::fmt(self.0, f)
Expand Down
6 changes: 3 additions & 3 deletions clap_builder/src/output/help_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
}

/// Basic template methods
impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
impl HelpTemplate<'_, '_> {
/// Writes binary name of a Parser Object to the wrapped stream.
fn write_display_name(&mut self) {
debug!("HelpTemplate::write_display_name");
Expand Down Expand Up @@ -364,7 +364,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
}

/// Arg handling
impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
impl HelpTemplate<'_, '_> {
/// Writes help for all arguments (options, flags, args, subcommands)
/// including titles of a Parser Object to the wrapped stream.
pub(crate) fn write_all_args(&mut self) {
Expand Down Expand Up @@ -847,7 +847,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
}

/// Subcommand handling
impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
impl HelpTemplate<'_, '_> {
/// Writes help for subcommands of a Parser Object to the wrapped stream.
fn write_flat_subcommands(&mut self, cmd: &Command, first: &mut bool) {
debug!(
Expand Down
2 changes: 1 addition & 1 deletion clap_builder/src/output/usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<'cmd> Usage<'cmd> {
}

#[cfg(feature = "usage")]
impl<'cmd> Usage<'cmd> {
impl Usage<'_> {
// Creates a usage string for display in help messages (i.e. not for errors)
fn write_help_usage(&self, styled: &mut StyledStr) {
debug!("Usage::write_help_usage");
Expand Down
28 changes: 14 additions & 14 deletions clap_builder/src/parser/matches/arg_matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ impl<'a> DoubleEndedIterator for IdsRef<'a> {
}
}

impl<'a> ExactSizeIterator for IdsRef<'a> {}
impl ExactSizeIterator for IdsRef<'_> {}

/// Iterate over multiple values for an argument via [`ArgMatches::remove_many`].
///
Expand Down Expand Up @@ -1585,7 +1585,7 @@ impl<'a> DoubleEndedIterator for RawValues<'a> {
}
}

impl<'a> ExactSizeIterator for RawValues<'a> {}
impl ExactSizeIterator for RawValues<'_> {}

/// Creates an empty iterator.
impl Default for RawValues<'_> {
Expand Down Expand Up @@ -1629,7 +1629,7 @@ impl<'a> Iterator for GroupedValues<'a> {
}

#[allow(deprecated)]
impl<'a> DoubleEndedIterator for GroupedValues<'a> {
impl DoubleEndedIterator for GroupedValues<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
if let Some(next) = self.iter.next_back() {
self.len -= 1;
Expand All @@ -1641,11 +1641,11 @@ impl<'a> DoubleEndedIterator for GroupedValues<'a> {
}

#[allow(deprecated)]
impl<'a> ExactSizeIterator for GroupedValues<'a> {}
impl ExactSizeIterator for GroupedValues<'_> {}

/// Creates an empty iterator. Used for `unwrap_or_default()`.
#[allow(deprecated)]
impl<'a> Default for GroupedValues<'a> {
impl Default for GroupedValues<'_> {
fn default() -> Self {
static EMPTY: [Vec<AnyValue>; 0] = [];
GroupedValues {
Expand Down Expand Up @@ -1747,7 +1747,7 @@ where
}

impl<'a, T> ExactSizeIterator for OccurrencesRef<'a, T> where Self: 'a {}
impl<'a, T> Default for OccurrencesRef<'a, T> {
impl<T> Default for OccurrencesRef<'_, T> {
fn default() -> Self {
static EMPTY: [Vec<AnyValue>; 0] = [];
OccurrencesRef {
Expand Down Expand Up @@ -1806,15 +1806,15 @@ impl<'a> Iterator for RawOccurrences<'a> {
}
}

impl<'a> DoubleEndedIterator for RawOccurrences<'a> {
impl DoubleEndedIterator for RawOccurrences<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.iter.next_back()
}
}

impl<'a> ExactSizeIterator for RawOccurrences<'a> {}
impl ExactSizeIterator for RawOccurrences<'_> {}

impl<'a> Default for RawOccurrences<'a> {
impl Default for RawOccurrences<'_> {
fn default() -> Self {
static EMPTY: [Vec<OsString>; 0] = [];
RawOccurrences {
Expand Down Expand Up @@ -1853,7 +1853,7 @@ where
}
}

impl<'a> ExactSizeIterator for RawOccurrenceValues<'a> {}
impl ExactSizeIterator for RawOccurrenceValues<'_> {}

/// Iterate over indices for where an argument appeared when parsing, via [`ArgMatches::indices_of`]
///
Expand Down Expand Up @@ -1882,7 +1882,7 @@ pub struct Indices<'a> {
len: usize,
}

impl<'a> Iterator for Indices<'a> {
impl Iterator for Indices<'_> {
type Item = usize;

fn next(&mut self) -> Option<usize> {
Expand All @@ -1898,7 +1898,7 @@ impl<'a> Iterator for Indices<'a> {
}
}

impl<'a> DoubleEndedIterator for Indices<'a> {
impl DoubleEndedIterator for Indices<'_> {
fn next_back(&mut self) -> Option<usize> {
if let Some(next) = self.iter.next_back() {
self.len -= 1;
Expand All @@ -1909,10 +1909,10 @@ impl<'a> DoubleEndedIterator for Indices<'a> {
}
}

impl<'a> ExactSizeIterator for Indices<'a> {}
impl ExactSizeIterator for Indices<'_> {}

/// Creates an empty iterator.
impl<'a> Default for Indices<'a> {
impl Default for Indices<'_> {
fn default() -> Self {
static EMPTY: [usize; 0] = [];
// This is never called because the iterator is empty:
Expand Down
2 changes: 1 addition & 1 deletion clap_builder/src/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ impl<'cmd> Parser<'cmd> {
}

// Error, Help, and Version Methods
impl<'cmd> Parser<'cmd> {
impl Parser<'_> {
/// Is only used for the long flag(which is the only one needs fuzzy searching)
fn did_you_mean_error(
&mut self,
Expand Down
4 changes: 2 additions & 2 deletions clap_builder/src/util/flat_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> {
}
}

impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {}
impl<K, V> ExactSizeIterator for Iter<'_, K, V> {}

pub(crate) struct IterMut<'a, K, V> {
keys: std::slice::IterMut<'a, K>,
Expand Down Expand Up @@ -251,4 +251,4 @@ impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> {
}
}

impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {}
impl<K, V> ExactSizeIterator for IterMut<'_, K, V> {}
2 changes: 1 addition & 1 deletion clap_lex/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ pub struct Split<'s, 'n> {
needle: &'n str,
}

impl<'s, 'n> Iterator for Split<'s, 'n> {
impl<'s> Iterator for Split<'s, '_> {
type Item = &'s OsStr;

fn next(&mut self) -> Option<Self::Item> {
Expand Down

0 comments on commit d90cab0

Please sign in to comment.