Clippy and update lockfile (#646)

This commit is contained in:
Félix Saparelli 2023-08-30 15:43:57 +12:00 committed by GitHub
parent 96bf3d231e
commit 4c3b9f0960
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 541 additions and 533 deletions

1023
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -155,4 +155,4 @@ _watchexec() {
esac
}
complete -F _watchexec -o bashdefault -o default watchexec
complete -F _watchexec -o nosort -o bashdefault -o default watchexec

View file

@ -36,7 +36,7 @@ Register-ArgumentCompleter -Native -CommandName 'watchexec' -ScriptBlock {
[CompletionResult]::new('--poll', 'poll', [CompletionResultType]::ParameterName, 'Poll for filesystem changes')
[CompletionResult]::new('--shell', 'shell', [CompletionResultType]::ParameterName, 'Use a different shell')
[CompletionResult]::new('--emit-events-to', 'emit-events-to', [CompletionResultType]::ParameterName, 'Configure event emission')
[CompletionResult]::new('-E', 'E', [CompletionResultType]::ParameterName, 'Add env vars to the command')
[CompletionResult]::new('-E', 'E ', [CompletionResultType]::ParameterName, 'Add env vars to the command')
[CompletionResult]::new('--env', 'env', [CompletionResultType]::ParameterName, 'Add env vars to the command')
[CompletionResult]::new('--project-origin', 'project-origin', [CompletionResultType]::ParameterName, 'Set the project origin')
[CompletionResult]::new('--workdir', 'workdir', [CompletionResultType]::ParameterName, 'Set the working directory')
@ -51,7 +51,7 @@ Register-ArgumentCompleter -Native -CommandName 'watchexec' -ScriptBlock {
[CompletionResult]::new('--fs-events', 'fs-events', [CompletionResultType]::ParameterName, 'Filesystem events to filter to')
[CompletionResult]::new('--log-file', 'log-file', [CompletionResultType]::ParameterName, 'Write diagnostic logs to a file')
[CompletionResult]::new('--completions', 'completions', [CompletionResultType]::ParameterName, 'Generate a shell completions script')
[CompletionResult]::new('-W', 'W', [CompletionResultType]::ParameterName, 'Deprecated alias for ''--on-busy-update=do-nothing''')
[CompletionResult]::new('-W', 'W ', [CompletionResultType]::ParameterName, 'Deprecated alias for ''--on-busy-update=do-nothing''')
[CompletionResult]::new('--watch-when-idle', 'watch-when-idle', [CompletionResultType]::ParameterName, 'Deprecated alias for ''--on-busy-update=do-nothing''')
[CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Restart the process if it''s still running')
[CompletionResult]::new('--restart', 'restart', [CompletionResultType]::ParameterName, 'Restart the process if it''s still running')
@ -69,7 +69,7 @@ Register-ArgumentCompleter -Native -CommandName 'watchexec' -ScriptBlock {
[CompletionResult]::new('--no-environment', 'no-environment', [CompletionResultType]::ParameterName, 'Shorthand for ''--emit-events=none''')
[CompletionResult]::new('--no-process-group', 'no-process-group', [CompletionResultType]::ParameterName, 'Don''t use a process group')
[CompletionResult]::new('-1', '1', [CompletionResultType]::ParameterName, 'Testing only: exit Watchexec after the first run')
[CompletionResult]::new('-N', 'N', [CompletionResultType]::ParameterName, 'Alert when commands start and end')
[CompletionResult]::new('-N', 'N ', [CompletionResultType]::ParameterName, 'Alert when commands start and end')
[CompletionResult]::new('--notify', 'notify', [CompletionResultType]::ParameterName, 'Alert when commands start and end')
[CompletionResult]::new('--no-meta', 'no-meta', [CompletionResultType]::ParameterName, 'Don''t emit fs events for metadata changes')
[CompletionResult]::new('--print-events', 'print-events', [CompletionResultType]::ParameterName, 'Print events that trigger actions')
@ -78,7 +78,7 @@ Register-ArgumentCompleter -Native -CommandName 'watchexec' -ScriptBlock {
[CompletionResult]::new('--manual', 'manual', [CompletionResultType]::ParameterName, 'Show the manual page')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Print version')
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
break
}

View file

@ -110,7 +110,7 @@ pub fn gather_to(filename: &str, structname: &str, public: bool) {
("".to_string(), format!("{crate_version} ({build_date}) {crate_feature_string}\nbuild-date: {build_date}\nrelease: {crate_version}\nfeatures: {crate_feature_list}"))
};
#[cfg(all(feature = "std"))]
#[cfg(feature = "std")]
let long_version_with_fn = r#"
/// Returns the long version string with extra information tacked on
///

View file

@ -187,7 +187,7 @@ pub async fn ignores(args: &Args, vcs_types: &[ProjectType], origin: &Path) -> V
if args.no_global_ignore {
ignores = ignores
.into_iter()
.filter(|ig| !matches!(ig.applies_in, None))
.filter(|ig| ig.applies_in.is_some())
.collect::<Vec<_>>();
debug!(?ignores, "filtered ignores to exclude global ignores");
}
@ -195,7 +195,7 @@ pub async fn ignores(args: &Args, vcs_types: &[ProjectType], origin: &Path) -> V
if args.no_vcs_ignore {
ignores = ignores
.into_iter()
.filter(|ig| matches!(ig.applies_to, None))
.filter(|ig| ig.applies_to.is_none())
.collect::<Vec<_>>();
debug!(?ignores, "filtered ignores to exclude VCS-specific ignores");
}

View file

@ -472,8 +472,8 @@ impl TaggedFilterer {
trace!(?op_filter, "pulling filters from swaplock");
// we want to hold the lock as little as possible, so we clone the filters
fs.iter()
.filter(|&f| f.op == op_filter)
.cloned()
.filter(|f| f.op == op_filter)
.collect::<Vec<_>>()
} else {
trace!(?op_filter, "no filters, erasing compiled glob");

View file

@ -136,7 +136,7 @@ pub async fn from_origin(path: impl AsRef<Path> + Send) -> (Vec<IgnoreFile>, Vec
)
.await
{
dirs.add_last_file_to_filter(&mut files, &mut errors).await;
dirs.add_last_file_to_filter(&files, &mut errors).await;
}
if discover_file(
@ -148,7 +148,7 @@ pub async fn from_origin(path: impl AsRef<Path> + Send) -> (Vec<IgnoreFile>, Vec
)
.await
{
dirs.add_last_file_to_filter(&mut files, &mut errors).await;
dirs.add_last_file_to_filter(&files, &mut errors).await;
}
if discover_file(
@ -160,7 +160,7 @@ pub async fn from_origin(path: impl AsRef<Path> + Send) -> (Vec<IgnoreFile>, Vec
)
.await
{
dirs.add_last_file_to_filter(&mut files, &mut errors).await;
dirs.add_last_file_to_filter(&files, &mut errors).await;
}
}
}
@ -479,7 +479,7 @@ impl DirTourist {
pub(crate) async fn add_last_file_to_filter(
&mut self,
files: &mut [IgnoreFile],
files: &[IgnoreFile],
errors: &mut Vec<Error>,
) {
if let Some(ig) = files.last() {

View file

@ -199,7 +199,11 @@ impl IgnoreFilter {
.display()
.to_string();
let Some(Ignore { builder: Some(ref mut builder), ..}) = self.ignores.get_mut(&applies_in) else {
let Some(Ignore {
builder: Some(ref mut builder),
..
}) = self.ignores.get_mut(&applies_in)
else {
return Ok(());
};
@ -236,7 +240,11 @@ impl IgnoreFilter {
.display()
.to_string();
let Some(Ignore { gitignore: compiled, builder: Some(builder)}) = self.ignores.get(&applies_in) else {
let Some(Ignore {
gitignore: compiled,
builder: Some(builder),
}) = self.ignores.get(&applies_in)
else {
return Ok(());
};
@ -272,7 +280,11 @@ impl IgnoreFilter {
pub fn add_globs(&mut self, globs: &[&str], applies_in: Option<&PathBuf>) -> Result<(), Error> {
let applies_in = applies_in.unwrap_or(&self.origin);
let Some(Ignore {builder: Some(builder), ..}) = self.ignores.get_mut(&applies_in.display().to_string()) else {
let Some(Ignore {
builder: Some(builder),
..
}) = self.ignores.get_mut(&applies_in.display().to_string())
else {
return Ok(());
};

View file

@ -1,4 +1,5 @@
use std::{
mem::take,
sync::Arc,
time::{Duration, Instant},
};
@ -121,7 +122,7 @@ pub async fn worker(
last = Instant::now();
#[allow(clippy::iter_with_drain)]
let events = Arc::from(set.drain(..).collect::<Vec<_>>().into_boxed_slice());
let events = Arc::from(take(&mut set).into_boxed_slice());
let action = Action::new(Arc::clone(&events));
info!(?action, "action constructed");

View file

@ -102,7 +102,7 @@ pub fn summarise_events_to_env<'events>(
// usually there's only one but just in case
for kind in event.tags.iter().filter_map(|t| {
if let Tag::FileEventKind(kind) = t {
Some(kind.clone())
Some(kind)
} else {
None
}

View file

@ -586,7 +586,7 @@ level.
You may want to use with \--log-file to avoid polluting your terminal.
Setting \$RUST_LOG also works, and takes precendence, but is not
Setting \$RUST_LOG also works, and takes precedence, but is not
recommended. However, using \$RUST_LOG is the only way to get logs from
before these options are parsed.

Binary file not shown.