Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 9747636

Browse files
committed
Simplify Project::root
1 parent a7d4a8c commit 9747636

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

tests/support/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ impl ProjectBuilder {
365365
}
366366

367367
impl Project {
368-
pub fn root(&self) -> PathBuf {
369-
self.root.clone()
368+
pub fn root(&self) -> &Path {
369+
&self.root
370370
}
371371

372372
pub fn spawn_rls(&self) -> RlsHandle {

tests/tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fn cmd_changing_workspace_lib_retains_bin_diagnostics() {
330330
}
331331
],
332332
"textDocument": {
333-
"uri": format!("file://{}/library/src/lib.rs", root_path.as_path().display()),
333+
"uri": format!("file://{}/library/src/lib.rs", root_path.display()),
334334
"version": 0
335335
}
336336
})),
@@ -385,7 +385,7 @@ fn cmd_changing_workspace_lib_retains_bin_diagnostics() {
385385
}
386386
],
387387
"textDocument": {
388-
"uri": format!("file://{}/library/src/lib.rs", root_path.as_path().display()),
388+
"uri": format!("file://{}/library/src/lib.rs", root_path.display()),
389389
"version": 1
390390
}
391391
})),
@@ -501,7 +501,7 @@ fn cmd_implicit_workspace_pick_up_lib_changes() {
501501
}
502502
],
503503
"textDocument": {
504-
"uri": format!("file://{}/inner/src/lib.rs", root_path.as_path().display()),
504+
"uri": format!("file://{}/inner/src/lib.rs", root_path.display()),
505505
"version": 0
506506
}
507507
})),
@@ -543,7 +543,7 @@ fn cmd_implicit_workspace_pick_up_lib_changes() {
543543
}
544544
],
545545
"textDocument": {
546-
"uri": format!("file://{}/inner/src/lib.rs", root_path.as_path().display()),
546+
"uri": format!("file://{}/inner/src/lib.rs", root_path.display()),
547547
"version": 1
548548
}
549549
})),
@@ -640,7 +640,7 @@ fn cmd_test_complete_self_crate_name() {
640640
"line": 2
641641
},
642642
"textDocument": {
643-
"uri": format!("file://{}/library/tests/test.rs", root_path.as_path().display()),
643+
"uri": format!("file://{}/library/tests/test.rs", root_path.display()),
644644
"version": 1
645645
}
646646
})),
@@ -734,7 +734,7 @@ fn test_completion_suggests_arguments_in_statements() {
734734
"line": 3
735735
},
736736
"textDocument": {
737-
"uri": format!("file://{}/library/tests/test.rs", root_path.as_path().display()),
737+
"uri": format!("file://{}/library/tests/test.rs", root_path.display()),
738738
"version": 1
739739
}
740740
})),
@@ -819,7 +819,7 @@ fn test_use_statement_completion_doesnt_suggest_arguments() {
819819
"line": 2
820820
},
821821
"textDocument": {
822-
"uri": format!("file://{}/library/tests/test.rs", root_path.as_path().display()),
822+
"uri": format!("file://{}/library/tests/test.rs", root_path.display()),
823823
"version": 1
824824
}
825825
})),
@@ -924,7 +924,7 @@ fn cmd_dependency_typo_and_fix() {
924924
"workspace/didChangeWatchedFiles",
925925
Some(json!({
926926
"changes": [{
927-
"uri": format!("file://{}/Cargo.toml", root_path.as_path().display()),
927+
"uri": format!("file://{}/Cargo.toml", root_path.display()),
928928
"type": 2
929929
}],
930930
})),
@@ -951,7 +951,7 @@ fn cmd_dependency_typo_and_fix() {
951951
"workspace/didChangeWatchedFiles",
952952
Some(json!({
953953
"changes": [{
954-
"uri": format!("file://{}/Cargo.toml", root_path.as_path().display()),
954+
"uri": format!("file://{}/Cargo.toml", root_path.display()),
955955
"type": 2
956956
}],
957957
})),
@@ -1220,7 +1220,7 @@ fn cmd_handle_utf16_unit_text_edits() {
12201220
"textDocument/didChange",
12211221
Some(json!(
12221222
{"textDocument": {
1223-
"uri": format!("file://{}/src/unrelated.rs", root_path.as_path().display()),
1223+
"uri": format!("file://{}/src/unrelated.rs", root_path.display()),
12241224
"version": 1
12251225
},
12261226
// "😢" -> ""
@@ -1283,7 +1283,7 @@ fn cmd_format_utf16_range() {
12831283
Some(json!(
12841284
{
12851285
"textDocument": {
1286-
"uri": format!("file://{}/src/main.rs", root_path.as_path().display()),
1286+
"uri": format!("file://{}/src/main.rs", root_path.display()),
12871287
"version": 1
12881288
},
12891289
"options": {

0 commit comments

Comments
 (0)