From d90cab02b82938bb886dc42cd262014fdace2e7b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 29 Nov 2024 10:16:50 -0600 Subject: [PATCH] style: Make clippy happy --- clap_builder/src/builder/command.rs | 2 +- clap_builder/src/error/format.rs | 2 +- clap_builder/src/output/help_template.rs | 6 ++-- clap_builder/src/output/usage.rs | 2 +- .../src/parser/matches/arg_matches.rs | 28 +++++++++---------- clap_builder/src/parser/parser.rs | 2 +- clap_builder/src/util/flat_map.rs | 4 +-- clap_lex/src/ext.rs | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/clap_builder/src/builder/command.rs b/clap_builder/src/builder/command.rs index 0bdb6a74da7..b019d0085ea 100644 --- a/clap_builder/src/builder/command.rs +++ b/clap_builder/src/builder/command.rs @@ -4848,7 +4848,7 @@ impl Command { /// A workaround: /// pub(crate) trait Captures<'a> {} -impl<'a, T> Captures<'a> for T {} +impl Captures<'_> for T {} // Internal Query Methods impl Command { diff --git a/clap_builder/src/error/format.rs b/clap_builder/src/error/format.rs index 5126ea567d7..4c22bc2d9d6 100644 --- a/clap_builder/src/error/format.rs +++ b/clap_builder/src/error/format.rs @@ -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) diff --git a/clap_builder/src/output/help_template.rs b/clap_builder/src/output/help_template.rs index da08ccd3895..3b3fc3d9840 100644 --- a/clap_builder/src/output/help_template.rs +++ b/clap_builder/src/output/help_template.rs @@ -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!( diff --git a/clap_builder/src/output/usage.rs b/clap_builder/src/output/usage.rs index d1b861c6ac0..7c4ddc5ffca 100644 --- a/clap_builder/src/output/usage.rs +++ b/clap_builder/src/output/usage.rs @@ -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"); diff --git a/clap_builder/src/parser/matches/arg_matches.rs b/clap_builder/src/parser/matches/arg_matches.rs index 90fbb59f6ca..5e4d9dcd48e 100644 --- a/clap_builder/src/parser/matches/arg_matches.rs +++ b/clap_builder/src/parser/matches/arg_matches.rs @@ -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 { 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; 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 Default for OccurrencesRef<'_, T> { fn default() -> Self { static EMPTY: [Vec; 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.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; 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 { @@ -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 { 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: diff --git a/clap_builder/src/parser/parser.rs b/clap_builder/src/parser/parser.rs index e6d57419cd1..2949c3e1382 100644 --- a/clap_builder/src/parser/parser.rs +++ b/clap_builder/src/parser/parser.rs @@ -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, diff --git a/clap_builder/src/util/flat_map.rs b/clap_builder/src/util/flat_map.rs index cb4c7da89f6..d739b922211 100644 --- a/clap_builder/src/util/flat_map.rs +++ b/clap_builder/src/util/flat_map.rs @@ -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 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 ExactSizeIterator for IterMut<'_, K, V> {} diff --git a/clap_lex/src/ext.rs b/clap_lex/src/ext.rs index 5552f2b9323..fe2ac9bb836 100644 --- a/clap_lex/src/ext.rs +++ b/clap_lex/src/ext.rs @@ -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 {