Skip to content

Commit 6cd2e04

Browse files
committed
Fix more comments
1 parent 6a0083a commit 6cd2e04

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

crates/rust-analyzer/src/main_loop/handlers.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use ra_project_model::TargetKind;
2525
use ra_syntax::{AstNode, SyntaxKind, TextRange, TextSize};
2626
use serde::{Deserialize, Serialize};
2727
use serde_json::to_value;
28-
use stdx::format_to;
28+
use stdx::{format_to, split1};
2929

3030
use crate::{
3131
cargo_target_spec::CargoTargetSpec,
@@ -786,11 +786,10 @@ pub fn handle_resolve_code_action(
786786
let frange = FileRange { file_id, range };
787787

788788
let assists = snap.analysis().resolved_assists(&snap.config.assist, frange)?;
789-
let id_components = params.id.split(":").collect::<Vec<&str>>();
790-
let index = id_components.last().unwrap().parse::<usize>().unwrap();
791-
let id_string = id_components.first().unwrap();
789+
let (id_string, index) = split1(&params.id, ':').unwrap();
790+
let index = index.parse::<usize>().unwrap();
792791
let assist = &assists[index];
793-
assert!(assist.assist.id.0 == *id_string);
792+
assert!(assist.assist.id.0 == id_string);
794793
Ok(to_proto::resolved_code_action(&snap, assist.clone())?.edit)
795794
}
796795

0 commit comments

Comments
 (0)