aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/mock_analysis.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-24 10:51:45 +0100
committerAleksey Kladov <[email protected]>2020-06-24 10:51:45 +0100
commit04fe512f0d3567727cfb9ccab166c5344716711a (patch)
tree0d3e1feeb92d40a080653f1e79233f18d161a8ef /crates/ra_ide/src/mock_analysis.rs
parent9d64525daa16eb25c15a97d7dd8e099f6ff102c7 (diff)
Simplify
Diffstat (limited to 'crates/ra_ide/src/mock_analysis.rs')
-rw-r--r--crates/ra_ide/src/mock_analysis.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index 79b796544..b7325bfc3 100644
--- a/crates/ra_ide/src/mock_analysis.rs
+++ b/crates/ra_ide/src/mock_analysis.rs
@@ -79,9 +79,6 @@ pub struct MockAnalysis {
79} 79}
80 80
81impl MockAnalysis { 81impl MockAnalysis {
82 pub fn new() -> MockAnalysis {
83 MockAnalysis::default()
84 }
85 /// Creates `MockAnalysis` using a fixture data in the following format: 82 /// Creates `MockAnalysis` using a fixture data in the following format:
86 /// 83 ///
87 /// ```not_rust 84 /// ```not_rust
@@ -93,7 +90,7 @@ impl MockAnalysis {
93 /// struct Baz; 90 /// struct Baz;
94 /// ``` 91 /// ```
95 pub fn with_files(fixture: &str) -> MockAnalysis { 92 pub fn with_files(fixture: &str) -> MockAnalysis {
96 let mut res = MockAnalysis::new(); 93 let mut res = MockAnalysis::default();
97 for entry in Fixture::parse(fixture) { 94 for entry in Fixture::parse(fixture) {
98 res.add_file_fixture(entry); 95 res.add_file_fixture(entry);
99 } 96 }
@@ -104,7 +101,7 @@ impl MockAnalysis {
104 /// whose position is also returned. 101 /// whose position is also returned.
105 pub fn with_files_and_position(fixture: &str) -> (MockAnalysis, FilePosition) { 102 pub fn with_files_and_position(fixture: &str) -> (MockAnalysis, FilePosition) {
106 let mut position = None; 103 let mut position = None;
107 let mut res = MockAnalysis::new(); 104 let mut res = MockAnalysis::default();
108 for mut entry in Fixture::parse(fixture) { 105 for mut entry in Fixture::parse(fixture) {
109 if entry.text.contains(CURSOR_MARKER) { 106 if entry.text.contains(CURSOR_MARKER) {
110 assert!(position.is_none(), "only one marker (<|>) per fixture is allowed"); 107 assert!(position.is_none(), "only one marker (<|>) per fixture is allowed");
@@ -213,7 +210,7 @@ pub fn single_file(ra_fixture: &str) -> (Analysis, FileId) {
213 210
214/// Creates analysis for a single file, returns range marked with a pair of <|>. 211/// Creates analysis for a single file, returns range marked with a pair of <|>.
215pub fn single_file_with_range(ra_fixture: &str) -> (Analysis, FileRange) { 212pub fn single_file_with_range(ra_fixture: &str) -> (Analysis, FileRange) {
216 let mut mock = MockAnalysis::new(); 213 let mut mock = MockAnalysis::default();
217 let pos = mock.add_file_with_range("/main.rs", ra_fixture); 214 let pos = mock.add_file_with_range("/main.rs", ra_fixture);
218 (mock.analysis(), pos) 215 (mock.analysis(), pos)
219} 216}