]> git.lizzy.rs Git - rust.git/commitdiff
Readability
authorkjeremy <kjeremy@gmail.com>
Mon, 13 Jan 2020 16:38:53 +0000 (11:38 -0500)
committerkjeremy <kjeremy@gmail.com>
Mon, 13 Jan 2020 16:38:53 +0000 (11:38 -0500)
crates/ra_ide/src/call_info.rs
crates/ra_parser/src/grammar/paths.rs

index 14f5ead6b16b6a6037d08959059709f91c130c14..72a68522e507d0f54329977513fb3497ec940211 100644 (file)
@@ -4,7 +4,7 @@
     ast::{self, ArgListOwner},
     match_ast, AstNode, SyntaxNode,
 };
-use std::cmp::Ordering;
+
 use test_utils::tested_by;
 
 use crate::{
@@ -51,14 +51,14 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal
     // If we have a calling expression let's find which argument we are on
     let num_params = call_info.parameters().len();
 
-    match num_params.cmp(&1) {
-        Ordering::Less => {}
-        Ordering::Equal => {
+    match num_params {
+        0 => (),
+        1 => {
             if !has_self {
                 call_info.active_parameter = Some(0);
             }
         }
-        Ordering::Greater => {
+        _ => {
             if let Some(arg_list) = calling_node.arg_list() {
                 // Number of arguments specified at the call site
                 let num_args_at_callsite = arg_list.args().count();
index e125c6b9cdedc351532aa53f9a52304490603140..ca8e075a1a9397a2e5df04afa3ea8e60df293797 100644 (file)
@@ -94,7 +94,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
 
 fn opt_path_type_args(p: &mut Parser, mode: Mode) {
     match mode {
-        Mode::Use => {}
+        Mode::Use => return,
         Mode::Type => {
             // test path_fn_trait_args
             // type F = Box<Fn(x: i32) -> ()>;