Skip to content

Commit

Permalink
chore: Cleanup around irrefutable let patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
WillLillis committed Nov 4, 2024
1 parent 5e0c38d commit c23ce82
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions asm-lsp/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1836,10 +1836,7 @@ fn get_project_root(params: &InitializeParams) -> Option<PathBuf> {
if let Some(folders) = &params.workspace_folders {
// if there's multiple, just visit in order until we find a valid folder
for folder in folders {
#[allow(irrefutable_let_patterns)] // TODO: Remove once CI is bumped past 1.82
let Ok(parsed) = PathBuf::from_str(folder.uri.path().as_str()) else {
unreachable!()
};
let Ok(parsed) = PathBuf::from_str(folder.uri.path().as_str());
if let Ok(parsed_path) = parsed.canonicalize() {
info!("Detected project root: {}", parsed_path.display());
return Some(parsed_path);
Expand All @@ -1850,10 +1847,7 @@ fn get_project_root(params: &InitializeParams) -> Option<PathBuf> {
// if workspace folders weren't set or came up empty, we check the root_uri
#[allow(deprecated)]
if let Some(root_uri) = &params.root_uri {
#[allow(irrefutable_let_patterns)] // TODO: Remove once CI is bumped past 1.82
let Ok(parsed) = PathBuf::from_str(root_uri.path().as_str()) else {
unreachable!()
};
let Ok(parsed) = PathBuf::from_str(root_uri.path().as_str());
if let Ok(parsed_path) = parsed.canonicalize() {
info!("Detected project root: {}", parsed_path.display());
return Some(parsed_path);
Expand All @@ -1863,10 +1857,7 @@ fn get_project_root(params: &InitializeParams) -> Option<PathBuf> {
// if both `workspace_folders` and `root_uri` weren't set or came up empty, we check the root_path
#[allow(deprecated)]
if let Some(root_path) = &params.root_path {
#[allow(irrefutable_let_patterns)] // TODO: Remove once CI is bumped past 1.82
let Ok(parsed) = PathBuf::from_str(root_path.as_str()) else {
unreachable!()
};
let Ok(parsed) = PathBuf::from_str(root_path.as_str());
if let Ok(parsed_path) = parsed.canonicalize() {
return Some(parsed_path);
}
Expand Down

0 comments on commit c23ce82

Please sign in to comment.