From d275e55f9a8babc6f29eee6dea6248b9d10160a7 Mon Sep 17 00:00:00 2001 From: Racer Engineer Date: Thu, 27 Nov 2025 09:10:24 -0800 Subject: [PATCH] Replace regex Captures::get(0).unwrap() with get_match() Differential Revision: D87978773 --- starlark_lsp/src/definition.rs | 2 +- starlark_lsp/src/test.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/starlark_lsp/src/definition.rs b/starlark_lsp/src/definition.rs index 3117389da..a65f80462 100644 --- a/starlark_lsp/src/definition.rs +++ b/starlark_lsp/src/definition.rs @@ -658,7 +658,7 @@ pub(crate) mod helpers { let mut fixture_idx = 0; for matches in re.captures_iter(fixture) { - let full_tag = matches.get(0).unwrap(); + let full_tag = matches.get_match(); let is_end_tag = matches.get(1).is_some(); let identifier = matches.get(2).unwrap().as_str().to_owned(); diff --git a/starlark_lsp/src/test.rs b/starlark_lsp/src/test.rs index a76f5166c..a4931a574 100644 --- a/starlark_lsp/src/test.rs +++ b/starlark_lsp/src/test.rs @@ -235,10 +235,7 @@ impl LspContext for TestServerContext { let start_pos = cap.get(1).unwrap().as_str().parse().unwrap(); let end_pos = cap.get(2).unwrap().as_str().parse().unwrap(); let span = Span::new(Pos::new(start_pos), Pos::new(end_pos)); - ( - literal[0..cap.get(0).unwrap().start()].to_owned(), - Some(span), - ) + (literal[0..cap.get_match().start()].to_owned(), Some(span)) } None => (literal.to_owned(), None), };