From c563ea8b29c8bb1548d86dcd08b240eda9c94efb Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Fri, 28 Jun 2024 22:40:11 -0700 Subject: [PATCH] clippy: remove warning when not using watchman feature I keep seeing the one in lib/ when running tests in VS Code, but I also fixed the warnings in watchman.rs for good measure. --- cli/src/commands/debug/watchman.rs | 5 +++++ lib/src/local_working_copy.rs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/debug/watchman.rs b/cli/src/commands/debug/watchman.rs index 322cf8743..8c5a67cf1 100644 --- a/cli/src/commands/debug/watchman.rs +++ b/cli/src/commands/debug/watchman.rs @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +#[cfg(feature = "watchman")] use std::any::Any; use std::fmt::Debug; +#[cfg(feature = "watchman")] use std::io::Write as _; use clap::Subcommand; +#[cfg(feature = "watchman")] use jj_lib::fsmonitor::{FsmonitorSettings, WatchmanConfig}; +#[cfg(feature = "watchman")] use jj_lib::local_working_copy::LocalWorkingCopy; use crate::cli_util::CommandHelper; @@ -131,6 +135,7 @@ pub fn cmd_debug_watchman( )) } +#[cfg(feature = "watchman")] fn check_local_disk_wc(x: &dyn Any) -> Result<&LocalWorkingCopy, CommandError> { x.downcast_ref() .ok_or_else(|| user_error("This command requires a standard local-disk working copy")) diff --git a/lib/src/local_working_copy.rs b/lib/src/local_working_copy.rs index 55a7ed677..6e104e74b 100644 --- a/lib/src/local_working_copy.rs +++ b/lib/src/local_working_copy.rs @@ -47,9 +47,9 @@ use crate::backend::{ use crate::commit::Commit; use crate::conflicts::{self, materialize_tree_value, MaterializedTreeValue}; use crate::file_util::{check_symlink_support, try_symlink}; +use crate::fsmonitor::FsmonitorSettings; #[cfg(feature = "watchman")] -use crate::fsmonitor::watchman; -use crate::fsmonitor::{FsmonitorSettings, WatchmanConfig}; +use crate::fsmonitor::{watchman, WatchmanConfig}; use crate::gitignore::GitIgnoreFile; use crate::lock::FileLock; use crate::matchers::{