FnSignature: use unwrap_or_default for parameter_name_list

Signed-off-by: imtsuki <me@qjx.app>
This commit is contained in:
imtsuki 2020-01-15 09:30:19 +08:00
parent d78a3cb638
commit d854ad8f27

View file

@ -169,11 +169,9 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
res.push(self_param.syntax().text().to_string())
}
res.extend(
param_list
.params()
.map(|param| param.pat().unwrap().syntax().text().to_string()),
);
res.extend(param_list.params().map(|param| {
param.pat().map(|pat| pat.syntax().text().to_string()).unwrap_or_default()
}));
}
res
}