style: Make clippy happy

This commit is contained in:
Ed Page 2024-11-29 10:16:50 -06:00
parent 10c4f63463
commit d90cab02b8
8 changed files with 24 additions and 24 deletions

View file

@ -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 {

View file

@ -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)

View file

@ -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");
@ -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) {
@ -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!(

View file

@ -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");

View file

@ -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`].
///
@ -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<'_> {
@ -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;
@ -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 {
@ -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 {
@ -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 {
@ -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`]
///
@ -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> {
@ -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;
@ -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:

View file

@ -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,

View file

@ -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>,
@ -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> {}

View file

@ -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> {