From 9a60751a901f568bdeb154c4115235d4f3a0f8b9 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 20 Mar 2026 21:54:29 +0800 Subject: Apply clippy suggestions and improve code quality --- systems/_framework/src/space.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'systems/_framework') diff --git a/systems/_framework/src/space.rs b/systems/_framework/src/space.rs index 315bf2b..166120f 100644 --- a/systems/_framework/src/space.rs +++ b/systems/_framework/src/space.rs @@ -52,7 +52,7 @@ impl Space { _ => path.to_path_buf(), }; - if !find_space_root_with(&path, &pattern).is_ok() { + if find_space_root_with(&path, pattern).is_err() { T::create_space(&path).await?; } Ok(()) @@ -98,10 +98,10 @@ impl Space { /// Otherwise, it is found using the pattern from `T::get_pattern()`. pub fn space_dir(&self, current_dir: impl Into) -> Result { // First try to read from cache - if let Ok(lock) = self.space_dir.read() { - if let Some(cached_dir) = lock.as_ref() { - return Ok(cached_dir.clone()); - } + if let Ok(lock) = self.space_dir.read() + && let Some(cached_dir) = lock.as_ref() + { + return Ok(cached_dir.clone()); } // Cache miss, find the space directory @@ -399,7 +399,7 @@ impl AsRef for Space { impl Deref for Space { type Target = T; fn deref(&self) -> &Self::Target { - &self.as_ref() + self.as_ref() } } @@ -427,7 +427,7 @@ pub enum SpaceRootFindPattern { /// /// For the full implementation, see `find_space_root_with` pub fn find_space_root(pattern: &SpaceRootFindPattern) -> Result { - find_space_root_with(¤t_dir()?, &pattern) + find_space_root_with(¤t_dir()?, pattern) } /// Find the space directory containing the specified directory, @@ -500,7 +500,7 @@ pub fn find_space_root_with( path.join(dir_name).is_dir() }), SpaceRootFindPattern::IncludeFile(file_name) => { - Box::new(move |path| path.join(&file_name).is_file()) + Box::new(move |path| path.join(file_name).is_file()) } // For absolute paths, return directly -- cgit