aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Du <[email protected]>2018-10-18 00:25:37 +0100
committerAlan Du <[email protected]>2018-10-18 00:42:23 +0100
commita5da770ec60a73abcc5350f25146be973540063f (patch)
treed0384d6a786c3a07689dc4dff04209207487b76b
parentfc8024de51261d252b1ad88566db6e246d14ee16 (diff)
Fix function calls
-rw-r--r--crates/ra_analysis/src/descriptors.rs3
-rw-r--r--crates/ra_analysis/src/imp.rs2
-rw-r--r--crates/ra_editor/src/typing.rs2
-rw-r--r--crates/ra_lsp_server/src/main.rs2
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs4
-rw-r--r--crates/ra_lsp_server/src/project_model.rs1
-rw-r--r--crates/ra_lsp_server/src/vfs.rs1
-rw-r--r--crates/ra_syntax/src/lexer/ptr.rs2
-rw-r--r--crates/ra_syntax/src/reparsing.rs2
-rw-r--r--crates/ra_syntax/src/utils.rs2
10 files changed, 9 insertions, 12 deletions
diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs
index 98429326c..dced99b07 100644
--- a/crates/ra_analysis/src/descriptors.rs
+++ b/crates/ra_analysis/src/descriptors.rs
@@ -183,8 +183,7 @@ impl Link {
183 root: ast::Root<'a>, 183 root: ast::Root<'a>,
184 ) -> ast::Module<'a> { 184 ) -> ast::Module<'a> {
185 modules(root) 185 modules(root)
186 .filter(|(name, _)| name == &tree.link(self).name) 186 .find(|(name, _)| name == &tree.link(self).name)
187 .next()
188 .unwrap() 187 .unwrap()
189 .1 188 .1
190 } 189 }
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 1c16852b8..b4faf0b5b 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -393,7 +393,7 @@ impl AnalysisImpl {
393 393
394 // If we have a method call eat the first param since it's just self. 394 // If we have a method call eat the first param since it's just self.
395 if has_self { 395 if has_self {
396 commas = commas + 1; 396 commas += 1;
397 } 397 }
398 398
399 current_parameter = Some(commas); 399 current_parameter = Some(commas);
diff --git a/crates/ra_editor/src/typing.rs b/crates/ra_editor/src/typing.rs
index 50b52e7a1..5a457d148 100644
--- a/crates/ra_editor/src/typing.rs
+++ b/crates/ra_editor/src/typing.rs
@@ -58,7 +58,7 @@ pub fn join_lines(file: &File, range: TextRange) -> LocalEdit {
58pub fn on_enter(file: &File, offset: TextUnit) -> Option<LocalEdit> { 58pub fn on_enter(file: &File, offset: TextUnit) -> Option<LocalEdit> {
59 let comment = find_leaf_at_offset(file.syntax(), offset) 59 let comment = find_leaf_at_offset(file.syntax(), offset)
60 .left_biased() 60 .left_biased()
61 .and_then(|it| ast::Comment::cast(it))?; 61 .and_then(ast::Comment::cast)?;
62 62
63 if let ast::CommentFlavor::Multiline = comment.flavor() { 63 if let ast::CommentFlavor::Multiline = comment.flavor() {
64 return None; 64 return None;
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index 9f62347f1..c07eb0140 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -18,7 +18,7 @@ fn main() -> Result<()> {
18 .directory("log") 18 .directory("log")
19 .start()?; 19 .start()?;
20 info!("lifecycle: server started"); 20 info!("lifecycle: server started");
21 match ::std::panic::catch_unwind(|| main_inner()) { 21 match ::std::panic::catch_unwind(main_inner) {
22 Ok(res) => { 22 Ok(res) => {
23 info!("lifecycle: terminating process with {:?}", res); 23 info!("lifecycle: terminating process with {:?}", res);
24 res 24 res
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 49bd7895a..3e58e6f54 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -289,8 +289,8 @@ pub fn handle_runnables(
289 .filter_map(|ws| { 289 .filter_map(|ws| {
290 let tgt = ws.target_by_root(path)?; 290 let tgt = ws.target_by_root(path)?;
291 Some(( 291 Some((
292 tgt.package(ws).name(ws).clone(), 292 tgt.package(ws).name(ws),
293 tgt.name(ws).clone(), 293 tgt.name(ws),
294 tgt.kind(ws), 294 tgt.kind(ws),
295 )) 295 ))
296 }) 296 })
diff --git a/crates/ra_lsp_server/src/project_model.rs b/crates/ra_lsp_server/src/project_model.rs
index d170ceb73..cedb67bae 100644
--- a/crates/ra_lsp_server/src/project_model.rs
+++ b/crates/ra_lsp_server/src/project_model.rs
@@ -173,7 +173,6 @@ pub fn workspace_loader() -> (Worker<PathBuf, Result<CargoWorkspace>>, ThreadWat
173 1, 173 1,
174 |input_receiver, output_sender| { 174 |input_receiver, output_sender| {
175 input_receiver 175 input_receiver
176 .into_iter()
177 .map(|path| CargoWorkspace::from_cargo_metadata(path.as_path())) 176 .map(|path| CargoWorkspace::from_cargo_metadata(path.as_path()))
178 .for_each(|it| output_sender.send(it)) 177 .for_each(|it| output_sender.send(it))
179 }, 178 },
diff --git a/crates/ra_lsp_server/src/vfs.rs b/crates/ra_lsp_server/src/vfs.rs
index 417a3c19a..6e317d854 100644
--- a/crates/ra_lsp_server/src/vfs.rs
+++ b/crates/ra_lsp_server/src/vfs.rs
@@ -24,7 +24,6 @@ pub fn roots_loader() -> (Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, ThreadWatc
24 128, 24 128,
25 |input_receiver, output_sender| { 25 |input_receiver, output_sender| {
26 input_receiver 26 input_receiver
27 .into_iter()
28 .map(|path| { 27 .map(|path| {
29 debug!("loading {} ...", path.as_path().display()); 28 debug!("loading {} ...", path.as_path().display());
30 let events = load_root(path.as_path()); 29 let events = load_root(path.as_path());
diff --git a/crates/ra_syntax/src/lexer/ptr.rs b/crates/ra_syntax/src/lexer/ptr.rs
index fa79d8862..4c291b9c4 100644
--- a/crates/ra_syntax/src/lexer/ptr.rs
+++ b/crates/ra_syntax/src/lexer/ptr.rs
@@ -31,7 +31,7 @@ impl<'s> Ptr<'s> {
31 /// For example, 0 will return the current token, 1 will return the next, etc. 31 /// For example, 0 will return the current token, 1 will return the next, etc.
32 pub fn nth(&self, n: u32) -> Option<char> { 32 pub fn nth(&self, n: u32) -> Option<char> {
33 let mut chars = self.chars().peekable(); 33 let mut chars = self.chars().peekable();
34 chars.by_ref().skip(n as usize).next() 34 chars.by_ref().nth(n as usize)
35 } 35 }
36 36
37 /// Checks whether the current character is `c`. 37 /// Checks whether the current character is `c`.
diff --git a/crates/ra_syntax/src/reparsing.rs b/crates/ra_syntax/src/reparsing.rs
index 377152de4..eae01b1d5 100644
--- a/crates/ra_syntax/src/reparsing.rs
+++ b/crates/ra_syntax/src/reparsing.rs
@@ -135,7 +135,7 @@ fn find_reparsable_node(
135} 135}
136 136
137fn is_balanced(tokens: &[Token]) -> bool { 137fn is_balanced(tokens: &[Token]) -> bool {
138 if tokens.len() == 0 138 if tokens.is_empty()
139 || tokens.first().unwrap().kind != L_CURLY 139 || tokens.first().unwrap().kind != L_CURLY
140 || tokens.last().unwrap().kind != R_CURLY 140 || tokens.last().unwrap().kind != R_CURLY
141 { 141 {
diff --git a/crates/ra_syntax/src/utils.rs b/crates/ra_syntax/src/utils.rs
index ca4160378..8ee02724d 100644
--- a/crates/ra_syntax/src/utils.rs
+++ b/crates/ra_syntax/src/utils.rs
@@ -5,7 +5,7 @@ use std::fmt::Write;
5 5
6/// Parse a file and create a string representation of the resulting parse tree. 6/// Parse a file and create a string representation of the resulting parse tree.
7pub fn dump_tree(syntax: SyntaxNodeRef) -> String { 7pub fn dump_tree(syntax: SyntaxNodeRef) -> String {
8 let mut errors: Vec<_> = syntax.root_data().iter().cloned().collect(); 8 let mut errors: Vec<_> = syntax.root_data().to_vec();
9 errors.sort_by_key(|e| e.offset); 9 errors.sort_by_key(|e| e.offset);
10 let mut err_pos = 0; 10 let mut err_pos = 0;
11 let mut level = 0; 11 let mut level = 0;