From 6cd2e04bd2a703c335566224e8b6bf773b83c0c6 Mon Sep 17 00:00:00 2001 From: Mikhail Rakhmanov Date: Wed, 3 Jun 2020 19:33:57 +0200 Subject: [PATCH] Fix more comments --- crates/rust-analyzer/src/main_loop/handlers.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index a3361d6dc5e..6acf80c5827 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs @@ -25,7 +25,7 @@ use ra_syntax::{AstNode, SyntaxKind, TextRange, TextSize}; use serde::{Deserialize, Serialize}; use serde_json::to_value; -use stdx::format_to; +use stdx::{format_to, split1}; use crate::{ cargo_target_spec::CargoTargetSpec, @@ -786,11 +786,10 @@ pub fn handle_resolve_code_action( let frange = FileRange { file_id, range }; let assists = snap.analysis().resolved_assists(&snap.config.assist, frange)?; - let id_components = params.id.split(":").collect::>(); - let index = id_components.last().unwrap().parse::().unwrap(); - let id_string = id_components.first().unwrap(); + let (id_string, index) = split1(¶ms.id, ':').unwrap(); + let index = index.parse::().unwrap(); let assist = &assists[index]; - assert!(assist.assist.id.0 == *id_string); + assert!(assist.assist.id.0 == id_string); Ok(to_proto::resolved_code_action(&snap, assist.clone())?.edit) }