Skip to content

Commit 37f2263

Browse files
authored
Merge pull request #20126 from Wilfred/no_unwrap_in_discover_projects
fix: Avoid .unwrap() when running the discover command
2 parents bc10a25 + e779ea0 commit 37f2263

File tree

1 file changed

+8
-3
lines changed
  • src/tools/rust-analyzer/crates/rust-analyzer/src

1 file changed

+8
-3
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,14 @@ impl GlobalState {
783783
DiscoverProjectParam::Path(it) => DiscoverArgument::Path(it),
784784
};
785785

786-
let handle =
787-
discover.spawn(arg, &std::env::current_dir().unwrap()).unwrap();
788-
self.discover_handle = Some(handle);
786+
let handle = discover.spawn(
787+
arg,
788+
&std::env::current_dir()
789+
.expect("Failed to get cwd during project discovery"),
790+
);
791+
self.discover_handle = Some(handle.unwrap_or_else(|e| {
792+
panic!("Failed to spawn project discovery command: {e}")
793+
}));
789794
}
790795
}
791796
}

0 commit comments

Comments
 (0)