Skip to content

Commit

Permalink
fix: navigate to label directly when perform 'goto-def' on control-fl…
Browse files Browse the repository at this point in the history
  • Loading branch information
roife committed Jul 19, 2024
1 parent fe353c8 commit c3a95fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ fn try_find_loop(
if blk.label().is_some() && label_matches(blk.label()) =>
{
let expr = ast::Expr::BlockExpr(blk.clone());
let lbl_tok = blk.label().unwrap().lifetime()?.lifetime_ident_token()?.into();
let nav = NavigationTarget::from_expr(db, InFile::new(file_id, expr), lbl_tok);
let lbl = blk.label().unwrap().syntax().clone().into();
let nav = NavigationTarget::from_expr(db, InFile::new(file_id, expr), lbl);
return Some(nav);
}
_ => {}
Expand Down Expand Up @@ -2618,7 +2618,7 @@ fn main() {
r#"
fn main() {
'a:{
// ^^
// ^^^
break$0 'a;
}
}
Expand Down

0 comments on commit c3a95fa

Please sign in to comment.