mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-18 02:38:38 +00:00
Merge #4359
4359: Fix panic in FunctionSignature r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
f4cd75ac06
1 changed files with 7 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
// FIXME: this modules relies on strings and AST way too much, and it should be
|
||||
// rewritten (matklad 2020-05-07)
|
||||
use std::{
|
||||
convert::From,
|
||||
fmt::{self, Display},
|
||||
|
@ -202,7 +204,11 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
|
|||
|
||||
res.extend(param_list.params().map(|param| param.syntax().text().to_string()));
|
||||
res_types.extend(param_list.params().map(|param| {
|
||||
param.syntax().text().to_string().split(':').nth(1).unwrap()[1..].to_string()
|
||||
let param_text = param.syntax().text().to_string();
|
||||
match param_text.split(':').nth(1) {
|
||||
Some(it) => it[1..].to_string(),
|
||||
None => param_text,
|
||||
}
|
||||
}));
|
||||
}
|
||||
(has_self_param, res, res_types)
|
||||
|
|
Loading…
Reference in a new issue