Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix Clippy warnings in `fs` (#8696)
Marshall Bowers26fdd149e1bf
diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rsindex 87264d26e2c..968ab68389b 100644--- a/crates/fs/src/fs.rs+++ b/crates/fs/src/fs.rs@@ -376,10 +376,10 @@ impl Fs for RealFs {}fn open_repo(&self, dotgit_path: &Path) -> Option<Arc<Mutex<dyn GitRepository>>> {- LibGitRepository::open(&dotgit_path)+ LibGitRepository::open(dotgit_path).log_err()- .and_then::<Arc<Mutex<dyn GitRepository>>, _>(|libgit_repository| {- Some(Arc::new(Mutex::new(libgit_repository)))+ .map::<Arc<Mutex<dyn GitRepository>>, _>(|libgit_repository| {+ Arc::new(Mutex::new(libgit_repository))})}@@ -474,15 +474,15 @@ enum FakeFsEntry {#[cfg(any(test, feature = "test-support"))]impl FakeFsState {- fn read_path<'a>(&'a self, target: &Path) -> Result<Arc<Mutex<FakeFsEntry>>> {+ fn read_path(&self, target: &Path) -> Result<Arc<Mutex<FakeFsEntry>>> {Ok(self.try_read_path(target, true).ok_or_else(|| anyhow!("path does not exist: {}", target.display()))?.0)}- fn try_read_path<'a>(- &'a self,+ fn try_read_path(+ &self,target: &Path,follow_symlink: bool,) -> Option<(Arc<Mutex<FakeFsEntry>>, PathBuf)> {@@ -625,7 +625,7 @@ impl FakeFs {}}).unwrap();- state.emit_event(&[path]);+ state.emit_event([path]);}fn write_file_internal(&self, path: impl AsRef<Path>, content: Vec<u8>) -> Result<()> {@@ -651,7 +651,7 @@ impl FakeFs {}Ok(())})?;- state.emit_event(&[path]);+ state.emit_event([path]);Ok(())}@@ -785,7 +785,7 @@ impl FakeFs {state.worktree_statuses.extend(statuses.iter()- .map(|(path, content)| ((**path).into(), content.clone())),+ .map(|(path, content)| ((**path).into(), *content)),);});self.state.lock().emit_event(@@ -805,7 +805,7 @@ impl FakeFs {state.worktree_statuses.extend(statuses.iter()- .map(|(path, content)| ((**path).into(), content.clone())),+ .map(|(path, content)| ((**path).into(), *content)),);});}@@ -990,7 +990,7 @@ impl Fs for FakeFs {}Ok(())})?;- state.emit_event(&[path]);+ state.emit_event([path]);Ok(())}diff --git a/crates/fs/src/repository.rs b/crates/fs/src/repository.rsindex 66dd0503cf0..ae69025f0ad 100644--- a/crates/fs/src/repository.rs+++ b/crates/fs/src/repository.rs@@ -363,19 +363,19 @@ impl GitFileStatus {) -> Option<GitFileStatus> {if prefer_other {return other;- } else {- match (this, other) {- (Some(GitFileStatus::Conflict), _) | (_, Some(GitFileStatus::Conflict)) => {- Some(GitFileStatus::Conflict)- }- (Some(GitFileStatus::Modified), _) | (_, Some(GitFileStatus::Modified)) => {- Some(GitFileStatus::Modified)- }- (Some(GitFileStatus::Added), _) | (_, Some(GitFileStatus::Added)) => {- Some(GitFileStatus::Added)- }- _ => None,+ }++ match (this, other) {+ (Some(GitFileStatus::Conflict), _) | (_, Some(GitFileStatus::Conflict)) => {+ Some(GitFileStatus::Conflict)+ }+ (Some(GitFileStatus::Modified), _) | (_, Some(GitFileStatus::Modified)) => {+ Some(GitFileStatus::Modified)+ }+ (Some(GitFileStatus::Added), _) | (_, Some(GitFileStatus::Added)) => {+ Some(GitFileStatus::Added)}+ _ => None,}}}@@ -428,7 +428,7 @@ pub struct RepoPathDescendants<'a>(pub &'a Path);impl<'a> MapSeekTarget<RepoPath> for RepoPathDescendants<'a> {fn cmp_cursor(&self, key: &RepoPath) -> Ordering {- if key.starts_with(&self.0) {+ if key.starts_with(self.0) {Ordering::Greater} else {self.0.cmp(key)