Simplify code.

This commit is contained in:
Stephen Chung
2020-10-01 23:31:27 +08:00
parent a13fcc5cc2
commit e8d5f78f88
5 changed files with 104 additions and 89 deletions

View File

@@ -403,9 +403,9 @@ impl ExportedFn {
pub(crate) fn exported_name<'n>(&'n self) -> Cow<'n, str> {
if let Some(ref name) = self.params.name {
Cow::Borrowed(name.last().unwrap().as_str())
name.last().unwrap().as_str().into()
} else {
Cow::Owned(self.signature.ident.to_string())
self.signature.ident.to_string().into()
}
}