diff options
author | kjeremy <[email protected]> | 2020-01-13 16:38:53 +0000 |
---|---|---|
committer | kjeremy <[email protected]> | 2020-01-13 16:38:53 +0000 |
commit | c5c5f4260b4ab1a03d2d3f7a616202369adc9ade (patch) | |
tree | 4ef3658ab7cd5b865fbc5c9e96795719bc87ead8 | |
parent | a82c679c97af1e0aabe9eb375573d5d23fc75391 (diff) |
Readability
-rw-r--r-- | crates/ra_ide/src/call_info.rs | 10 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/paths.rs | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs index 14f5ead6b..72a68522e 100644 --- a/crates/ra_ide/src/call_info.rs +++ b/crates/ra_ide/src/call_info.rs | |||
@@ -4,7 +4,7 @@ use ra_syntax::{ | |||
4 | ast::{self, ArgListOwner}, | 4 | ast::{self, ArgListOwner}, |
5 | match_ast, AstNode, SyntaxNode, | 5 | match_ast, AstNode, SyntaxNode, |
6 | }; | 6 | }; |
7 | use std::cmp::Ordering; | 7 | |
8 | use test_utils::tested_by; | 8 | use test_utils::tested_by; |
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
@@ -51,14 +51,14 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal | |||
51 | // If we have a calling expression let's find which argument we are on | 51 | // If we have a calling expression let's find which argument we are on |
52 | let num_params = call_info.parameters().len(); | 52 | let num_params = call_info.parameters().len(); |
53 | 53 | ||
54 | match num_params.cmp(&1) { | 54 | match num_params { |
55 | Ordering::Less => {} | 55 | 0 => (), |
56 | Ordering::Equal => { | 56 | 1 => { |
57 | if !has_self { | 57 | if !has_self { |
58 | call_info.active_parameter = Some(0); | 58 | call_info.active_parameter = Some(0); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | Ordering::Greater => { | 61 | _ => { |
62 | if let Some(arg_list) = calling_node.arg_list() { | 62 | if let Some(arg_list) = calling_node.arg_list() { |
63 | // Number of arguments specified at the call site | 63 | // Number of arguments specified at the call site |
64 | let num_args_at_callsite = arg_list.args().count(); | 64 | let num_args_at_callsite = arg_list.args().count(); |
diff --git a/crates/ra_parser/src/grammar/paths.rs b/crates/ra_parser/src/grammar/paths.rs index e125c6b9c..ca8e075a1 100644 --- a/crates/ra_parser/src/grammar/paths.rs +++ b/crates/ra_parser/src/grammar/paths.rs | |||
@@ -94,7 +94,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) { | |||
94 | 94 | ||
95 | fn opt_path_type_args(p: &mut Parser, mode: Mode) { | 95 | fn opt_path_type_args(p: &mut Parser, mode: Mode) { |
96 | match mode { | 96 | match mode { |
97 | Mode::Use => {} | 97 | Mode::Use => return, |
98 | Mode::Type => { | 98 | Mode::Type => { |
99 | // test path_fn_trait_args | 99 | // test path_fn_trait_args |
100 | // type F = Box<Fn(x: i32) -> ()>; | 100 | // type F = Box<Fn(x: i32) -> ()>; |