aboutsummaryrefslogtreecommitdiff
path: root/helix-loader
diff options
context:
space:
mode:
authorZJPzjp2023-05-11 05:44:52 +0000
committerGitHub2023-05-11 05:44:52 +0000
commit3b8c15618f51889ffd2f2f4be32f8404c1517956 (patch)
treee3083a28d98fe1faf45fc37b9bdd28340fd6186e /helix-loader
parent1e5997dc98ecd82b09ccee9fbe8d5350fd333fad (diff)
Fix warnings from clippy (#7013)
* Fix warnings from clippy * revert MAIN_SEPARATOR_STR
Diffstat (limited to 'helix-loader')
-rw-r--r--helix-loader/src/lib.rs36
1 files changed, 18 insertions, 18 deletions
diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs
index 6c716975..ad4ad899 100644
--- a/helix-loader/src/lib.rs
+++ b/helix-loader/src/lib.rs
@@ -209,6 +209,24 @@ pub fn merge_toml_values(left: toml::Value, right: toml::Value, merge_depth: usi
}
}
+/// Finds the current workspace folder.
+/// Used as a ceiling dir for LSP root resolution, the filepicker and potentially as a future filewatching root
+///
+/// This function starts searching the FS upward from the CWD
+/// and returns the first directory that contains either `.git` or `.helix`.
+/// If no workspace was found returns (CWD, true).
+/// Otherwise (workspace, false) is returned
+pub fn find_workspace() -> (PathBuf, bool) {
+ let current_dir = std::env::current_dir().expect("unable to determine current directory");
+ for ancestor in current_dir.ancestors() {
+ if ancestor.join(".git").exists() || ancestor.join(".helix").exists() {
+ return (ancestor.to_owned(), false);
+ }
+ }
+
+ (current_dir, true)
+}
+
#[cfg(test)]
mod merge_toml_tests {
use std::str;
@@ -281,21 +299,3 @@ mod merge_toml_tests {
)
}
}
-
-/// Finds the current workspace folder.
-/// Used as a ceiling dir for LSP root resolution, the filepicker and potentially as a future filewatching root
-///
-/// This function starts searching the FS upward from the CWD
-/// and returns the first directory that contains either `.git` or `.helix`.
-/// If no workspace was found returns (CWD, true).
-/// Otherwise (workspace, false) is returned
-pub fn find_workspace() -> (PathBuf, bool) {
- let current_dir = std::env::current_dir().expect("unable to determine current directory");
- for ancestor in current_dir.ancestors() {
- if ancestor.join(".git").exists() || ancestor.join(".helix").exists() {
- return (ancestor.to_owned(), false);
- }
- }
-
- (current_dir, true)
-}