mirror of
https://github.com/clap-rs/clap
synced 2024-12-04 18:19:13 +00:00
style: Make clippy happy
This commit is contained in:
parent
10c4f63463
commit
d90cab02b8
8 changed files with 24 additions and 24 deletions
|
@ -4848,7 +4848,7 @@ impl Command {
|
||||||
/// A workaround:
|
/// A workaround:
|
||||||
/// <https://github.com/rust-lang/rust/issues/34511#issuecomment-373423999>
|
/// <https://github.com/rust-lang/rust/issues/34511#issuecomment-373423999>
|
||||||
pub(crate) trait Captures<'a> {}
|
pub(crate) trait Captures<'a> {}
|
||||||
impl<'a, T> Captures<'a> for T {}
|
impl<T> Captures<'_> for T {}
|
||||||
|
|
||||||
// Internal Query Methods
|
// Internal Query Methods
|
||||||
impl Command {
|
impl Command {
|
||||||
|
|
|
@ -494,7 +494,7 @@ fn did_you_mean(styled: &mut StyledStr, styles: &Styles, context: &str, possible
|
||||||
|
|
||||||
struct Escape<'s>(&'s str);
|
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 {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
if self.0.contains(char::is_whitespace) {
|
if self.0.contains(char::is_whitespace) {
|
||||||
std::fmt::Debug::fmt(self.0, f)
|
std::fmt::Debug::fmt(self.0, f)
|
||||||
|
|
|
@ -250,7 +250,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Basic template methods
|
/// Basic template methods
|
||||||
impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
|
impl HelpTemplate<'_, '_> {
|
||||||
/// Writes binary name of a Parser Object to the wrapped stream.
|
/// Writes binary name of a Parser Object to the wrapped stream.
|
||||||
fn write_display_name(&mut self) {
|
fn write_display_name(&mut self) {
|
||||||
debug!("HelpTemplate::write_display_name");
|
debug!("HelpTemplate::write_display_name");
|
||||||
|
@ -364,7 +364,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Arg handling
|
/// Arg handling
|
||||||
impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
|
impl HelpTemplate<'_, '_> {
|
||||||
/// Writes help for all arguments (options, flags, args, subcommands)
|
/// Writes help for all arguments (options, flags, args, subcommands)
|
||||||
/// including titles of a Parser Object to the wrapped stream.
|
/// including titles of a Parser Object to the wrapped stream.
|
||||||
pub(crate) fn write_all_args(&mut self) {
|
pub(crate) fn write_all_args(&mut self) {
|
||||||
|
@ -847,7 +847,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subcommand handling
|
/// Subcommand handling
|
||||||
impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
|
impl HelpTemplate<'_, '_> {
|
||||||
/// Writes help for subcommands of a Parser Object to the wrapped stream.
|
/// Writes help for subcommands of a Parser Object to the wrapped stream.
|
||||||
fn write_flat_subcommands(&mut self, cmd: &Command, first: &mut bool) {
|
fn write_flat_subcommands(&mut self, cmd: &Command, first: &mut bool) {
|
||||||
debug!(
|
debug!(
|
||||||
|
|
|
@ -97,7 +97,7 @@ impl<'cmd> Usage<'cmd> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "usage")]
|
#[cfg(feature = "usage")]
|
||||||
impl<'cmd> Usage<'cmd> {
|
impl Usage<'_> {
|
||||||
// Creates a usage string for display in help messages (i.e. not for errors)
|
// Creates a usage string for display in help messages (i.e. not for errors)
|
||||||
fn write_help_usage(&self, styled: &mut StyledStr) {
|
fn write_help_usage(&self, styled: &mut StyledStr) {
|
||||||
debug!("Usage::write_help_usage");
|
debug!("Usage::write_help_usage");
|
||||||
|
|
|
@ -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`].
|
/// 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.
|
/// Creates an empty iterator.
|
||||||
impl Default for RawValues<'_> {
|
impl Default for RawValues<'_> {
|
||||||
|
@ -1629,7 +1629,7 @@ impl<'a> Iterator for GroupedValues<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
impl<'a> DoubleEndedIterator for GroupedValues<'a> {
|
impl DoubleEndedIterator for GroupedValues<'_> {
|
||||||
fn next_back(&mut self) -> Option<Self::Item> {
|
fn next_back(&mut self) -> Option<Self::Item> {
|
||||||
if let Some(next) = self.iter.next_back() {
|
if let Some(next) = self.iter.next_back() {
|
||||||
self.len -= 1;
|
self.len -= 1;
|
||||||
|
@ -1641,11 +1641,11 @@ impl<'a> DoubleEndedIterator for GroupedValues<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
impl<'a> ExactSizeIterator for GroupedValues<'a> {}
|
impl ExactSizeIterator for GroupedValues<'_> {}
|
||||||
|
|
||||||
/// Creates an empty iterator. Used for `unwrap_or_default()`.
|
/// Creates an empty iterator. Used for `unwrap_or_default()`.
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
impl<'a> Default for GroupedValues<'a> {
|
impl Default for GroupedValues<'_> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
static EMPTY: [Vec<AnyValue>; 0] = [];
|
static EMPTY: [Vec<AnyValue>; 0] = [];
|
||||||
GroupedValues {
|
GroupedValues {
|
||||||
|
@ -1747,7 +1747,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> ExactSizeIterator for OccurrencesRef<'a, T> where Self: 'a {}
|
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 {
|
fn default() -> Self {
|
||||||
static EMPTY: [Vec<AnyValue>; 0] = [];
|
static EMPTY: [Vec<AnyValue>; 0] = [];
|
||||||
OccurrencesRef {
|
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> {
|
fn next_back(&mut self) -> Option<Self::Item> {
|
||||||
self.iter.next_back()
|
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 {
|
fn default() -> Self {
|
||||||
static EMPTY: [Vec<OsString>; 0] = [];
|
static EMPTY: [Vec<OsString>; 0] = [];
|
||||||
RawOccurrences {
|
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`]
|
/// Iterate over indices for where an argument appeared when parsing, via [`ArgMatches::indices_of`]
|
||||||
///
|
///
|
||||||
|
@ -1882,7 +1882,7 @@ pub struct Indices<'a> {
|
||||||
len: usize,
|
len: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for Indices<'a> {
|
impl Iterator for Indices<'_> {
|
||||||
type Item = usize;
|
type Item = usize;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<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> {
|
fn next_back(&mut self) -> Option<usize> {
|
||||||
if let Some(next) = self.iter.next_back() {
|
if let Some(next) = self.iter.next_back() {
|
||||||
self.len -= 1;
|
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.
|
/// Creates an empty iterator.
|
||||||
impl<'a> Default for Indices<'a> {
|
impl Default for Indices<'_> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
static EMPTY: [usize; 0] = [];
|
static EMPTY: [usize; 0] = [];
|
||||||
// This is never called because the iterator is empty:
|
// This is never called because the iterator is empty:
|
||||||
|
|
|
@ -1541,7 +1541,7 @@ impl<'cmd> Parser<'cmd> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error, Help, and Version Methods
|
// 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)
|
/// Is only used for the long flag(which is the only one needs fuzzy searching)
|
||||||
fn did_you_mean_error(
|
fn did_you_mean_error(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
|
@ -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> {
|
pub(crate) struct IterMut<'a, K, V> {
|
||||||
keys: std::slice::IterMut<'a, K>,
|
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> {}
|
||||||
|
|
|
@ -249,7 +249,7 @@ pub struct Split<'s, 'n> {
|
||||||
needle: &'n str,
|
needle: &'n str,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s, 'n> Iterator for Split<'s, 'n> {
|
impl<'s> Iterator for Split<'s, '_> {
|
||||||
type Item = &'s OsStr;
|
type Item = &'s OsStr;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
|
Loading…
Reference in a new issue