File tree 1 file changed +4
-5
lines changed
crates/rust-analyzer/src/main_loop
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ use ra_project_model::TargetKind;
25
25
use ra_syntax:: { AstNode , SyntaxKind , TextRange , TextSize } ;
26
26
use serde:: { Deserialize , Serialize } ;
27
27
use serde_json:: to_value;
28
- use stdx:: format_to;
28
+ use stdx:: { format_to, split1 } ;
29
29
30
30
use crate :: {
31
31
cargo_target_spec:: CargoTargetSpec ,
@@ -786,11 +786,10 @@ pub fn handle_resolve_code_action(
786
786
let frange = FileRange { file_id, range } ;
787
787
788
788
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 ( ) ;
792
791
let assist = & assists[ index] ;
793
- assert ! ( assist. assist. id. 0 == * id_string) ;
792
+ assert ! ( assist. assist. id. 0 == id_string) ;
794
793
Ok ( to_proto:: resolved_code_action ( & snap, assist. clone ( ) ) ?. edit )
795
794
}
796
795
You can’t perform that action at this time.
0 commit comments