@@ -47,7 +47,7 @@ async fn test_did_open_stores_file() {
4747 backend. did_open ( params) . await ;
4848
4949 // Verify the file was stored by checking the AST map has an entry
50- let classes = backend. get_classes_for_uri ( & uri. to_string ( ) ) ;
50+ let classes = backend. get_classes_for_uri ( uri. as_ref ( ) ) ;
5151 assert ! (
5252 classes. is_some( ) ,
5353 "AST map should have an entry after did_open"
@@ -121,7 +121,7 @@ async fn test_did_change_updates_content() {
121121 } ;
122122 backend. did_open ( open_params) . await ;
123123
124- let classes = backend. get_classes_for_uri ( & uri. to_string ( ) ) . unwrap ( ) ;
124+ let classes = backend. get_classes_for_uri ( uri. as_ref ( ) ) . unwrap ( ) ;
125125 assert_eq ! ( classes[ 0 ] . methods. len( ) , 1 ) ;
126126
127127 // Change the content to add a second method
@@ -139,7 +139,7 @@ async fn test_did_change_updates_content() {
139139 backend. did_change ( change_params) . await ;
140140
141141 // Verify content was updated by checking the re-parsed AST
142- let classes = backend. get_classes_for_uri ( & uri. to_string ( ) ) . unwrap ( ) ;
142+ let classes = backend. get_classes_for_uri ( uri. as_ref ( ) ) . unwrap ( ) ;
143143 assert_eq ! (
144144 classes[ 0 ] . methods. len( ) ,
145145 2 ,
@@ -164,7 +164,7 @@ async fn test_did_close_removes_file() {
164164 } ;
165165 backend. did_open ( open_params) . await ;
166166
167- assert ! ( backend. get_classes_for_uri( & uri. to_string ( ) ) . is_some( ) ) ;
167+ assert ! ( backend. get_classes_for_uri( uri. as_ref ( ) ) . is_some( ) ) ;
168168
169169 // Close the file
170170 let close_params = DidCloseTextDocumentParams {
@@ -174,7 +174,7 @@ async fn test_did_close_removes_file() {
174174
175175 // AST map entry should be removed after close
176176 assert ! (
177- backend. get_classes_for_uri( & uri. to_string ( ) ) . is_none( ) ,
177+ backend. get_classes_for_uri( uri. as_ref ( ) ) . is_none( ) ,
178178 "After close, AST map should not have an entry"
179179 ) ;
180180}
@@ -198,7 +198,7 @@ async fn test_did_open_populates_ast_map() {
198198 backend. did_open ( params) . await ;
199199
200200 let classes = backend
201- . get_classes_for_uri ( & uri. to_string ( ) )
201+ . get_classes_for_uri ( uri. as_ref ( ) )
202202 . expect ( "ast_map should have entry for URI" ) ;
203203 assert_eq ! ( classes. len( ) , 1 ) ;
204204 assert_eq ! ( classes[ 0 ] . name, "User" ) ;
@@ -226,7 +226,7 @@ async fn test_did_change_reparses_ast() {
226226 } ;
227227 backend. did_open ( open_params) . await ;
228228
229- let classes = backend. get_classes_for_uri ( & uri. to_string ( ) ) . unwrap ( ) ;
229+ let classes = backend. get_classes_for_uri ( uri. as_ref ( ) ) . unwrap ( ) ;
230230 assert_eq ! ( classes[ 0 ] . methods. len( ) , 1 ) ;
231231 assert_eq ! ( classes[ 0 ] . methods[ 0 ] . name, "first" ) ;
232232
@@ -246,14 +246,14 @@ async fn test_did_change_reparses_ast() {
246246 backend. did_change ( change_params) . await ;
247247
248248 // Verify the AST was re-parsed
249- let classes = backend. get_classes_for_uri ( & uri. to_string ( ) ) . unwrap ( ) ;
249+ let classes = backend. get_classes_for_uri ( uri. as_ref ( ) ) . unwrap ( ) ;
250250 assert_eq ! ( classes[ 0 ] . methods. len( ) , 2 ) ;
251251 let method_names: Vec < & str > = classes[ 0 ] . methods . iter ( ) . map ( |m| m. name . as_str ( ) ) . collect ( ) ;
252252 assert ! ( method_names. contains( & "first" ) ) ;
253253 assert ! ( method_names. contains( & "second" ) ) ;
254254
255255 // Verify the AST was re-parsed and has both methods
256- let classes = backend. get_classes_for_uri ( & uri. to_string ( ) ) . unwrap ( ) ;
256+ let classes = backend. get_classes_for_uri ( uri. as_ref ( ) ) . unwrap ( ) ;
257257 assert_eq ! ( classes[ 0 ] . methods. len( ) , 2 ) ;
258258 let method_names: Vec < & str > = classes[ 0 ] . methods . iter ( ) . map ( |m| m. name . as_str ( ) ) . collect ( ) ;
259259 assert ! ( method_names. contains( & "first" ) ) ;
@@ -279,7 +279,7 @@ async fn test_did_close_cleans_up_ast_map() {
279279 backend. did_open ( open_params) . await ;
280280
281281 // Verify ast_map is populated
282- assert ! ( backend. get_classes_for_uri( & uri. to_string ( ) ) . is_some( ) ) ;
282+ assert ! ( backend. get_classes_for_uri( uri. as_ref ( ) ) . is_some( ) ) ;
283283
284284 // Close
285285 let close_params = DidCloseTextDocumentParams {
@@ -289,7 +289,7 @@ async fn test_did_close_cleans_up_ast_map() {
289289
290290 // Verify ast_map entry was removed
291291 assert ! (
292- backend. get_classes_for_uri( & uri. to_string ( ) ) . is_none( ) ,
292+ backend. get_classes_for_uri( uri. as_ref ( ) ) . is_none( ) ,
293293 "ast_map should be cleaned up after did_close"
294294 ) ;
295295}
0 commit comments